Crafty_Clicks_Clicktoaddress - Version 0.5.1

Version Notes

- Initial release for our global address endpoint.

Download this release

Release Info

Developer Gabor Suranyi
Extension Crafty_Clicks_Clicktoaddress
Version 0.5.1
Comparing to
See all releases


Code changes from version 0.5.0 to 0.5.1

app/code/community/Craftyclicks/C2a/Block/Feedback.php CHANGED
@@ -5,7 +5,5 @@ class Craftyclicks_C2a_Block_Feedback extends Mage_Core_Block_Template
5
  public function _construct() {
6
  parent::_construct();
7
  }
8
- public function getStatus($param){
9
- echo '<script>alert("banana");</script>';
10
- }
11
  }
5
  public function _construct() {
6
  parent::_construct();
7
  }
8
+ /* functionality to be announced soon */
 
 
9
  }
app/code/community/Craftyclicks/C2a/Block/Gridlight.php CHANGED
@@ -1,29 +1,5 @@
1
  <?php
2
  class Craftyclicks_C2a_Block_Gridlight extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
  {
4
- public function render(Varien_Object $row)
5
- {
6
- $error_img = '<img src="'.$this->getSkinUrl('images/error_msg_icon.gif').'"/>';
7
- $success_img = '<img src="'.$this->getSkinUrl('images/success_msg_icon.gif').'"/>';
8
- //Get the order details based on the order id ($orderId)
9
- $order = Mage::getModel('sales/order')->load($row->getData('entity_id'));
10
-
11
- // Get the id of the orders shipping address
12
- $shippingId = $order->getShippingAddress()->getId();
13
- $billingId = $order->getBillingAddress()->getId();
14
- // Get shipping address data using the id
15
- $shippingaddress = Mage::getModel('sales/order_address')->load($shippingId);
16
- $billingaddress = Mage::getModel('sales/order_address')->load($billingId);
17
- /*echo '<pre>';
18
- //var_dump($row->getData('addresses'));
19
- var_dump($shippingaddress);
20
- var_dump($billingaddress);
21
- echo '</pre>';
22
- */
23
- //$test = Mage::getModel('craftyclicks_c2a/address')->getCollection();
24
- //var_dump($test);
25
- return $error_img;
26
- //return print_r($row, true);
27
- }
28
-
29
  }
1
  <?php
2
  class Craftyclicks_C2a_Block_Gridlight extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
3
  {
4
+ /* functionality to be announced soon */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  }
app/code/community/Craftyclicks/C2a/Block/Integration.php CHANGED
@@ -25,18 +25,6 @@ class Craftyclicks_C2a_Block_Integration extends Mage_Core_Block_Template
25
  $head->addItem('js', $path.'/default.js');
26
  break;
27
  }
28
- } elseif($config->cc_pcl_frontend || $config->cc_pcl_backend){
29
- /*
30
- $head->addItem('js', $path.'crafty_postcode.class.js');
31
- switch($param){
32
- case 'admin':
33
- $head->addItem('js', $path.'craftyclicks_magento_admin.js');
34
- break;
35
- default:
36
- $head->addItem('js', $path.'craftyclicks_magento.js');
37
- break;
38
- }
39
- */
40
  }
41
  return $this;
42
  }
@@ -46,15 +34,9 @@ class Craftyclicks_C2a_Block_Integration extends Mage_Core_Block_Template
46
  'cc_pcl_backend' => (int) Mage::getStoreConfig('clicktoaddress/general/active_admin_panel'),
47
  'cc_c2a_global' => (int) Mage::getStoreConfig('c2a_global/options/active')
48
  );
49
- /*$message = $this->__('Banana.');
50
- Mage::getSingleton('adminhtml/session')->addSuccess($message);
51
- */
52
  if($config->cc_c2a_global){
53
  echo $this->getLayout()->createBlock('core/template')->setTemplate('craftyclicks/c2a/c2a_config.phtml')->toHtml();
54
 
55
- } elseif($config->cc_pcl_frontend || $config->cc_pcl_backend){
56
- //echo $this->getLayout()->createBlock('core/template')->setTemplate('craftyclicks/clicktoaddress/common_config.phtml');
57
  }
58
-
59
  }
60
  }
25
  $head->addItem('js', $path.'/default.js');
26
  break;
27
  }
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
  return $this;
30
  }
34
  'cc_pcl_backend' => (int) Mage::getStoreConfig('clicktoaddress/general/active_admin_panel'),
35
  'cc_c2a_global' => (int) Mage::getStoreConfig('c2a_global/options/active')
36
  );
 
 
 
37
  if($config->cc_c2a_global){
38
  echo $this->getLayout()->createBlock('core/template')->setTemplate('craftyclicks/c2a/c2a_config.phtml')->toHtml();
39
 
 
 
40
  }
 
41
  }
42
  }
app/code/community/Craftyclicks/C2a/Block/Ordergrid.php CHANGED
@@ -4,14 +4,5 @@ class Craftyclicks_C2a_Block_Ordergrid extends Mage_Adminhtml_Block_Sales_Order_
4
  protected function _prepareColumns()
5
  {
6
  parent::_prepareColumns();
7
- $this->addColumn('cc_valid', array(
8
- 'header' => Mage::helper('catalog')->__('CC'),
9
- 'index' => 'cc_valid',
10
- 'width' => '50px',
11
- 'type' => 'text',
12
- 'filter' => false,
13
- 'sortable' => false,
14
- 'renderer' => 'Craftyclicks_Clicktoaddress_Block_Gridlight'
15
- ));
16
  }
17
  }
4
  protected function _prepareColumns()
5
  {
6
  parent::_prepareColumns();
 
 
 
 
 
 
 
 
 
7
  }
8
  }
app/code/community/Craftyclicks/C2a/Model/Mode.php CHANGED
@@ -5,13 +5,13 @@ class Craftyclicks_C2a_Model_Mode
5
  public function toOptionArray()
6
  {
7
  return array(
8
- array(
9
- 'value' => '2',
10
- 'label' => 'Surround'
11
- ),
12
  array(
13
  'value' => '1',
14
  'label' => 'Simple Below'
 
 
 
 
15
  )
16
  );
17
  }
5
  public function toOptionArray()
6
  {
7
  return array(
 
 
 
 
8
  array(
9
  'value' => '1',
10
  'label' => 'Simple Below'
11
+ ),
12
+ array(
13
+ 'value' => '2',
14
+ 'label' => 'Surround'
15
  )
16
  );
17
  }
app/code/community/Craftyclicks/C2a/Model/Resource/Address/Collection.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
  class Craftyclicks_C2a_Model_Resource_Address_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
3
  {
4
- public function _construct()
5
- {
6
- $this->_init('craftyclicks_c2a/address');
7
- }
8
  }
1
  <?php
2
  class Craftyclicks_C2a_Model_Resource_Address_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
3
  {
4
+ public function _construct()
5
+ {
6
+ $this->_init('craftyclicks_c2a/address');
7
+ }
8
  }
app/code/community/Craftyclicks/C2a/etc/config.xml CHANGED
@@ -45,7 +45,7 @@
45
  <access_token>xxxxx-xxxxx-xxxxx-xxxxx</access_token>
46
  </options>
47
  <design>
48
- <dropdown_mode>1</dropdown_mode>
49
  <dropdown_ambient>light</dropdown_ambient>
50
  <dropdown_accent>default</dropdown_accent>
51
  </design>
45
  <access_token>xxxxx-xxxxx-xxxxx-xxxxx</access_token>
46
  </options>
47
  <design>
48
+ <dropdown_mode>2</dropdown_mode>
49
  <dropdown_ambient>light</dropdown_ambient>
50
  <dropdown_accent>default</dropdown_accent>
51
  </design>
app/code/community/Craftyclicks/C2a/etc/config.xml~ DELETED
@@ -1,123 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Craftyclicks_C2a>
5
- <version>0.5.0</version>
6
- </Craftyclicks_C2a>
7
- </modules>
8
-
9
- <global>
10
- <blocks>
11
- <c2a>
12
- <class>Craftyclicks_C2a_Block</class>
13
- </c2a>
14
- <adminhtml>
15
- <rewrite>
16
- <sales_order_grid>Craftyclicks_C2a_Block_Ordergrid</sales_order_grid>
17
- </rewrite>
18
- </adminhtml>
19
- </blocks>
20
- <helpers>
21
- <c2a>
22
- <class>Craftyclicks_C2a_Helper</class>
23
- </c2a>
24
- </helpers>
25
- <models>
26
- <craftyclicks_c2a>
27
- <class>Craftyclicks_C2a_Model</class>
28
- <resourceModel>craftyclicks_c2a_resource</resourceModel>
29
- </craftyclicks_c2a>
30
- <craftyclicks_c2a_resource>
31
- <class>Craftyclicks_C2a_Model_Resource</class>
32
- <entities>
33
- <address>
34
- <table>craftyclicks_c2a_address</table>
35
- </address>
36
- </entities>
37
- </craftyclicks_c2a_resource>
38
- </models>
39
- </global>
40
-
41
- <default>
42
- <c2a_global>
43
- <options>
44
- <active>0</active>
45
- <access_token>xxxxx-xxxxx-xxxxx-xxxxx</access_token>
46
- </options>
47
- <design>
48
- <dropdown_mode>1</dropdown_mode>
49
- <dropdown_ambient>light</dropdown_ambient>
50
- <dropdown_accent>default</dropdown_accent>
51
- </design>
52
- <texts>
53
- <search_label>Address Search</search_label>
54
- <search_placeholder>Start with post/zip code or street</search_placeholder>
55
- <country_placeholder>Type here to search for a country</country_placeholder>
56
- <country_button>Change Country</country_button>
57
- <error_msg_1>No results found</error_msg_1>
58
- <error_msg_2>An error occured. Please enter your address manually</error_msg_2>
59
- </texts>
60
- </c2a_global>
61
- </default>
62
-
63
- <frontend>
64
- <layout>
65
- <updates>
66
- <craftyclicks_c2a>
67
- <file>craftyclicks_c2a.xml</file>
68
- </craftyclicks_c2a>
69
- </updates>
70
- </layout>
71
- <routers>
72
- <c2a_hash>
73
- <use>standard</use>
74
- <args>
75
- <module>Craftyclicks_C2a</module>
76
- <frontName>c2a</frontName>
77
- </args>
78
- </c2a_hash>
79
- </routers>
80
- </frontend>
81
-
82
- <adminhtml>
83
- <layout>
84
- <updates>
85
- <craftyclicks_c2a>
86
- <file>craftyclicks_c2a.xml</file>
87
- </craftyclicks_c2a>
88
- </updates>
89
- </layout>
90
- <acl>
91
- <resources>
92
- <all>
93
- <title>Allow Everything</title>
94
- </all>
95
- <admin>
96
- <children>
97
- <system>
98
- <children>
99
- <config>
100
- <children>
101
- <c2a_global translate="title" module="c2a">
102
- <title>Click To Address Global</title>
103
- </c2a_global>
104
- </children>
105
- </config>
106
- </children>
107
- </system>
108
- </children>
109
- </admin>
110
- </resources>
111
- </acl>
112
- </adminhtml>
113
-
114
- <global>
115
- <resources>
116
- <craftyclicks_c2a_setup>
117
- <setup>
118
- <module>Craftyclicks_C2a</module>
119
- </setup>
120
- </craftyclicks_c2a_setup>
121
- </resources>
122
- </global>
123
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Craftyclicks/C2a/etc/system.xml~ DELETED
@@ -1,145 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <config>
3
- <tabs>
4
- <craftyclicks translate="label">
5
- <label><![CDATA[<img style="margin: 4px 4px 4px 0px;" src="https://craftyclicks.co.uk/assets/magento/crafty-logo.png" alt="Crafty Clicks" border="0" />]]></label>
6
- <sort_order>101</sort_order>
7
- </craftyclicks>
8
- </tabs>
9
-
10
- <sections>
11
- <c2a_global translate="label" module="c2a">
12
- <label>Global Address Auto-complete</label>
13
- <tab>craftyclicks</tab>
14
- <sort_order>99</sort_order>
15
- <show_in_default>1</show_in_default>
16
- <show_in_website>1</show_in_website>
17
- <show_in_store>1</show_in_store>
18
- <groups>
19
- <options translate="label" module="c2a">
20
- <label>Main Settings</label>
21
- <frontend_type>text</frontend_type>
22
- <sort_order>100</sort_order>
23
- <show_in_default>1</show_in_default>
24
- <show_in_website>1</show_in_website>
25
- <show_in_store>1</show_in_store>
26
- <fields>
27
- <active translate="label">
28
- <label>Enabled - Frontend</label>
29
- <frontend_type>select</frontend_type>
30
- <source_model>adminhtml/system_config_source_yesno</source_model>
31
- <sort_order>10</sort_order>
32
- <show_in_default>1</show_in_default>
33
- <show_in_website>1</show_in_website>
34
- <show_in_store>1</show_in_store>
35
- </active>
36
- <access_token translate="label">
37
- <label>Access Token</label>
38
- <frontend_type>text</frontend_type>
39
- <sort_order>20</sort_order>
40
- <show_in_default>1</show_in_default>
41
- <show_in_website>1</show_in_website>
42
- <show_in_store>1</show_in_store>
43
- </access_token>
44
- </fields>
45
- </options>
46
- <design>
47
- <label>Design</label>
48
- <frontend_type>text</frontend_type>
49
- <sort_order>200</sort_order>
50
- <show_in_default>1</show_in_default>
51
- <show_in_website>1</show_in_website>
52
- <show_in_store>1</show_in_store>
53
- <fields>
54
- <dropdown_mode translate="label">
55
- <label>Mode</label>
56
- <frontend_type>select</frontend_type>
57
- <source_model>craftyclicks_c2a/mode</source_model>
58
- <sort_order>10</sort_order>
59
- <show_in_default>1</show_in_default>
60
- <show_in_website>1</show_in_website>
61
- <show_in_store>1</show_in_store>
62
- </dropdown_mode>
63
- <dropdown_ambient translate="label">
64
- <label>Ambient</label>
65
- <frontend_type>select</frontend_type>
66
- <source_model>craftyclicks_c2a/ambient</source_model>
67
- <sort_order>10</sort_order>
68
- <show_in_default>1</show_in_default>
69
- <show_in_website>1</show_in_website>
70
- <show_in_store>1</show_in_store>
71
- </dropdown_ambient>
72
- <dropdown_accent translate="label">
73
- <label>Accent</label>
74
- <frontend_type>text</frontend_type>
75
- <validate>color</validate>
76
- <sort_order>30</sort_order>
77
- <show_in_default>1</show_in_default>
78
- <show_in_website>1</show_in_website>
79
- <show_in_store>1</show_in_store>
80
- </dropdown_accent>
81
- </fields>
82
- </design>
83
- <texts>
84
- <label>Texts</label>
85
- <frontend_type>text</frontend_type>
86
- <sort_order>800</sort_order>
87
- <show_in_default>1</show_in_default>
88
- <show_in_website>1</show_in_website>
89
- <show_in_store>1</show_in_store>
90
- <fields>
91
- <search_label translate="label">
92
- <label>Search Label</label>
93
- <frontend_type>text</frontend_type>
94
- <sort_order>10</sort_order>
95
- <show_in_default>1</show_in_default>
96
- <show_in_website>1</show_in_website>
97
- <show_in_store>1</show_in_store>
98
- </search_label>
99
- <search_placeholder translate="label">
100
- <label>Search Placeholder</label>
101
- <frontend_type>text</frontend_type>
102
- <sort_order>20</sort_order>
103
- <show_in_default>1</show_in_default>
104
- <show_in_website>1</show_in_website>
105
- <show_in_store>1</show_in_store>
106
- </search_placeholder>
107
- <country_placeholder translate="label">
108
- <label>Placeholder for Country Selection</label>
109
- <frontend_type>text</frontend_type>
110
- <sort_order>30</sort_order>
111
- <show_in_default>1</show_in_default>
112
- <show_in_website>1</show_in_website>
113
- <show_in_store>1</show_in_store>
114
- </country_placeholder>
115
- <country_button translate="label">
116
- <label>Change Country button text</label>
117
- <frontend_type>text</frontend_type>
118
- <sort_order>40</sort_order>
119
- <show_in_default>1</show_in_default>
120
- <show_in_website>1</show_in_website>
121
- <show_in_store>1</show_in_store>
122
- </country_button>
123
- <error_msg_1 translate="label">
124
- <label>No Results Message</label>
125
- <frontend_type>text</frontend_type>
126
- <sort_order>50</sort_order>
127
- <show_in_default>1</show_in_default>
128
- <show_in_website>1</show_in_website>
129
- <show_in_store>1</show_in_store>
130
- </error_msg_1>
131
- <error_msg_2 translate="label">
132
- <label>Generic Error Message</label>
133
- <frontend_type>text</frontend_type>
134
- <sort_order>60</sort_order>
135
- <show_in_default>1</show_in_default>
136
- <show_in_website>1</show_in_website>
137
- <show_in_store>1</show_in_store>
138
- </error_msg_2>
139
- </fields>
140
- </texts>
141
- </groups>
142
- </c2a_global>
143
- </sections>
144
-
145
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Craftyclicks/C2a/sql/craftyclicks_c2a_setup/install-0.5.0.php CHANGED
@@ -1,5 +1,4 @@
1
  <?php
2
-
3
  $installer = $this;
4
 
5
  $installer->startSetup();
1
  <?php
 
2
  $installer = $this;
3
 
4
  $installer->startSetup();
app/code/community/Craftyclicks/C2a/sql/craftyclicks_clicktoaddress_setup/install-1.0.0.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
- /*
3
- $installer = $this;
4
-
5
- $installer->startSetup();
6
-
7
- $table = $installer->getConnection()
8
- ->newTable($installer->getTable('inchoo_dbscript/ticket'))
9
- ->addColumn('ticket_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
10
- 'identity' => true,
11
- 'unsigned' => true,
12
- 'nullable' => false,
13
- 'primary' => true,
14
- ), 'Id')
15
- ->addColumn('title', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
16
- 'nullable' => false,
17
- ), 'Title')
18
- ->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
19
- 'nullable' => false,
20
- ), 'Description');
21
- $installer->getConnection()->createTable($table);
22
-
23
- $table = $installer->getConnection()
24
- ->newTable($installer->getTable('inchoo_dbscript/comment'))
25
- ->addColumn('comment_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
26
- 'identity' => true,
27
- 'unsigned' => true,
28
- 'nullable' => false,
29
- 'primary' => true,
30
- ), 'Id')
31
- ->addColumn('comment', Varien_Db_Ddl_Table::TYPE_VARCHAR, null, array(
32
- 'nullable' => false,
33
- ), 'Comment');
34
- $installer->getConnection()->createTable($table);
35
-
36
- $installer->endSetup();
37
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/craftyclicks_c2a.xml CHANGED
@@ -10,16 +10,18 @@
10
  -->
11
 
12
  <layout>
13
- <adminhtml_sales_order_create_load_block_data>
14
  <reference name="head">
15
  <block type="c2a/integration" name="integration">
16
  <action method="addJS">
17
  <parameter>admin</parameter>
18
  </action>
19
- <action method="addConfig"/>
20
  </block>
21
  </reference>
22
- </adminhtml_sales_order_create_load_block_data>
 
 
 
23
 
24
  <adminhtml_customer_edit>
25
  <reference name="head">
@@ -27,9 +29,11 @@
27
  <action method="addJS">
28
  <parameter>admin</parameter>
29
  </action>
30
- <action method="addConfig"/>
31
  </block>
32
  </reference>
 
 
 
33
  </adminhtml_customer_edit>
34
 
35
  <adminhtml_customer_new>
@@ -38,9 +42,11 @@
38
  <action method="addJS">
39
  <parameter>admin</parameter>
40
  </action>
41
- <action method="addConfig"/>
42
  </block>
43
  </reference>
 
 
 
44
  </adminhtml_customer_new>
45
 
46
  <adminhtml_sales_order_address>
@@ -49,9 +55,11 @@
49
  <action method="addJS">
50
  <parameter>admin</parameter>
51
  </action>
52
- <action method="addConfig"/>
53
  </block>
54
  </reference>
 
 
 
55
  </adminhtml_sales_order_address>
56
 
57
  <adminhtml_system_config_edit>
10
  -->
11
 
12
  <layout>
13
+ <adminhtml_sales_order_create_index>
14
  <reference name="head">
15
  <block type="c2a/integration" name="integration">
16
  <action method="addJS">
17
  <parameter>admin</parameter>
18
  </action>
 
19
  </block>
20
  </reference>
21
+ <reference name="js">
22
+ <block type="adminhtml/template" name="craftyclicks_config" template="craftyclicks/c2a/c2a_config.phtml" />
23
+ </reference>
24
+ </adminhtml_sales_order_create_index>
25
 
26
  <adminhtml_customer_edit>
27
  <reference name="head">
29
  <action method="addJS">
30
  <parameter>admin</parameter>
31
  </action>
 
32
  </block>
33
  </reference>
34
+ <reference name="js">
35
+ <block type="adminhtml/template" name="craftyclicks_config" template="craftyclicks/c2a/c2a_config.phtml" />
36
+ </reference>
37
  </adminhtml_customer_edit>
38
 
39
  <adminhtml_customer_new>
42
  <action method="addJS">
43
  <parameter>admin</parameter>
44
  </action>
 
45
  </block>
46
  </reference>
47
+ <reference name="js">
48
+ <block type="adminhtml/template" name="craftyclicks_config" template="craftyclicks/c2a/c2a_config.phtml" />
49
+ </reference>
50
  </adminhtml_customer_new>
51
 
52
  <adminhtml_sales_order_address>
55
  <action method="addJS">
56
  <parameter>admin</parameter>
57
  </action>
 
58
  </block>
59
  </reference>
60
+ <reference name="js">
61
+ <block type="adminhtml/template" name="craftyclicks_config" template="craftyclicks/c2a/c2a_config.phtml" />
62
+ </reference>
63
  </adminhtml_sales_order_address>
64
 
65
  <adminhtml_system_config_edit>
app/design/adminhtml/default/default/template/craftyclicks/c2a/c2a_config.phtml CHANGED
@@ -16,9 +16,15 @@ if (1 == $conf['active']) {
16
  'ambient' => $design['dropdown_ambient'],
17
  'accent' => $design['dropdown_accent']
18
  ),
19
- 'advanced' => (object) array(
20
- 'uk_internal_access_token' => $advanced['uk_internal_access_token']
21
- )
 
 
 
 
 
 
22
  );
23
 
24
  /* ---------------------------------------------------------------------------
@@ -96,9 +102,8 @@ if (1 == $conf['active']) {
96
  );
97
  }
98
  ?>
99
-
100
  <script type="text/javascript">
101
  //<![CDATA[
102
- var c2a_config = <?php echo json_encode($output); ?>
103
  //]]>
104
  </script>
16
  'ambient' => $design['dropdown_ambient'],
17
  'accent' => $design['dropdown_accent']
18
  ),
19
+ 'texts' => (object) array(
20
+ 'search_label' => $texts['search_label'],
21
+ 'default_placeholder' => $texts['search_placeholder'],
22
+ 'country_placeholder' => $texts['country_placeholder'],
23
+ 'country_button' => $texts['country_button'],
24
+ 'generic_error' => $texts['error_msg_1'],
25
+ 'no_results' => $texts['error_msg_2']
26
+ ),
27
+ 'cc_hash_url' => Mage::getUrl('c2a/hash/save',array('_secure'=>true))
28
  );
29
 
30
  /* ---------------------------------------------------------------------------
102
  );
103
  }
104
  ?>
 
105
  <script type="text/javascript">
106
  //<![CDATA[
107
+ var c2a_config = <?php echo json_encode($output); ?>;
108
  //]]>
109
  </script>
app/design/frontend/base/default/layout/craftyclicks_c2a.xml CHANGED
@@ -19,8 +19,8 @@
19
  <action method="addJS">
20
  <parameter>default</parameter>
21
  </action>
22
- <action method="addConfig"/>
23
  </block>
 
24
  </reference>
25
  </checkout_onepage_index>
26
 
@@ -30,8 +30,8 @@
30
  <action method="addJS">
31
  <parameter>default</parameter>
32
  </action>
33
- <action method="addConfig"/>
34
  </block>
 
35
  </reference>
36
  </checkout_multishipping_customer_address>
37
 
@@ -41,8 +41,8 @@
41
  <action method="addJS">
42
  <parameter>default</parameter>
43
  </action>
44
- <action method="addConfig"/>
45
  </block>
 
46
  </reference>
47
  </checkout_multishipping_register>
48
 
@@ -52,8 +52,8 @@
52
  <action method="addJS">
53
  <parameter>default</parameter>
54
  </action>
55
- <action method="addConfig"/>
56
  </block>
 
57
  </reference>
58
  </customer_address_form>
59
 
@@ -63,8 +63,8 @@
63
  <action method="addJS">
64
  <parameter>default</parameter>
65
  </action>
66
- <action method="addConfig"/>
67
  </block>
 
68
  </reference>
69
  </customer_account_create>
70
  </layout>
19
  <action method="addJS">
20
  <parameter>default</parameter>
21
  </action>
 
22
  </block>
23
+ <block type="page/html" name="craftyclicks_config" template="craftyclicks/c2a/c2a_config.phtml" />
24
  </reference>
25
  </checkout_onepage_index>
26
 
30
  <action method="addJS">
31
  <parameter>default</parameter>
32
  </action>
 
33
  </block>
34
+ <block type="page/html" name="craftyclicks_config" template="craftyclicks/c2a/c2a_config.phtml" />
35
  </reference>
36
  </checkout_multishipping_customer_address>
37
 
41
  <action method="addJS">
42
  <parameter>default</parameter>
43
  </action>
 
44
  </block>
45
+ <block type="page/html" name="craftyclicks_config" template="craftyclicks/c2a/c2a_config.phtml" />
46
  </reference>
47
  </checkout_multishipping_register>
48
 
52
  <action method="addJS">
53
  <parameter>default</parameter>
54
  </action>
 
55
  </block>
56
+ <block type="page/html" name="craftyclicks_config" template="craftyclicks/c2a/c2a_config.phtml" />
57
  </reference>
58
  </customer_address_form>
59
 
63
  <action method="addJS">
64
  <parameter>default</parameter>
65
  </action>
 
66
  </block>
67
+ <block type="page/html" name="craftyclicks_config" template="craftyclicks/c2a/c2a_config.phtml" />
68
  </reference>
69
  </customer_account_create>
70
  </layout>
app/design/frontend/base/default/template/craftyclicks/c2a/c2a_config.phtml CHANGED
@@ -18,6 +18,14 @@ if (1 == $conf['active']) {
18
  'ambient' => $design['dropdown_ambient'],
19
  'accent' => $design['dropdown_accent']
20
  ),
 
 
 
 
 
 
 
 
21
  'cc_hash_url' => Mage::getUrl('c2a/hash/save',array('_secure'=>true))
22
  );
23
 
18
  'ambient' => $design['dropdown_ambient'],
19
  'accent' => $design['dropdown_accent']
20
  ),
21
+ 'texts' => (object) array(
22
+ 'search_label' => $texts['search_label'],
23
+ 'default_placeholder' => $texts['search_placeholder'],
24
+ 'country_placeholder' => $texts['country_placeholder'],
25
+ 'country_button' => $texts['country_button'],
26
+ 'generic_error' => $texts['error_msg_1'],
27
+ 'no_results' => $texts['error_msg_2']
28
+ ),
29
  'cc_hash_url' => Mage::getUrl('c2a/hash/save',array('_secure'=>true))
30
  );
31
 
js/craftyclicks/c2a/admin.js CHANGED
@@ -24,7 +24,7 @@ function cc_magento(magentoCfg){
24
  var li_class = 'wide';
25
 
26
  if (!$(magentoCfg.prefix+'_cc_search_input')) {
27
- var tmp_html = '<tr><td class="label">Address Search</td><td class="value">'+
28
  '<input id="'+magentoCfg.prefix+'_cc_search_input" class="input-text" type="text"/></td></tr>';
29
  magentoCfg.fields.street1_obj.up('tr').insert( {before: tmp_html} );
30
  }
@@ -36,6 +36,7 @@ function cc_magento(magentoCfg){
36
  company: magentoCfg.fields.company_obj,
37
  postcode: magentoCfg.fields.postcode_obj,
38
  county: magentoCfg.fields.county_obj,
 
39
  country: magentoCfg.fields.country_obj
40
  });
41
  }
@@ -55,30 +56,27 @@ document.observe('dom:loaded', function() {
55
  accent: c2a_config.design.accent
56
  },
57
  showLogo: false,
58
- texts: {
59
- default_placeholder: 'Typo here where you wanna go'
60
- },
61
- cssPath: false
62
- /*
63
- onResultSelected: function(address){
64
- console.log(address);
65
- var address_data = {
66
- line_1: address.line_1,
67
- line_2: address.line_2,
68
- town: address.locality,
69
- postal_code: address.postal_code
70
  };
71
- new Ajax.Request(c2a_config.cc_hash_url,{
72
- method: "post",
73
- postBody: JSON.stringify(address_data),
74
- onSuccess: function(transport){
75
- console.log(transport);
76
- var response = transport.responseText || "no response text";
77
- alert("Success! \n\n" + response);
78
- },
79
- onFailure: function(){ alert('Something went wrong...') }
80
- });
81
- }*/
 
 
82
  };
83
  cc_search = new clickToAddress(config);
84
 
@@ -115,7 +113,10 @@ document.observe('dom:loaded', function() {
115
  street3_obj : $(item_html_id+"street2"),
116
  street4_obj : $(item_html_id+"street3"),
117
  town_obj : $(item_html_id+"city"),
118
- county_obj : $(item_html_id+"region"),
 
 
 
119
  country_obj : $(item_html_id+"country_id")
120
  }
121
  });
@@ -141,7 +142,10 @@ document.observe('dom:loaded', function() {
141
  street3_obj : $(item_html_id+"street2"),
142
  street4_obj : $(item_html_id+"street3"),
143
  town_obj : $(item_html_id+"city"),
144
- county_obj : $(item_html_id+"region"),
 
 
 
145
  country_obj : $(item_html_id+"country_id")
146
  }
147
  });
@@ -169,7 +173,10 @@ function _cp_check_and_attach() {
169
  street3_obj : $(item_html_id+"street2"),
170
  street4_obj : $(item_html_id+"street3"),
171
  town_obj : $(item_html_id+"city"),
172
- county_obj : $(item_html_id+"region"),
 
 
 
173
  country_obj : $(item_html_id+"country_id")
174
  }
175
  });
@@ -188,7 +195,10 @@ function _cp_check_and_attach() {
188
  street3_obj : $(item_html_id+"street2"),
189
  street4_obj : $(item_html_id+"street3"),
190
  town_obj : $(item_html_id+"city"),
191
- county_obj : $(item_html_id+"region"),
 
 
 
192
  country_obj : $(item_html_id+"country_id")
193
  }
194
  });
@@ -207,10 +217,75 @@ function _cp_check_and_attach() {
207
  street3_obj : $(item_html_id+"street2"),
208
  street4_obj : $(item_html_id+"street3"),
209
  town_obj : $(item_html_id+"city"),
210
- county_obj : $(item_html_id+"region"),
 
 
 
211
  country_obj : $(item_html_id+"country_id")
212
  }
213
  });
214
  }
215
  window.setTimeout(function() { _cp_check_and_attach(); }, 500);
216
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  var li_class = 'wide';
25
 
26
  if (!$(magentoCfg.prefix+'_cc_search_input')) {
27
+ var tmp_html = '<tr><td class="label">'+c2a_config.texts.search_label+'</td><td class="value">'+
28
  '<input id="'+magentoCfg.prefix+'_cc_search_input" class="input-text" type="text"/></td></tr>';
29
  magentoCfg.fields.street1_obj.up('tr').insert( {before: tmp_html} );
30
  }
36
  company: magentoCfg.fields.company_obj,
37
  postcode: magentoCfg.fields.postcode_obj,
38
  county: magentoCfg.fields.county_obj,
39
+ country: magentoCfg.fields.country_obj,
40
  country: magentoCfg.fields.country_obj
41
  });
42
  }
56
  accent: c2a_config.design.accent
57
  },
58
  showLogo: false,
59
+ texts: c2a_config.texts,
60
+ cssPath: false,
61
+ onSetCounty: function(c2a, county, elements){
62
+ var quickChange = function(elem){
63
+ if(typeof elem != 'undefined' && elem !== null){
64
+ elem.simulate('change');
65
+ }
 
 
 
 
 
66
  };
67
+ quickChange(elements.country);
68
+ quickChange(elements.postcode);
69
+ quickChange(elements.line_1);
70
+ quickChange(elements.line_2);
71
+ quickChange(elements.town);
72
+ quickChange(elements.company);
73
+ if(typeof elements.county.list != 'undefined' && elements.county.list !== null){
74
+ c2a.setCounty(elements.county.list, county);
75
+ }
76
+ if(typeof elements.county.input != 'undefined' && elements.county.input !== null){
77
+ c2a.setCounty(elements.county.input, county);
78
+ }
79
+ }
80
  };
81
  cc_search = new clickToAddress(config);
82
 
113
  street3_obj : $(item_html_id+"street2"),
114
  street4_obj : $(item_html_id+"street3"),
115
  town_obj : $(item_html_id+"city"),
116
+ county_obj : {
117
+ input : $(item_html_id+"region"),
118
+ list : $(item_html_id+"region_id")
119
+ },
120
  country_obj : $(item_html_id+"country_id")
121
  }
122
  });
142
  street3_obj : $(item_html_id+"street2"),
143
  street4_obj : $(item_html_id+"street3"),
144
  town_obj : $(item_html_id+"city"),
145
+ county_obj : {
146
+ input : $(item_html_id+"region"),
147
+ list : $(item_html_id+"region_id")
148
+ },
149
  country_obj : $(item_html_id+"country_id")
150
  }
151
  });
173
  street3_obj : $(item_html_id+"street2"),
174
  street4_obj : $(item_html_id+"street3"),
175
  town_obj : $(item_html_id+"city"),
176
+ county_obj : {
177
+ input : $(item_html_id+"region"),
178
+ list : $(item_html_id+"region_id")
179
+ },
180
  country_obj : $(item_html_id+"country_id")
181
  }
182
  });
195
  street3_obj : $(item_html_id+"street2"),
196
  street4_obj : $(item_html_id+"street3"),
197
  town_obj : $(item_html_id+"city"),
198
+ county_obj : {
199
+ input : $(item_html_id+"region"),
200
+ list : $(item_html_id+"region_id")
201
+ },
202
  country_obj : $(item_html_id+"country_id")
203
  }
204
  });
217
  street3_obj : $(item_html_id+"street2"),
218
  street4_obj : $(item_html_id+"street3"),
219
  town_obj : $(item_html_id+"city"),
220
+ county_obj : {
221
+ input : $(item_html_id+"region"),
222
+ list : $(item_html_id+"region_id")
223
+ },
224
  country_obj : $(item_html_id+"country_id")
225
  }
226
  });
227
  }
228
  window.setTimeout(function() { _cp_check_and_attach(); }, 500);
229
  }
230
+
231
+ /*
232
+ * Protolicious
233
+ * Extension to Prototype to add support to simulate JS events
234
+ * https://github.com/kangax/protolicious
235
+ * Protolicious is licensed under the terms of the MIT license
236
+ */
237
+ (function(){
238
+
239
+ var eventMatchers = {
240
+ 'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
241
+ 'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/
242
+ }
243
+ var defaultOptions = {
244
+ pointerX: 0,
245
+ pointerY: 0,
246
+ button: 0,
247
+ ctrlKey: false,
248
+ altKey: false,
249
+ shiftKey: false,
250
+ metaKey: false,
251
+ bubbles: true,
252
+ cancelable: true
253
+ }
254
+
255
+ Event.simulate = function(element, eventName) {
256
+ var options = Object.extend(defaultOptions, arguments[2] || { });
257
+ var oEvent, eventType = null;
258
+
259
+ element = $(element);
260
+
261
+ for (var name in eventMatchers) {
262
+ if (eventMatchers[name].test(eventName)) { eventType = name; break; }
263
+ }
264
+
265
+ if (!eventType)
266
+ throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
267
+
268
+ if (document.createEvent) {
269
+ oEvent = document.createEvent(eventType);
270
+ if (eventType == 'HTMLEvents') {
271
+ oEvent.initEvent(eventName, options.bubbles, options.cancelable);
272
+ }
273
+ else {
274
+ oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
275
+ options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
276
+ options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
277
+ }
278
+ element.dispatchEvent(oEvent);
279
+ }
280
+ else {
281
+ options.clientX = options.pointerX;
282
+ options.clientY = options.pointerY;
283
+ oEvent = Object.extend(document.createEventObject(), options);
284
+ element.fireEvent('on' + eventName, oEvent);
285
+ }
286
+ return element;
287
+ }
288
+
289
+ Element.addMethods({ simulate: Event.simulate });
290
+ })()
291
+ /* End of Protolicious */
js/craftyclicks/c2a/default.js CHANGED
@@ -24,7 +24,7 @@ function cc_magento(magentoCfg){
24
  var li_class = 'wide';
25
 
26
  if (!$(magentoCfg.prefix+'_cc_search_input')) {
27
- var tmp_html = '<li class="'+li_class+'"><label>Address Search</label><div class="input-box"><input id="'+magentoCfg.prefix+'_cc_search_input" type="text"/></div></li>';
28
  magentoCfg.fields.street1_obj.up('li').insert( {before: tmp_html} );
29
  }
30
  cc_search.attach({
@@ -34,7 +34,8 @@ function cc_magento(magentoCfg){
34
  town: magentoCfg.fields.town_obj,
35
  company: magentoCfg.fields.company_obj,
36
  postcode: magentoCfg.fields.postcode_obj,
37
- county: magentoCfg.fields.county_obj
 
38
  });
39
  }
40
 
@@ -53,30 +54,29 @@ document.observe('dom:loaded', function() {
53
  accent: c2a_config.design.accent
54
  },
55
  showLogo: false,
56
- texts: {
57
- default_placeholder: 'Typo here where you wanna go'
58
- },
59
- cssPath: false
60
- /*
61
- onResultSelected: function(address){
62
- console.log(address);
63
- var address_data = {
64
- line_1: address.line_1,
65
- line_2: address.line_2,
66
- town: address.locality,
67
- postal_code: address.postal_code
68
  };
69
- new Ajax.Request(c2a_config.cc_hash_url,{
70
- method: "post",
71
- postBody: JSON.stringify(address_data),
72
- onSuccess: function(transport){
73
- console.log(transport);
74
- var response = transport.responseText || "no response text";
75
- alert("Success! \n\n" + response);
76
- },
77
- onFailure: function(){ alert('Something went wrong...') }
78
- });
79
- }*/
 
 
 
 
80
  };
81
  cc_search = new clickToAddress(config);
82
 
@@ -91,7 +91,10 @@ document.observe('dom:loaded', function() {
91
  street3_obj : $('billing:street3'),
92
  street4_obj : $('billing:street4'),
93
  town_obj : $('billing:city'),
94
- county_obj : $('billing:region'),
 
 
 
95
  country_obj : $('billing:country_id')
96
  }
97
  });
@@ -107,7 +110,10 @@ document.observe('dom:loaded', function() {
107
  street3_obj : $('shipping:street3'),
108
  street4_obj : $('shipping:street4'),
109
  town_obj : $('shipping:city'),
110
- county_obj : $('shipping:region'),
 
 
 
111
  country_obj : $('shipping:country_id')
112
  }
113
  });
@@ -124,9 +130,74 @@ document.observe('dom:loaded', function() {
124
  street3_obj : $('street_3'),
125
  street4_obj : $('street_4'),
126
  town_obj : $('city'),
127
- county_obj : $('region'),
 
 
 
128
  country_obj : $('country')
129
  }
130
  });
131
  }
132
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  var li_class = 'wide';
25
 
26
  if (!$(magentoCfg.prefix+'_cc_search_input')) {
27
+ var tmp_html = '<li class="'+li_class+'"><label>'+c2a_config.texts.search_label+'</label><div class="input-box"><input id="'+magentoCfg.prefix+'_cc_search_input" type="text"/></div></li>';
28
  magentoCfg.fields.street1_obj.up('li').insert( {before: tmp_html} );
29
  }
30
  cc_search.attach({
34
  town: magentoCfg.fields.town_obj,
35
  company: magentoCfg.fields.company_obj,
36
  postcode: magentoCfg.fields.postcode_obj,
37
+ county: magentoCfg.fields.county_obj,
38
+ country: magentoCfg.fields.country_obj
39
  });
40
  }
41
 
54
  accent: c2a_config.design.accent
55
  },
56
  showLogo: false,
57
+ texts: c2a_config.texts,
58
+ cssPath: false,
59
+ onSetCounty: function(c2a, county, elements){
60
+ var quickChange = function(elem){
61
+ if(typeof elem != 'undefined' && elem !== null){
62
+ elem.simulate('change');
63
+ }
 
 
 
 
 
64
  };
65
+ quickChange(elements.country);
66
+ quickChange(elements.postcode);
67
+ quickChange(elements.line_1);
68
+ quickChange(elements.line_2);
69
+ quickChange(elements.town);
70
+ quickChange(elements.company);
71
+ if(typeof elements.county.list != 'undefined' && elements.county.list !== null){
72
+ c2a.setCounty(elements.county.list, county);
73
+ }
74
+ if(typeof elements.county.input != 'undefined' && elements.county.input !== null){
75
+ c2a.setCounty(elements.county.input, county);
76
+ }
77
+ },
78
+ onResultSelected: function(c2a, elements, address){
79
+ }
80
  };
81
  cc_search = new clickToAddress(config);
82
 
91
  street3_obj : $('billing:street3'),
92
  street4_obj : $('billing:street4'),
93
  town_obj : $('billing:city'),
94
+ county_obj : {
95
+ input : $('billing:region'),
96
+ list : $('billing:region_id')
97
+ },
98
  country_obj : $('billing:country_id')
99
  }
100
  });
110
  street3_obj : $('shipping:street3'),
111
  street4_obj : $('shipping:street4'),
112
  town_obj : $('shipping:city'),
113
+ county_obj : {
114
+ input : $('shipping:region'),
115
+ list : $('shipping:region_id')
116
+ },
117
  country_obj : $('shipping:country_id')
118
  }
119
  });
130
  street3_obj : $('street_3'),
131
  street4_obj : $('street_4'),
132
  town_obj : $('city'),
133
+ county_obj : {
134
+ input : $('region'),
135
+ list : $('region_id')
136
+ },
137
  country_obj : $('country')
138
  }
139
  });
140
  }
141
  });
142
+
143
+ /*
144
+ * Protolicious
145
+ * Extension to Prototype to add support to simulate JS events
146
+ * https://github.com/kangax/protolicious
147
+ * Protolicious is licensed under the terms of the MIT license
148
+ */
149
+ (function(){
150
+
151
+ var eventMatchers = {
152
+ 'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
153
+ 'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/
154
+ }
155
+ var defaultOptions = {
156
+ pointerX: 0,
157
+ pointerY: 0,
158
+ button: 0,
159
+ ctrlKey: false,
160
+ altKey: false,
161
+ shiftKey: false,
162
+ metaKey: false,
163
+ bubbles: true,
164
+ cancelable: true
165
+ }
166
+
167
+ Event.simulate = function(element, eventName) {
168
+ var options = Object.extend(defaultOptions, arguments[2] || { });
169
+ var oEvent, eventType = null;
170
+
171
+ element = $(element);
172
+
173
+ for (var name in eventMatchers) {
174
+ if (eventMatchers[name].test(eventName)) { eventType = name; break; }
175
+ }
176
+
177
+ if (!eventType)
178
+ throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
179
+
180
+ if (document.createEvent) {
181
+ oEvent = document.createEvent(eventType);
182
+ if (eventType == 'HTMLEvents') {
183
+ oEvent.initEvent(eventName, options.bubbles, options.cancelable);
184
+ }
185
+ else {
186
+ oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
187
+ options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
188
+ options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
189
+ }
190
+ element.dispatchEvent(oEvent);
191
+ }
192
+ else {
193
+ options.clientX = options.pointerX;
194
+ options.clientY = options.pointerY;
195
+ oEvent = Object.extend(document.createEventObject(), options);
196
+ element.fireEvent('on' + eventName, oEvent);
197
+ }
198
+ return element;
199
+ }
200
+
201
+ Element.addMethods({ simulate: Event.simulate });
202
+ })()
203
+ /* End of Protolicious */
js/craftyclicks/c2a/lib/cc_c2a.min.js CHANGED
@@ -225,9 +225,6 @@ clickToAddress.prototype.setHistoryActions = function() {
225
  var forwardBtn = this.searchObj.getElementsByClassName("forward")[0];
226
  ccEvent(backBtn, "click", function() {
227
  if (backBtn.className == "back") {
228
- for (var i = 0; i < that.cache[that.activeCountry].length; i++) {
229
- console.log(that.cache[that.activeCountry][i].query);
230
- }
231
  that.history(0);
232
  }
233
  });
@@ -411,9 +408,9 @@ clickToAddress.prototype.fillData = function(addressData) {
411
  name: addressData.result.province_name
412
  };
413
  if (typeof this.onSetCounty == "function") {
414
- this.onSetCounty(this, province_set, this.activeDom.county);
415
  } else if (typeof this.activeDom.county != "undefined") {
416
- this.setCounty(province_set);
417
  }
418
  }
419
  if (line_3.length) {
@@ -914,7 +911,7 @@ clickToAddress.prototype.attach = function(dom) {
914
 
915
  case "object":
916
  var quickGet = function(dom, obj_name) {
917
- if (typeof dom[obj_name] == "object" && dom[obj_name] !== "") {
918
  return dom[obj_name];
919
  }
920
  };
@@ -943,6 +940,9 @@ clickToAddress.prototype.attach = function(dom) {
943
  that.moveSelector(e.keyCode == 40);
944
  return;
945
  }
 
 
 
946
  });
947
  ccEvent(target, "keyup", function(e) {
948
  if (that.serviceReady == 0) return;
@@ -952,11 +952,12 @@ clickToAddress.prototype.attach = function(dom) {
952
  that.resetSelector();
953
  return;
954
  }
955
- var noActionKeys = [ 37, 38, 39, 40 ];
956
  if (noActionKeys.indexOf(e.keyCode) != -1) {
957
  return;
958
  }
959
  if (e.keyCode == 13) {
 
960
  if (!that.hasContent || that.selectorPos < 0) {
961
  return;
962
  }
225
  var forwardBtn = this.searchObj.getElementsByClassName("forward")[0];
226
  ccEvent(backBtn, "click", function() {
227
  if (backBtn.className == "back") {
 
 
 
228
  that.history(0);
229
  }
230
  });
408
  name: addressData.result.province_name
409
  };
410
  if (typeof this.onSetCounty == "function") {
411
+ this.onSetCounty(this, province_set, this.activeDom);
412
  } else if (typeof this.activeDom.county != "undefined") {
413
+ this.setCounty(this.activeDom.county, province_set);
414
  }
415
  }
416
  if (line_3.length) {
911
 
912
  case "object":
913
  var quickGet = function(dom, obj_name) {
914
+ if (typeof dom[obj_name] == "object" && dom[obj_name] !== null) {
915
  return dom[obj_name];
916
  }
917
  };
940
  that.moveSelector(e.keyCode == 40);
941
  return;
942
  }
943
+ if (e.keyCode == 13) {
944
+ e.preventDefault();
945
+ }
946
  });
947
  ccEvent(target, "keyup", function(e) {
948
  if (that.serviceReady == 0) return;
952
  that.resetSelector();
953
  return;
954
  }
955
+ var noActionKeys = [ 37, 38, 39, 40, 33, 34, 35, 36, 42, 44, 45, 16, 17, 18, 19, 20 ];
956
  if (noActionKeys.indexOf(e.keyCode) != -1) {
957
  return;
958
  }
959
  if (e.keyCode == 13) {
960
+ e.preventDefault();
961
  if (!that.hasContent || that.selectorPos < 0) {
962
  return;
963
  }
package.xml CHANGED
@@ -1,8 +1,8 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Crafty_Clicks_Clicktoaddress</name>
4
- <version>0.5.0</version>
5
- <stability>beta</stability>
6
  <license uri="https://opensource.org/licenses/MIT">MIT License</license>
7
  <channel>community</channel>
8
  <extends/>
@@ -17,9 +17,9 @@ Faster checkout/registration experience - a boost for conversions&#xD;
17
  More accurate addresses captured - fewer missed deliveries</description>
18
  <notes>- Initial release for our global address endpoint.</notes>
19
  <authors><author><name>Gabor Suranyi</name><user>gabor</user><email>gabor@craftyclicks.co.uk</email></author></authors>
20
- <date>2016-04-06</date>
21
- <time>14:33:18</time>
22
- <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="C2a"><dir name="Block"><file name="Feedback.php" hash="a6cdfefcbf0e1016e86fb7ff539840da"/><file name="Gridlight.php" hash="3eeb13ebf0f5a0529f04a74456e6c6d2"/><file name="Integration.php" hash="fd9a1cfda3dece9a5f73e7780e8421dd"/><file name="Ordergrid.php" hash="dcd9f3fc32b8d18cbe818a58be4d66d7"/></dir><dir name="Helper"><file name="Data.php" hash="cab127b8e36bc60c6d1fd191b2cd2f2c"/></dir><dir name="Model"><file name="Address.php" hash="9e2d6ece83d4aedd9a1218b2023fdfaa"/><file name="Ambient.php" hash="f165ad641db7de86123107394aaee4a3"/><file name="Mode.php" hash="b443068ec106e4a31a0b60247d0a520f"/><dir name="Resource"><dir name="Address"><file name="Collection.php" hash="cc938718dbdb91443faf570a368a8144"/></dir><file name="Address.php" hash="844e3043e575b515d04e49a1f4541784"/></dir></dir><dir name="controllers"><file name="HashController.php" hash="dfd216a607538c94c1566c492c8cf068"/></dir><dir name="data"><dir name="craftyclicks_c2a_setup"><file name="data-upgrade-2.4.9-2.5.0.php" hash="aeca3eaad1229c41333e0cb1412e0a36"/></dir></dir><dir name="etc"><file name="config.xml" hash="33ed35145cd3ae723b41ac61123afc30"/><file name="config.xml~" hash="33ed35145cd3ae723b41ac61123afc30"/><file name="system.xml" hash="d76b1e2072c63b79b35f5ab5f1cd79a3"/><file name="system.xml~" hash="9e693fc1b04974bfb621c4176b899513"/></dir><dir name="sql"><dir name="craftyclicks_c2a_setup"><file name="install-0.5.0.php" hash="d8c8102ac06a84f00329b789ab7ed2c9"/></dir><dir name="craftyclicks_clicktoaddress_setup"><file name="install-1.0.0.php" hash="41a2f1c5692f981071ed5844d6f16cd2"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Craftyclicks_C2a.xml" hash="70ea298e8719f2e36adaf179a7614618"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="d510a05473d878804a4dce701c134396"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="cbec0d4cc4f19c5fd7133d0a02173fe3"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="ba88fdb12be641b7e820721859f50568"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="09c09e6d36cd2a0e9b7c8189be4fc0fd"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="craftyclicks"><dir name="c2a"><dir name="admin"><file name="enhance.js" hash="99cb87e69fc85aaadcd75ebc5dce7ec8"/></dir><file name="admin.js" hash="8257c18af09fec3d2be93d38f25fe9f8"/><file name="default.js" hash="07a2a2f19f3f493f9a8729f34af4efc8"/><dir name="lib"><file name="cc_c2a.min.js" hash="1d220b449af944c72fa153904a13dd6f"/></dir></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="c2a"><file name="cc_c2a.eot" hash="a282a1c5ba3fca326816c2d80171f616"/><file name="cc_c2a.min.css" hash="2e456806af35cb3e7becbff1c99a7577"/><file name="cc_c2a.svg" hash="63a63d1da047bbb9576addb748ac5c60"/><file name="cc_c2a.ttf" hash="60403a32780095f5c016ac4027dce698"/><file name="cc_c2a.woff" hash="ce680790197f576742e57c91209bef78"/><file name="enhance.css" hash="dda54390b1cab47079e073512dd73ba0"/><file name="flags.png" hash="532864aae05c78ed545214c84710fbcc"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="c2a"><file name="cc_c2a.eot" hash="a282a1c5ba3fca326816c2d80171f616"/><file name="cc_c2a.min.css" hash="2e456806af35cb3e7becbff1c99a7577"/><file name="cc_c2a.svg" hash="63a63d1da047bbb9576addb748ac5c60"/><file name="cc_c2a.ttf" hash="60403a32780095f5c016ac4027dce698"/><file name="cc_c2a.woff" hash="ce680790197f576742e57c91209bef78"/><file name="flags.png" hash="532864aae05c78ed545214c84710fbcc"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="app"><dir name="etc"><dir name="modules"><file name="CraftyClicks.xml" hash=""/></dir></dir></dir></target></contents>
23
  <compatible/>
24
  <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
25
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Crafty_Clicks_Clicktoaddress</name>
4
+ <version>0.5.1</version>
5
+ <stability>stable</stability>
6
  <license uri="https://opensource.org/licenses/MIT">MIT License</license>
7
  <channel>community</channel>
8
  <extends/>
17
  More accurate addresses captured - fewer missed deliveries</description>
18
  <notes>- Initial release for our global address endpoint.</notes>
19
  <authors><author><name>Gabor Suranyi</name><user>gabor</user><email>gabor@craftyclicks.co.uk</email></author></authors>
20
+ <date>2016-04-07</date>
21
+ <time>17:02:28</time>
22
+ <contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="C2a"><dir name="Block"><file name="Feedback.php" hash="e4470dcbe52e00586e2ab6c1d7daa62f"/><file name="Gridlight.php" hash="a13aefca2c8e9b47836468fba4935b00"/><file name="Integration.php" hash="9096083cb0649710f289bb920dba715a"/><file name="Ordergrid.php" hash="edc2c351992cf6c54fd953c1e38c56e0"/></dir><dir name="Helper"><file name="Data.php" hash="cab127b8e36bc60c6d1fd191b2cd2f2c"/></dir><dir name="Model"><file name="Address.php" hash="9e2d6ece83d4aedd9a1218b2023fdfaa"/><file name="Ambient.php" hash="f165ad641db7de86123107394aaee4a3"/><file name="Mode.php" hash="777e339aad59783ddea82de1277c3ae8"/><dir name="Resource"><dir name="Address"><file name="Collection.php" hash="3d05eacf7cd64263a2c5b617e5030dbb"/></dir><file name="Address.php" hash="844e3043e575b515d04e49a1f4541784"/></dir></dir><dir name="controllers"><file name="HashController.php" hash="dfd216a607538c94c1566c492c8cf068"/></dir><dir name="data"><dir name="craftyclicks_c2a_setup"><file name="data-upgrade-2.4.9-2.5.0.php" hash="aeca3eaad1229c41333e0cb1412e0a36"/></dir></dir><dir name="etc"><file name="config.xml" hash="daa3c75ae9e5dbf2b11b41ad12c0ccd1"/><file name="system.xml" hash="d76b1e2072c63b79b35f5ab5f1cd79a3"/></dir><dir name="sql"><dir name="craftyclicks_c2a_setup"><file name="install-0.5.0.php" hash="2fd9db9f51d68ef519cdbd21d94cb96d"/></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Craftyclicks_C2a.xml" hash="70ea298e8719f2e36adaf179a7614618"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="f570f7a4b992bb92f5860aa712579f54"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="cd80f0573153dcf0ba4c1ddef813d7c2"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="7b3a73917e8ff880deb419427c259224"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="c74721e81af4ecb27d1fff1c11008264"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="craftyclicks"><dir name="c2a"><dir name="admin"><file name="enhance.js" hash="99cb87e69fc85aaadcd75ebc5dce7ec8"/></dir><file name="admin.js" hash="bf415fe04d90936d3dc4f0064e7d0da9"/><file name="default.js" hash="0b2740531d6a21141c6577a557391562"/><dir name="lib"><file name="cc_c2a.min.js" hash="32bd9ac8e8107831f12d8c5b28eece10"/></dir></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="c2a"><file name="cc_c2a.eot" hash="a282a1c5ba3fca326816c2d80171f616"/><file name="cc_c2a.min.css" hash="2e456806af35cb3e7becbff1c99a7577"/><file name="cc_c2a.svg" hash="63a63d1da047bbb9576addb748ac5c60"/><file name="cc_c2a.ttf" hash="60403a32780095f5c016ac4027dce698"/><file name="cc_c2a.woff" hash="ce680790197f576742e57c91209bef78"/><file name="enhance.css" hash="dda54390b1cab47079e073512dd73ba0"/><file name="flags.png" hash="532864aae05c78ed545214c84710fbcc"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="craftyclicks"><dir name="c2a"><file name="cc_c2a.eot" hash="a282a1c5ba3fca326816c2d80171f616"/><file name="cc_c2a.min.css" hash="2e456806af35cb3e7becbff1c99a7577"/><file name="cc_c2a.svg" hash="63a63d1da047bbb9576addb748ac5c60"/><file name="cc_c2a.ttf" hash="60403a32780095f5c016ac4027dce698"/><file name="cc_c2a.woff" hash="ce680790197f576742e57c91209bef78"/><file name="flags.png" hash="532864aae05c78ed545214c84710fbcc"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
23
  <compatible/>
24
  <dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
25
  </package>