KrakReader - Version 0.1.8

Version Notes

stable release

Download this release

Release Info

Developer Aleksandr S
Extension KrakReader
Version 0.1.8
Comparing to
See all releases


Code changes from version 0.1.7 to 0.1.8

app/code/community/Wexo/KrakReader/Helper/KrakServiceDirect.php CHANGED
@@ -131,7 +131,7 @@ class Wexo_KrakReader_Helper_KrakServiceDirect extends Wexo_KrakReader_Helper_Kr
131
  $result[$k]['billing[postcode]'] = $v->Address->PostalCode;
132
  $result[$k]['billing[email]'] = $v->ContactInfo->EmailAddress;
133
  $result[$k]['billing[telephone]'] = (strlen($v->ContactInfo->TelephoneNumber) == 0) ? $v->ContactInfo->MobileTelephoneNumber : $v->ContactInfo->TelephoneNumber;
134
- $result[$k]['billing[street][]'] = trim($v->Address->RoadName . ' ' . $v->Address->HouseNumberNumericFrom);
135
  $result[$k]['billing[city]'] = $v->Address->PostalDistrict;
136
 
137
  $result[$k] = array_filter($result[$k]);
131
  $result[$k]['billing[postcode]'] = $v->Address->PostalCode;
132
  $result[$k]['billing[email]'] = $v->ContactInfo->EmailAddress;
133
  $result[$k]['billing[telephone]'] = (strlen($v->ContactInfo->TelephoneNumber) == 0) ? $v->ContactInfo->MobileTelephoneNumber : $v->ContactInfo->TelephoneNumber;
134
+ $result[$k]['billing[street]'] = trim($v->Address->RoadName . ' ' . $v->Address->HouseNumberNumericFrom);
135
  $result[$k]['billing[city]'] = $v->Address->PostalDistrict;
136
 
137
  $result[$k] = array_filter($result[$k]);
app/code/community/Wexo/KrakReader/Helper/KrakServiceGateway.php CHANGED
@@ -4,13 +4,11 @@ class Wexo_KrakReader_Helper_KrakServiceGateway extends Wexo_KrakReader_Helper_K
4
 
5
  const WEXO_KRAK_GATEWAY = 'http://krakauth.wexo.dk';
6
 
7
- private $userEmail;
8
- private $userHash;
9
  private $siteUrl;
10
 
11
  public function __construct() {
12
- $this->userEmail = Mage::getSingleton('customer/session')->getCustomer()->getData('email');
13
- $this->userHash = sha1(Mage::getSingleton('customer/session')->getCustomer()->getData('password_hash'));
14
  $this->siteUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
15
  }
16
 
@@ -21,8 +19,7 @@ class Wexo_KrakReader_Helper_KrakServiceGateway extends Wexo_KrakReader_Helper_K
21
  $client = new Zend_Http_Client(self::WEXO_KRAK_GATEWAY);
22
  $client->setAdapter($curl);
23
  $client->setMethod(Zend_Http_Client::POST);
24
- $client->setParameterPost("email", $this->userEmail);
25
- $client->setParameterPost("hash", $this->userHash);
26
  $client->setParameterPost("siteUrl", $this->siteUrl);
27
  $client->setParameterPost("search_value", $params['search_value']);
28
  $client->setParameterPost("search_field", $params['search_field']);
4
 
5
  const WEXO_KRAK_GATEWAY = 'http://krakauth.wexo.dk';
6
 
7
+ private $productKey;
 
8
  private $siteUrl;
9
 
10
  public function __construct() {
11
+ $this->productKey = Mage::getStoreConfig('krakreader/gateway_mode/product_key'); ;
 
12
  $this->siteUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
13
  }
14
 
19
  $client = new Zend_Http_Client(self::WEXO_KRAK_GATEWAY);
20
  $client->setAdapter($curl);
21
  $client->setMethod(Zend_Http_Client::POST);
22
+ $client->setParameterPost("productKey", $this->productKey);
 
23
  $client->setParameterPost("siteUrl", $this->siteUrl);
24
  $client->setParameterPost("search_value", $params['search_value']);
25
  $client->setParameterPost("search_field", $params['search_field']);
app/code/community/Wexo/KrakReader/etc/system.xml CHANGED
@@ -64,6 +64,26 @@
64
  </product_id>
65
  </fields>
66
  </direct_mode>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  <search_fields translate="label">
69
  <label>Search Fields</label>
64
  </product_id>
65
  </fields>
66
  </direct_mode>
67
+
68
+ <gateway_mode translate="label">
69
+ <label>Gateway mode</label>
70
+ <frontend_type>text</frontend_type>
71
+ <sort_order>20</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ <fields>
76
+ <product_key translate="label comment">
77
+ <label>Product Key</label>
78
+ <frontend_type>text</frontend_type>
79
+ <sort_order>10</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>1</show_in_store>
83
+ </product_key>
84
+ </fields>
85
+ </gateway_mode>
86
+
87
 
88
  <search_fields translate="label">
89
  <label>Search Fields</label>
app/design/frontend/default/default/layout/krakreader.xml CHANGED
@@ -31,5 +31,19 @@
31
  </block>
32
  </reference>
33
  </onestepcheckout_index_index>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  </layout>
31
  </block>
32
  </reference>
33
  </onestepcheckout_index_index>
34
+
35
+ <opcheck_index_index>
36
+ <reference name="head">
37
+ <action method="addItem"><type>skin_css</type><name>css/krakreader/krakreader.css</name></action>
38
+ <action method="addItem"><type>skin_js</type><name>js/krakreader/prototype.ajax.timeout.js</name></action>
39
+ <action method="addItem"><type>skin_js</type><name>js/krakreader/krakreader.js</name></action>
40
+ </reference>
41
+
42
+ <reference name="content">
43
+ <block type="core/template" name="krakreader" template="krakreader/form.phtml" >
44
+ <block type="core/template" name="krakloader" template="krakreader/loader.phtml" />
45
+ </block>
46
+ </reference>
47
+ </opcheck_index_index>
48
 
49
  </layout>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>KrakReader</name>
4
- <version>0.1.7</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Krak API service integration extension</summary>
10
- <description>Krak API service integration extension</description>
11
- <notes>stable</notes>
12
- <authors><author><name>Aleksandr S</name><user>grollover</user><email>grollover.s@gmail.com</email></author></authors>
13
- <date>2012-06-26</date>
14
- <time>11:31:16</time>
15
- <contents><target name="magecommunity"><dir name="Wexo"><dir name="KrakReader"><dir name="Helper"><file name="KrakService.php" hash="c1ce7a60584581c800c0c41dae2fdd45"/><file name="KrakServiceDirect.php" hash="98227f312ca5e29718db64bb1eab7273"/><file name="KrakServiceGateway.php" hash="8a60efc97f9af27974936b489126e954"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Mode.php" hash="3a65df6500102f135a0f7f5609064a7b"/></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="50b73e1b65434f61ddf9f0aefffb6455"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0a622b367412fd38504a0c9b53c4c226"/><file name="config.xml" hash="4431d5828884dbaf8447a44da7c4d43d"/><file name="system.xml" hash="4af4412e0f406c51a9c1d424e05f99d3"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="krakreader.xml" hash="7368ac8a1b18fbb3ffd2e2321dd86933"/></dir><dir name="template"><dir name="krakreader"><file name="form.phtml" hash="e4ce87c37cefd2e50a44783bb575c238"/><file name="loader.phtml" hash="73c05a9a93f335f989a9ef05a06130c1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wexo_KrakReader.xml" hash="3432fb22b107b8524288dbfcb722134f"/></dir></target><target name="magelocale"><dir><dir name="da_DK"><file name="Wexo_Krakreader.csv" hash="1f438d99b03b6c3c93caf4d79a5395a1"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="krakreader"><dir name="images"><file name="ajax-loader.gif" hash="780ca74fe81575cf971596ec89e98d76"/></dir><file name="krakreader.css" hash="264a145bd0703001ff80530fc6c6a5a4"/></dir></dir><dir name="js"><dir name="krakreader"><file name="krakreader.js" hash="071fa0033416ec956bcc6b80d502e497"/><file name="prototype.ajax.timeout.js" hash="740055672f5e2d14c2fcb89df976d094"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>KrakReader</name>
4
+ <version>0.1.8</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Used to quickly filling in on the form of checkout, the information obtained by the Krak API service.</summary>
10
+ <description>Now your Danish shoppers can simply put up their phone numbers in the checkout page and their personal details including name, address, country and email address will automatically get filled by the system.</description>
11
+ <notes>stable release</notes>
12
+ <authors><author><name>Aleksandr S</name><user>wexo_dk</user><email>magento@wexo.dk</email></author></authors>
13
+ <date>2012-07-03</date>
14
+ <time>10:50:07</time>
15
+ <contents><target name="magecommunity"><dir name="Wexo"><dir name="KrakReader"><dir name="Helper"><file name="KrakService.php" hash="c1ce7a60584581c800c0c41dae2fdd45"/><file name="KrakServiceDirect.php" hash="7de7ca2fc6722d7830923ae9be7c719a"/><file name="KrakServiceGateway.php" hash="62b5f2b544d1201f1c22795890117988"/></dir><dir name="Model"><dir name="Config"><dir name="Source"><file name="Mode.php" hash="3a65df6500102f135a0f7f5609064a7b"/></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="50b73e1b65434f61ddf9f0aefffb6455"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0a622b367412fd38504a0c9b53c4c226"/><file name="config.xml" hash="4431d5828884dbaf8447a44da7c4d43d"/><file name="system.xml" hash="5bab29c12df7d2f707db7db40fe4b863"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="krakreader.xml" hash="80e539b885ca66da435ce0a3f0f2a024"/></dir><dir name="template"><dir name="krakreader"><file name="form.phtml" hash="e4ce87c37cefd2e50a44783bb575c238"/><file name="loader.phtml" hash="73c05a9a93f335f989a9ef05a06130c1"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wexo_KrakReader.xml" hash="3432fb22b107b8524288dbfcb722134f"/></dir></target><target name="magelocale"><dir><dir name="da_DK"><file name="Wexo_Krakreader.csv" hash="1f438d99b03b6c3c93caf4d79a5395a1"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="krakreader"><dir name="images"><file name="ajax-loader.gif" hash="780ca74fe81575cf971596ec89e98d76"/></dir><file name="krakreader.css" hash="264a145bd0703001ff80530fc6c6a5a4"/></dir></dir><dir name="js"><dir name="krakreader"><file name="krakreader.js" hash="d6d804ac5fc146cf9c10ca6622c9d086"/><file name="prototype.ajax.timeout.js" hash="740055672f5e2d14c2fcb89df976d094"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
skin/frontend/default/default/js/krakreader/krakreader.js CHANGED
@@ -4,12 +4,21 @@ document.observe("dom:loaded", function() {
4
  var krakBlock = $$('.krak_reader')[0];
5
  var whileLoader = $$(".krak_whileload")[0];
6
  var errorContainer = $('krakErrors');
 
 
7
 
8
- krakBlock.remove();
9
-
10
- $('co-billing-form').insert({
11
- before: krakBlock
12
- });
 
 
 
 
 
 
 
13
 
14
  $$('.krak_search').each(function(item){
15
  item.observe('click', function(){
@@ -60,7 +69,7 @@ document.observe("dom:loaded", function() {
60
  resultsOptions += '<option value='+k+'>' + optionString + '</option>';
61
  });
62
 
63
- $$('.krakResults select')[0].insert(resultsOptions);
64
  $$('.krakResults')[0].setStyle({
65
  display:"block"
66
  });
@@ -91,7 +100,8 @@ document.observe("dom:loaded", function() {
91
 
92
  function fillInputs(data){
93
  $H(data).each(function(item){
94
- $$('input[name="'+item.key+'"]')[0].setValue(item.value);
 
95
  });
96
  }
97
 
4
  var krakBlock = $$('.krak_reader')[0];
5
  var whileLoader = $$(".krak_whileload")[0];
6
  var errorContainer = $('krakErrors');
7
+
8
+ $$('.krak_reader')[0].remove();
9
 
10
+ //add krak block
11
+ if($('co-billing-form') != null) { //default checkout
12
+ $('co-billing-form').insert({
13
+ before: krakBlock
14
+ });
15
+ }
16
+ else if($('billing_address_list') != null){ //OSC
17
+ $('billing_address_list').insert({
18
+ before: krakBlock
19
+ });
20
+ }
21
+ else return false;
22
 
23
  $$('.krak_search').each(function(item){
24
  item.observe('click', function(){
69
  resultsOptions += '<option value='+k+'>' + optionString + '</option>';
70
  });
71
 
72
+ $$('.krakResults select')[0].update('').insert(resultsOptions);
73
  $$('.krakResults')[0].setStyle({
74
  display:"block"
75
  });
100
 
101
  function fillInputs(data){
102
  $H(data).each(function(item){
103
+ if($$('input[name^="'+item.key+'"]')[0] != undefined)
104
+ $$('input[name^="'+item.key+'"]')[0].setValue(item.value);
105
  });
106
  }
107