Version Notes
v0.5.11
- New feature: geocoding sets the default country to the user's location
- New feature: lock selected country in search interface to selected country in dropdown
- Improved compatibility with our Postcode Lookup extension
- Excluded search input box from browser auto-fill functionality
v0.5.8
- New feature: Hide Address Lines
Hides address lines until the search is performed.
- Fix: reduced the amount of change triggers for earlier versions of Magento
- New Feature: fallback solution for custom country names (translations)
- Checkout support added: IDEV, MageStore, OneStepCheckout.
v0.5.7b
- Core JS is now loaded from CDN
- Fix: on admin / edit customer pages our code that sets the county / state ran faster than Magento would change the dropdown's content. Now it will await the county / state element to refresh
v0.5.7
- Core JS v1.1.2
- Change: the company input field will stay unmodified if there's no company data available for the selected address.
v0.5.6
- Core JS v1.1.1
- New feature: Lock country to dropdown
- Fix: "no results" and the "generic error" messages weren't passed correctly.
- Fix: added "input-text" class to the "Address Search" element on the front-end.
v0.5.5
- Core JS v1.0.2
- Added Texts option to change the country dropdown's language from English to German.
v0.5.4
- Core JS v0.1.8
- Added Advanced Option to limit selectable countries to match countries set by Magento
v0.5.3
- Core JS v0.1.3.2
- New Feature: Use Address Line #1 instead of a new dropdown
v0.5.2
- Updated core js
- Modified some javascript files to match with altered js functionality
v0.5.0
- Initial release for our global address endpoint.
Release Info
Developer | Gabor Suranyi |
Extension | Crafty_Clicks_Clicktoaddress |
Version | 0.5.11 |
Comparing to | |
See all releases |
Code changes from version 0.5.8 to 0.5.11
- app/code/community/Craftyclicks/C2a/Block/Integration.php +11 -3
- app/code/community/Craftyclicks/C2a/etc/config.xml +2 -1
- app/code/community/Craftyclicks/C2a/etc/system.xml +13 -0
- app/design/adminhtml/default/default/layout/craftyclicks_c2a.xml +8 -8
- app/design/adminhtml/default/default/template/craftyclicks/c2a/c2a_config.phtml +3 -0
- app/design/frontend/base/default/layout/craftyclicks_c2a.xml +12 -12
- app/design/frontend/base/default/template/craftyclicks/c2a/c2a_config.phtml +5 -1
- js/craftyclicks/c2a/admin.js +10 -4
- js/craftyclicks/c2a/advanced.js +297 -0
- js/craftyclicks/c2a/clarion.js +227 -0
- js/craftyclicks/c2a/default.js +4 -3
- package.xml +45 -5
- skin/frontend/base/default/css/craftyclicks/c2a/cc_c2a_frontend.css +14 -0
@@ -13,17 +13,25 @@ class Craftyclicks_C2a_Block_Integration extends Mage_Core_Block_Template
|
|
13 |
);
|
14 |
$head = $this->getLayout()->getBlock('head');
|
15 |
$path = 'craftyclicks/c2a/';
|
|
|
|
|
16 |
if($config->cc_c2a_global){
|
17 |
-
//$head->addItem('skin_css', 'css/'.$path.'cc_c2a_frontend.css');
|
18 |
switch($param){
|
19 |
case 'admin':
|
20 |
-
$
|
21 |
break;
|
22 |
default:
|
23 |
-
$
|
24 |
break;
|
25 |
}
|
26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
return $this;
|
28 |
}
|
29 |
public function addConfig(){
|
13 |
);
|
14 |
$head = $this->getLayout()->getBlock('head');
|
15 |
$path = 'craftyclicks/c2a/';
|
16 |
+
|
17 |
+
$active_file = '';
|
18 |
if($config->cc_c2a_global){
|
|
|
19 |
switch($param){
|
20 |
case 'admin':
|
21 |
+
$active_file = 'admin.js';
|
22 |
break;
|
23 |
default:
|
24 |
+
$active_file = 'default.js';
|
25 |
break;
|
26 |
}
|
27 |
}
|
28 |
+
/* detect checkouts, that don't use unique layout tags */
|
29 |
+
/*if(Mage::getStoreConfig('onestepcheckout/general/enable') == "1"){
|
30 |
+
$active_file = 'advanced.js';
|
31 |
+
}*/
|
32 |
+
|
33 |
+
$head->addItem('js', $path.$active_file);
|
34 |
+
|
35 |
return $this;
|
36 |
}
|
37 |
public function addConfig(){
|
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Craftyclicks_C2a>
|
5 |
-
<version>0.5.
|
6 |
</Craftyclicks_C2a>
|
7 |
</modules>
|
8 |
|
@@ -63,6 +63,7 @@
|
|
63 |
<advanced>
|
64 |
<match_country_list>1</match_country_list>
|
65 |
<lock_country_to_dropdown>0</lock_country_to_dropdown>
|
|
|
66 |
</advanced>
|
67 |
</c2a_global>
|
68 |
</default>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Craftyclicks_C2a>
|
5 |
+
<version>0.5.11</version>
|
6 |
</Craftyclicks_C2a>
|
7 |
</modules>
|
8 |
|
63 |
<advanced>
|
64 |
<match_country_list>1</match_country_list>
|
65 |
<lock_country_to_dropdown>0</lock_country_to_dropdown>
|
66 |
+
<geocoding>1</geocoding>
|
67 |
</advanced>
|
68 |
</c2a_global>
|
69 |
</default>
|
@@ -95,6 +95,7 @@
|
|
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 |
</dropdown_accent>
|
99 |
<hide_address_fields translate="label">
|
100 |
<label>Hide Address Lines</label>
|
@@ -190,6 +191,7 @@
|
|
190 |
<show_in_default>1</show_in_default>
|
191 |
<show_in_website>1</show_in_website>
|
192 |
<show_in_store>1</show_in_store>
|
|
|
193 |
</match_country_list>
|
194 |
<lock_country_to_dropdown translate="label">
|
195 |
<label>Lock selected country to dropdown</label>
|
@@ -199,7 +201,18 @@
|
|
199 |
<show_in_default>1</show_in_default>
|
200 |
<show_in_website>1</show_in_website>
|
201 |
<show_in_store>1</show_in_store>
|
|
|
202 |
</lock_country_to_dropdown>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
</fields>
|
204 |
</advanced>
|
205 |
</groups>
|
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 |
+
<comment>Sets the highlighting colour for the dropdown.</comment>
|
99 |
</dropdown_accent>
|
100 |
<hide_address_fields translate="label">
|
101 |
<label>Hide Address Lines</label>
|
191 |
<show_in_default>1</show_in_default>
|
192 |
<show_in_website>1</show_in_website>
|
193 |
<show_in_store>1</show_in_store>
|
194 |
+
<comment>The country list in the search interface will match Magento's country list.</comment>
|
195 |
</match_country_list>
|
196 |
<lock_country_to_dropdown translate="label">
|
197 |
<label>Lock selected country to dropdown</label>
|
201 |
<show_in_default>1</show_in_default>
|
202 |
<show_in_website>1</show_in_website>
|
203 |
<show_in_store>1</show_in_store>
|
204 |
+
<comment>The selected country in the search interface is locked to the selected country in the dropdown (optional only in frontend, default in admin panel).</comment>
|
205 |
</lock_country_to_dropdown>
|
206 |
+
<geocoding translate="label">
|
207 |
+
<label>Geocoding</label>
|
208 |
+
<frontend_type>select</frontend_type>
|
209 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
210 |
+
<sort_order>30</sort_order>
|
211 |
+
<show_in_default>1</show_in_default>
|
212 |
+
<show_in_website>1</show_in_website>
|
213 |
+
<show_in_store>1</show_in_store>
|
214 |
+
<comment>Set the default country to the user's location. (based on IP address, frontend only)</comment>
|
215 |
+
</geocoding>
|
216 |
</fields>
|
217 |
</advanced>
|
218 |
</groups>
|
@@ -12,53 +12,53 @@
|
|
12 |
<layout>
|
13 |
<adminhtml_sales_order_create_index>
|
14 |
<reference name="head">
|
15 |
-
<block type="c2a/integration" name="
|
16 |
<action method="addJS">
|
17 |
<parameter>admin</parameter>
|
18 |
</action>
|
19 |
</block>
|
20 |
</reference>
|
21 |
<reference name="js">
|
22 |
-
<block type="adminhtml/template" name="
|
23 |
</reference>
|
24 |
</adminhtml_sales_order_create_index>
|
25 |
|
26 |
<adminhtml_customer_edit>
|
27 |
<reference name="head">
|
28 |
-
<block type="c2a/integration" name="
|
29 |
<action method="addJS">
|
30 |
<parameter>admin</parameter>
|
31 |
</action>
|
32 |
</block>
|
33 |
</reference>
|
34 |
<reference name="js">
|
35 |
-
<block type="adminhtml/template" name="
|
36 |
</reference>
|
37 |
</adminhtml_customer_edit>
|
38 |
|
39 |
<adminhtml_customer_new>
|
40 |
<reference name="head">
|
41 |
-
<block type="c2a/integration" name="
|
42 |
<action method="addJS">
|
43 |
<parameter>admin</parameter>
|
44 |
</action>
|
45 |
</block>
|
46 |
</reference>
|
47 |
<reference name="js">
|
48 |
-
<block type="adminhtml/template" name="
|
49 |
</reference>
|
50 |
</adminhtml_customer_new>
|
51 |
|
52 |
<adminhtml_sales_order_address>
|
53 |
<reference name="head">
|
54 |
-
<block type="c2a/integration" name="
|
55 |
<action method="addJS">
|
56 |
<parameter>admin</parameter>
|
57 |
</action>
|
58 |
</block>
|
59 |
</reference>
|
60 |
<reference name="js">
|
61 |
-
<block type="adminhtml/template" name="
|
62 |
</reference>
|
63 |
</adminhtml_sales_order_address>
|
64 |
|
12 |
<layout>
|
13 |
<adminhtml_sales_order_create_index>
|
14 |
<reference name="head">
|
15 |
+
<block type="c2a/integration" name="c2a_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="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
23 |
</reference>
|
24 |
</adminhtml_sales_order_create_index>
|
25 |
|
26 |
<adminhtml_customer_edit>
|
27 |
<reference name="head">
|
28 |
+
<block type="c2a/integration" name="c2a_integration">
|
29 |
<action method="addJS">
|
30 |
<parameter>admin</parameter>
|
31 |
</action>
|
32 |
</block>
|
33 |
</reference>
|
34 |
<reference name="js">
|
35 |
+
<block type="adminhtml/template" name="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
36 |
</reference>
|
37 |
</adminhtml_customer_edit>
|
38 |
|
39 |
<adminhtml_customer_new>
|
40 |
<reference name="head">
|
41 |
+
<block type="c2a/integration" name="c2a_integration">
|
42 |
<action method="addJS">
|
43 |
<parameter>admin</parameter>
|
44 |
</action>
|
45 |
</block>
|
46 |
</reference>
|
47 |
<reference name="js">
|
48 |
+
<block type="adminhtml/template" name="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
49 |
</reference>
|
50 |
</adminhtml_customer_new>
|
51 |
|
52 |
<adminhtml_sales_order_address>
|
53 |
<reference name="head">
|
54 |
+
<block type="c2a/integration" name="c2a_integration">
|
55 |
<action method="addJS">
|
56 |
<parameter>admin</parameter>
|
57 |
</action>
|
58 |
</block>
|
59 |
</reference>
|
60 |
<reference name="js">
|
61 |
+
<block type="adminhtml/template" name="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
62 |
</reference>
|
63 |
</adminhtml_sales_order_address>
|
64 |
|
@@ -37,6 +37,9 @@ if (1 == $conf['active']) {
|
|
37 |
'magento_version' => $version_parts[0].'.'.$version_parts[1]
|
38 |
)
|
39 |
);
|
|
|
|
|
|
|
40 |
$magento_countries = Mage::getModel('directory/country')
|
41 |
->getResourceCollection()
|
42 |
->loadByStore()
|
37 |
'magento_version' => $version_parts[0].'.'.$version_parts[1]
|
38 |
)
|
39 |
);
|
40 |
+
$default_country_code = Mage::getStoreConfig('general/country/default');
|
41 |
+
$default_country = Mage::getModel('directory/country')->loadByCode($default_country_code);
|
42 |
+
$output->default_country = strtolower($default_country->_data['iso3_code']);
|
43 |
$magento_countries = Mage::getModel('directory/country')
|
44 |
->getResourceCollection()
|
45 |
->loadByStore()
|
@@ -13,68 +13,68 @@
|
|
13 |
<!-- standard magento pages -->
|
14 |
<checkout_onepage_index>
|
15 |
<reference name="head">
|
16 |
-
<block type="c2a/integration" name="
|
17 |
<action method="addJS">
|
18 |
<parameter>default</parameter>
|
19 |
</action>
|
20 |
</block>
|
21 |
-
<block type="page/html" name="
|
22 |
</reference>
|
23 |
</checkout_onepage_index>
|
24 |
|
25 |
<checkout_multishipping_customer_address>
|
26 |
<reference name="head">
|
27 |
-
<block type="c2a/integration" name="
|
28 |
<action method="addJS">
|
29 |
<parameter>default</parameter>
|
30 |
</action>
|
31 |
</block>
|
32 |
-
<block type="page/html" name="
|
33 |
</reference>
|
34 |
</checkout_multishipping_customer_address>
|
35 |
|
36 |
<checkout_multishipping_register>
|
37 |
<reference name="head">
|
38 |
-
<block type="c2a/integration" name="
|
39 |
<action method="addJS">
|
40 |
<parameter>default</parameter>
|
41 |
</action>
|
42 |
</block>
|
43 |
-
<block type="page/html" name="
|
44 |
</reference>
|
45 |
</checkout_multishipping_register>
|
46 |
|
47 |
<customer_address_form>
|
48 |
<reference name="head">
|
49 |
-
<block type="c2a/integration" name="
|
50 |
<action method="addJS">
|
51 |
<parameter>default</parameter>
|
52 |
</action>
|
53 |
</block>
|
54 |
-
<block type="page/html" name="
|
55 |
</reference>
|
56 |
</customer_address_form>
|
57 |
|
58 |
<customer_account_create>
|
59 |
<reference name="head">
|
60 |
-
<block type="c2a/integration" name="
|
61 |
<action method="addJS">
|
62 |
<parameter>default</parameter>
|
63 |
</action>
|
64 |
</block>
|
65 |
-
<block type="page/html" name="
|
66 |
</reference>
|
67 |
</customer_account_create>
|
68 |
|
69 |
<!-- IDEV, MageStore, OSC -->
|
70 |
<onestepcheckout_index_index>
|
71 |
<reference name="head">
|
72 |
-
<block type="c2a/integration" name="
|
73 |
<action method="addJS">
|
74 |
<parameter>default</parameter>
|
75 |
</action>
|
76 |
</block>
|
77 |
-
<block type="page/html" name="
|
78 |
</reference>
|
79 |
</onestepcheckout_index_index>
|
80 |
</layout>
|
13 |
<!-- standard magento pages -->
|
14 |
<checkout_onepage_index>
|
15 |
<reference name="head">
|
16 |
+
<block type="c2a/integration" name="c2a_integration">
|
17 |
<action method="addJS">
|
18 |
<parameter>default</parameter>
|
19 |
</action>
|
20 |
</block>
|
21 |
+
<block type="page/html" name="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
22 |
</reference>
|
23 |
</checkout_onepage_index>
|
24 |
|
25 |
<checkout_multishipping_customer_address>
|
26 |
<reference name="head">
|
27 |
+
<block type="c2a/integration" name="c2a_integration">
|
28 |
<action method="addJS">
|
29 |
<parameter>default</parameter>
|
30 |
</action>
|
31 |
</block>
|
32 |
+
<block type="page/html" name="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
33 |
</reference>
|
34 |
</checkout_multishipping_customer_address>
|
35 |
|
36 |
<checkout_multishipping_register>
|
37 |
<reference name="head">
|
38 |
+
<block type="c2a/integration" name="c2a_integration">
|
39 |
<action method="addJS">
|
40 |
<parameter>default</parameter>
|
41 |
</action>
|
42 |
</block>
|
43 |
+
<block type="page/html" name="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
44 |
</reference>
|
45 |
</checkout_multishipping_register>
|
46 |
|
47 |
<customer_address_form>
|
48 |
<reference name="head">
|
49 |
+
<block type="c2a/integration" name="c2a_integration">
|
50 |
<action method="addJS">
|
51 |
<parameter>default</parameter>
|
52 |
</action>
|
53 |
</block>
|
54 |
+
<block type="page/html" name="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
55 |
</reference>
|
56 |
</customer_address_form>
|
57 |
|
58 |
<customer_account_create>
|
59 |
<reference name="head">
|
60 |
+
<block type="c2a/integration" name="c2a_integration">
|
61 |
<action method="addJS">
|
62 |
<parameter>default</parameter>
|
63 |
</action>
|
64 |
</block>
|
65 |
+
<block type="page/html" name="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
66 |
</reference>
|
67 |
</customer_account_create>
|
68 |
|
69 |
<!-- IDEV, MageStore, OSC -->
|
70 |
<onestepcheckout_index_index>
|
71 |
<reference name="head">
|
72 |
+
<block type="c2a/integration" name="c2a_integration">
|
73 |
<action method="addJS">
|
74 |
<parameter>default</parameter>
|
75 |
</action>
|
76 |
</block>
|
77 |
+
<block type="page/html" name="c2a_config" template="craftyclicks/c2a/c2a_config.phtml" />
|
78 |
</reference>
|
79 |
</onestepcheckout_index_index>
|
80 |
</layout>
|
@@ -30,9 +30,13 @@ if (1 == $conf['active']) {
|
|
30 |
'advanced' => (object) array(
|
31 |
'match_countries_to_magento' => $advanced['match_country_list'] == "1",
|
32 |
'lock_country_to_dropdown' => $advanced['lock_country_to_dropdown'] == "1",
|
33 |
-
'cc_hash_url' => Mage::getUrl('c2a/hash/save',array('_secure'=>true))
|
|
|
34 |
)
|
35 |
);
|
|
|
|
|
|
|
36 |
$magento_countries = Mage::getModel('directory/country')
|
37 |
->getResourceCollection()
|
38 |
->loadByStore()
|
30 |
'advanced' => (object) array(
|
31 |
'match_countries_to_magento' => $advanced['match_country_list'] == "1",
|
32 |
'lock_country_to_dropdown' => $advanced['lock_country_to_dropdown'] == "1",
|
33 |
+
'cc_hash_url' => Mage::getUrl('c2a/hash/save',array('_secure'=>true)),
|
34 |
+
'geocoding' => $advanced['geocoding'] == "1"
|
35 |
)
|
36 |
);
|
37 |
+
$default_country_code = Mage::getStoreConfig('general/country/default');
|
38 |
+
$default_country = Mage::getModel('directory/country')->loadByCode($default_country_code);
|
39 |
+
$output->default_country = strtolower($default_country->_data['iso3_code']);
|
40 |
$magento_countries = Mage::getModel('directory/country')
|
41 |
->getResourceCollection()
|
42 |
->loadByStore()
|
@@ -6,7 +6,7 @@
|
|
6 |
//
|
7 |
// Provided by www.CraftyClicks.co.uk
|
8 |
//
|
9 |
-
// Requires the new fancy Crafty Clicks Global JS library - Tested with
|
10 |
//
|
11 |
// If you copy/use/modify this code - please keep this
|
12 |
// comment header in place
|
@@ -25,7 +25,7 @@ function cc_magento(magentoCfg){
|
|
25 |
if (c2a_config.design.search_position == 1){
|
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="
|
29 |
$(magentoCfg.fields.street1_obj).up('tr').insert( {before: tmp_html} );
|
30 |
}
|
31 |
cc_search.attach({
|
@@ -68,9 +68,8 @@ document.observe('dom:loaded', function() {
|
|
68 |
var config = {
|
69 |
accessToken: c2a_config.access_token,
|
70 |
domMode: 'object',
|
71 |
-
geocode: false,
|
72 |
gfxMode: c2a_config.design.mode,
|
73 |
-
defaultCountry:
|
74 |
style: {
|
75 |
ambient: c2a_config.design.ambient,
|
76 |
accent: c2a_config.design.accent
|
@@ -143,6 +142,13 @@ document.observe('dom:loaded', function() {
|
|
143 |
config.countryMatchWith = 'iso_2';
|
144 |
config.enabledCountries = c2a_config.enabled_countries;
|
145 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
if(parseInt(c2a_config.texts.country_language) !== 0){
|
147 |
switch(parseInt(c2a_config.texts.country_language)){
|
148 |
case 1:
|
6 |
//
|
7 |
// Provided by www.CraftyClicks.co.uk
|
8 |
//
|
9 |
+
// Requires the new fancy Crafty Clicks Global JS library - Tested with 1.1.6
|
10 |
//
|
11 |
// If you copy/use/modify this code - please keep this
|
12 |
// comment header in place
|
25 |
if (c2a_config.design.search_position == 1){
|
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="search"/></td></tr>';
|
29 |
$(magentoCfg.fields.street1_obj).up('tr').insert( {before: tmp_html} );
|
30 |
}
|
31 |
cc_search.attach({
|
68 |
var config = {
|
69 |
accessToken: c2a_config.access_token,
|
70 |
domMode: 'object',
|
|
|
71 |
gfxMode: c2a_config.design.mode,
|
72 |
+
defaultCountry: c2a_config.default_country,
|
73 |
style: {
|
74 |
ambient: c2a_config.design.ambient,
|
75 |
accent: c2a_config.design.accent
|
142 |
config.countryMatchWith = 'iso_2';
|
143 |
config.enabledCountries = c2a_config.enabled_countries;
|
144 |
}
|
145 |
+
config.onSearchFocus = function(c2a, dom){
|
146 |
+
var currentCountry = dom.country.options[dom.country.selectedIndex].value;
|
147 |
+
if(currentCountry !== ''){
|
148 |
+
var countryCode = getCountryCode(c2a, currentCountry, 'iso_2');
|
149 |
+
c2a.selectCountry(countryCode);
|
150 |
+
}
|
151 |
+
};
|
152 |
if(parseInt(c2a_config.texts.country_language) !== 0){
|
153 |
switch(parseInt(c2a_config.texts.country_language)){
|
154 |
case 1:
|
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
// This is a collection of JavaScript code to allow easy integration of
|
3 |
+
// the Crafty Clicks Click2Address functionality into Magento
|
4 |
+
//
|
5 |
+
// This file works for the standard magento checkout (both community and enterprise)
|
6 |
+
//
|
7 |
+
// Provided by www.CraftyClicks.co.uk
|
8 |
+
//
|
9 |
+
// Requires the new fancy Crafty Clicks Global JS library - Tested with 1.1.6
|
10 |
+
//
|
11 |
+
// If you copy/use/modify this code - please keep this
|
12 |
+
// comment header in place
|
13 |
+
//
|
14 |
+
// Copyright (c) 2009-2016 Crafty Clicks (http://www.craftyclicks.com)
|
15 |
+
//
|
16 |
+
// This code relies on prototype js, you must have a reasonably recent version loaded
|
17 |
+
// in your template. Magento should include it as standard.
|
18 |
+
//
|
19 |
+
// If you need any help, contact support@craftyclicks.co.uk - we will help!
|
20 |
+
//
|
21 |
+
**********************************************************************************/
|
22 |
+
|
23 |
+
|
24 |
+
var cc_search = null;
|
25 |
+
function cc_magento(magentoCfg){
|
26 |
+
var li_class = 'advanced-col-xs-12 input-field';
|
27 |
+
|
28 |
+
if (c2a_config.design.search_position == 1){
|
29 |
+
if (!$(magentoCfg.prefix+'_cc_search_input')) {
|
30 |
+
var tmp_html = '<div class="'+li_class+'">'
|
31 |
+
+'<label>'+c2a_config.texts.search_label+'</label>'
|
32 |
+
+'<div class="input-box"><input class="input-text" id="'+magentoCfg.prefix+'_cc_search_input" type="search"/></div>'
|
33 |
+
+'</div>';
|
34 |
+
magentoCfg.fields.line_1.up('.advanced-row').up('.input-field').insert( {before: tmp_html} );
|
35 |
+
}
|
36 |
+
cc_search.attach({
|
37 |
+
search: $(magentoCfg.prefix+'_cc_search_input'),
|
38 |
+
line_1: magentoCfg.fields.line_1,
|
39 |
+
line_2: magentoCfg.fields.line_2,
|
40 |
+
town: magentoCfg.fields.town,
|
41 |
+
company: magentoCfg.fields.company,
|
42 |
+
postcode: magentoCfg.fields.postcode,
|
43 |
+
county: magentoCfg.fields.county,
|
44 |
+
country: magentoCfg.fields.country
|
45 |
+
});
|
46 |
+
cc_hide_fields(magentoCfg.fields);
|
47 |
+
} else {
|
48 |
+
cc_search.attach({
|
49 |
+
search: magentoCfg.fields.line_1,
|
50 |
+
line_1: magentoCfg.fields.line_1,
|
51 |
+
line_2: magentoCfg.fields.line_2,
|
52 |
+
town: magentoCfg.fields.town,
|
53 |
+
company: magentoCfg.fields.company,
|
54 |
+
postcode: magentoCfg.fields.postcode,
|
55 |
+
county: magentoCfg.fields.county,
|
56 |
+
country: magentoCfg.fields.country
|
57 |
+
});
|
58 |
+
cc_hide_fields(magentoCfg.fields);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
function cc_hide_fields(dom, show){
|
63 |
+
var show = show || false;
|
64 |
+
if(!c2a_config.design.hide_address_fields){
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
var elementsToHide = ['line_1', 'line_2', 'town', 'postcode', 'county'];
|
68 |
+
if(!c2a_config.advanced.lock_country_to_dropdown){
|
69 |
+
elementsToHide.push('country');
|
70 |
+
}
|
71 |
+
var getParent = function(element){
|
72 |
+
while(!element.up().hasClassName('advanced-form-style')){
|
73 |
+
element = element.up();
|
74 |
+
}
|
75 |
+
return element;
|
76 |
+
};
|
77 |
+
|
78 |
+
if(!show){
|
79 |
+
// check if there's anything in the input boxes
|
80 |
+
var allEmpty = true;
|
81 |
+
for(var i=0; i<elementsToHide.length - 2; i++){
|
82 |
+
if(dom[elementsToHide[i]].value !== ''){
|
83 |
+
allEmpty = false;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
if(!allEmpty){
|
87 |
+
return;
|
88 |
+
}
|
89 |
+
|
90 |
+
for(var i=0; i<elementsToHide.length; i++){
|
91 |
+
if(elementsToHide[i] == 'county'){
|
92 |
+
getParent(dom[elementsToHide[i]].input).hide();
|
93 |
+
getParent(dom[elementsToHide[i]].list).hide();
|
94 |
+
} else {
|
95 |
+
getParent(dom[elementsToHide[i]]).hide();
|
96 |
+
}
|
97 |
+
}
|
98 |
+
} else {
|
99 |
+
for(var i=0; i<elementsToHide.length; i++){
|
100 |
+
if(elementsToHide[i] == 'county'){
|
101 |
+
getParent(dom[elementsToHide[i]].input).show();
|
102 |
+
getParent(dom[elementsToHide[i]].list).show();
|
103 |
+
} else {
|
104 |
+
getParent(dom[elementsToHide[i]]).show();
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
document.observe('dom:loaded', function() {
|
112 |
+
if (typeof c2a_config == 'undefined' || !c2a_config.active) return;
|
113 |
+
|
114 |
+
var config = {
|
115 |
+
accessToken: c2a_config.access_token,
|
116 |
+
domMode: 'object',
|
117 |
+
gfxMode: c2a_config.design.mode,
|
118 |
+
style: {
|
119 |
+
ambient: c2a_config.design.ambient,
|
120 |
+
accent: c2a_config.design.accent
|
121 |
+
},
|
122 |
+
showLogo: false,
|
123 |
+
texts: c2a_config.texts,
|
124 |
+
getIpLocation: c2a_config.advanced.geocoding,
|
125 |
+
onSetCounty: function(c2a, elements, county){
|
126 |
+
var quickChange = function(elem){
|
127 |
+
if(typeof elem != 'undefined' && elem !== null){
|
128 |
+
elem.simulate('change');
|
129 |
+
}
|
130 |
+
};
|
131 |
+
quickChange(elements.country);
|
132 |
+
quickChange(elements.postcode);
|
133 |
+
quickChange(elements.line_1);
|
134 |
+
quickChange(elements.line_2);
|
135 |
+
quickChange(elements.town);
|
136 |
+
quickChange(elements.company);
|
137 |
+
if(typeof elements.county.list != 'undefined' && elements.county.list !== null){
|
138 |
+
c2a.setCounty(elements.county.list, county);
|
139 |
+
}
|
140 |
+
if(typeof elements.county.input != 'undefined' && elements.county.input !== null){
|
141 |
+
c2a.setCounty(elements.county.input, county);
|
142 |
+
}
|
143 |
+
},
|
144 |
+
onResultSelected: function(c2a, elements, results){
|
145 |
+
cc_hide_fields(elements, true);
|
146 |
+
// if can't find country, enforce country dropdown to match by iso_2
|
147 |
+
if(typeof elements.country.down('option:selected') == 'undefined' || elements.country.down('option:selected').value == ''){
|
148 |
+
elements.country.value = results.country.iso_3166_1_alpha_2;
|
149 |
+
}
|
150 |
+
},
|
151 |
+
tag: 'Magento 1'
|
152 |
+
};
|
153 |
+
if(parseInt(c2a_config.texts.country_language) !== 0){
|
154 |
+
switch(parseInt(c2a_config.texts.country_language)){
|
155 |
+
case 1:
|
156 |
+
config.countryLanguage = 'de';
|
157 |
+
break;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
if(c2a_config.advanced.match_countries_to_magento){
|
161 |
+
config.countryMatchWith = 'iso_2';
|
162 |
+
config.enabledCountries = c2a_config.enabled_countries;
|
163 |
+
}
|
164 |
+
config.defaultCountry = c2a_config.default_country;
|
165 |
+
if(c2a_config.advanced.lock_country_to_dropdown){
|
166 |
+
config.countrySelector = false;
|
167 |
+
config.onSearchFocus = function(c2a, dom){
|
168 |
+
var currentCountry = dom.country.options[dom.country.selectedIndex].value;
|
169 |
+
if(currentCountry !== ''){
|
170 |
+
var countryCode = getCountryCode(c2a, currentCountry, 'iso_2');
|
171 |
+
c2a.selectCountry(countryCode);
|
172 |
+
}
|
173 |
+
};
|
174 |
+
}
|
175 |
+
|
176 |
+
cc_search = new clickToAddress(config);
|
177 |
+
|
178 |
+
if ($('billing:postcode')) {
|
179 |
+
cc_magento({
|
180 |
+
prefix: 'billing',
|
181 |
+
fields: {
|
182 |
+
postcode: $('billing:postcode'),
|
183 |
+
company : $('billing:company'),
|
184 |
+
line_1 : $('billing:street1'),
|
185 |
+
line_2 : $('billing:street2'),
|
186 |
+
line_3 : $('billing:street3'),
|
187 |
+
line_4 : $('billing:street4'),
|
188 |
+
town : $('billing:city'),
|
189 |
+
county : {
|
190 |
+
input : $('billing:region'),
|
191 |
+
list : $('billing:region_id')
|
192 |
+
},
|
193 |
+
country : $('billing:country_id')
|
194 |
+
}
|
195 |
+
});
|
196 |
+
}
|
197 |
+
if ($('shipping:postcode')) {
|
198 |
+
cc_magento({
|
199 |
+
prefix : 'shipping',
|
200 |
+
fields : {
|
201 |
+
postcode : $('shipping:postcode'),
|
202 |
+
company : $('shipping:company'),
|
203 |
+
line_1 : $('shipping:street1'),
|
204 |
+
line_2 : $('shipping:street2'),
|
205 |
+
line_3 : $('shipping:street3'),
|
206 |
+
line_4 : $('shipping:street4'),
|
207 |
+
town : $('shipping:city'),
|
208 |
+
county : {
|
209 |
+
input : $('shipping:region'),
|
210 |
+
list : $('shipping:region_id')
|
211 |
+
},
|
212 |
+
country : $('shipping:country_id')
|
213 |
+
}
|
214 |
+
});
|
215 |
+
}
|
216 |
+
|
217 |
+
if ($('zip')) {
|
218 |
+
cc_magento({
|
219 |
+
prefix : '',
|
220 |
+
fields : {
|
221 |
+
postcode : $('zip'),
|
222 |
+
company : $('company'),
|
223 |
+
line_1 : $('street_1'),
|
224 |
+
line_2 : $('street_2'),
|
225 |
+
line_3 : $('street_3'),
|
226 |
+
line_4 : $('street_4'),
|
227 |
+
town : $('city'),
|
228 |
+
county : {
|
229 |
+
input : $('region'),
|
230 |
+
list : $('region_id')
|
231 |
+
},
|
232 |
+
country : $('country')
|
233 |
+
}
|
234 |
+
});
|
235 |
+
}
|
236 |
+
});
|
237 |
+
/*
|
238 |
+
* Protolicious
|
239 |
+
* Extension to Prototype to add support to simulate JS events
|
240 |
+
* https://github.com/kangax/protolicious
|
241 |
+
* Protolicious is licensed under the terms of the MIT license
|
242 |
+
*/
|
243 |
+
(function(){
|
244 |
+
|
245 |
+
var eventMatchers = {
|
246 |
+
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
|
247 |
+
'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/
|
248 |
+
};
|
249 |
+
var defaultOptions = {
|
250 |
+
pointerX: 0,
|
251 |
+
pointerY: 0,
|
252 |
+
button: 0,
|
253 |
+
ctrlKey: false,
|
254 |
+
altKey: false,
|
255 |
+
shiftKey: false,
|
256 |
+
metaKey: false,
|
257 |
+
bubbles: true,
|
258 |
+
cancelable: true
|
259 |
+
};
|
260 |
+
|
261 |
+
Event.simulate = function(element, eventName) {
|
262 |
+
var options = Object.extend(defaultOptions, arguments[2] || { });
|
263 |
+
var oEvent, eventType = null;
|
264 |
+
|
265 |
+
element = $(element);
|
266 |
+
|
267 |
+
for (var name in eventMatchers) {
|
268 |
+
if (eventMatchers[name].test(eventName)) { eventType = name; break; }
|
269 |
+
}
|
270 |
+
|
271 |
+
if (!eventType)
|
272 |
+
throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
|
273 |
+
|
274 |
+
if (document.createEvent) {
|
275 |
+
oEvent = document.createEvent(eventType);
|
276 |
+
if (eventType == 'HTMLEvents') {
|
277 |
+
oEvent.initEvent(eventName, options.bubbles, options.cancelable);
|
278 |
+
}
|
279 |
+
else {
|
280 |
+
oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
|
281 |
+
options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
|
282 |
+
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
|
283 |
+
}
|
284 |
+
element.dispatchEvent(oEvent);
|
285 |
+
}
|
286 |
+
else {
|
287 |
+
options.clientX = options.pointerX;
|
288 |
+
options.clientY = options.pointerY;
|
289 |
+
oEvent = Object.extend(document.createEventObject(), options);
|
290 |
+
element.fireEvent('on' + eventName, oEvent);
|
291 |
+
}
|
292 |
+
return element;
|
293 |
+
};
|
294 |
+
|
295 |
+
Element.addMethods({ simulate: Event.simulate });
|
296 |
+
})();
|
297 |
+
/* End of Protolicious */
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
// This is a collection of JavaScript code to allow easy integration of
|
3 |
+
// the Crafty Clicks Click2Address functionality into Magento
|
4 |
+
//
|
5 |
+
// This file works for the standard magento checkout (both community and enterprise)
|
6 |
+
//
|
7 |
+
// Provided by www.CraftyClicks.co.uk
|
8 |
+
//
|
9 |
+
// Requires the new fancy Crafty Clicks Global JS library - Tested with 0.1
|
10 |
+
//
|
11 |
+
// If you copy/use/modify this code - please keep this
|
12 |
+
// comment header in place
|
13 |
+
//
|
14 |
+
// Copyright (c) 2009-2016 Crafty Clicks (http://www.craftyclicks.com)
|
15 |
+
//
|
16 |
+
// This code relies on prototype js, you must have a reasonably recent version loaded
|
17 |
+
// in your template. Magento should include it as standard.
|
18 |
+
//
|
19 |
+
// If you need any help, contact support@craftyclicks.co.uk - we will help!
|
20 |
+
//
|
21 |
+
**********************************************************************************/
|
22 |
+
var cc_search = null;
|
23 |
+
function cc_magento(magentoCfg){
|
24 |
+
var li_class = 'full';
|
25 |
+
|
26 |
+
if (c2a_config.design.search_position == 1){
|
27 |
+
if (!$(magentoCfg.prefix+'_cc_search_input')) {
|
28 |
+
var tmp_html = '<div class="'+li_class+'"><label>'+c2a_config.texts.search_label+'</label><div class="input-box"><input id="'+magentoCfg.prefix+'_cc_search_input" class="t1 input-text" type="search"/></div></div>';
|
29 |
+
magentoCfg.fields.street1_obj.up('div .full').insert( {before: tmp_html} );
|
30 |
+
}
|
31 |
+
cc_search.attach({
|
32 |
+
search: $(magentoCfg.prefix+'_cc_search_input'),
|
33 |
+
line_1: magentoCfg.fields.street1_obj,
|
34 |
+
line_2: magentoCfg.fields.street2_obj,
|
35 |
+
town: magentoCfg.fields.town_obj,
|
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 |
+
} else {
|
42 |
+
cc_search.attach({
|
43 |
+
search: magentoCfg.fields.street1_obj,
|
44 |
+
line_1: magentoCfg.fields.street1_obj,
|
45 |
+
line_2: magentoCfg.fields.street2_obj,
|
46 |
+
town: magentoCfg.fields.town_obj,
|
47 |
+
company: magentoCfg.fields.company_obj,
|
48 |
+
postcode: magentoCfg.fields.postcode_obj,
|
49 |
+
county: magentoCfg.fields.county_obj,
|
50 |
+
country: magentoCfg.fields.country_obj
|
51 |
+
});
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
|
56 |
+
document.observe('dom:loaded', function() {
|
57 |
+
if (typeof c2a_config == 'undefined' || !c2a_config.active) return;
|
58 |
+
|
59 |
+
var config = {
|
60 |
+
accessToken: c2a_config.access_token,
|
61 |
+
domMode: 'object',
|
62 |
+
geocode: false,
|
63 |
+
gfxMode: c2a_config.design.mode,
|
64 |
+
style: {
|
65 |
+
ambient: c2a_config.design.ambient,
|
66 |
+
accent: c2a_config.design.accent
|
67 |
+
},
|
68 |
+
showLogo: false,
|
69 |
+
texts: c2a_config.texts,
|
70 |
+
cssPath: false,
|
71 |
+
getIpLocation: c2a_config.advanced.geocoding,
|
72 |
+
onSetCounty: function(c2a, elements, county){
|
73 |
+
var quickChange = function(elem){
|
74 |
+
if(typeof elem != 'undefined' && elem !== null){
|
75 |
+
elem.simulate('change');
|
76 |
+
}
|
77 |
+
};
|
78 |
+
quickChange(elements.country);
|
79 |
+
quickChange(elements.postcode);
|
80 |
+
quickChange(elements.line_1);
|
81 |
+
quickChange(elements.line_2);
|
82 |
+
quickChange(elements.town);
|
83 |
+
quickChange(elements.company);
|
84 |
+
if(typeof elements.county.list != 'undefined' && elements.county.list !== null){
|
85 |
+
setTimeout(function(){c2a.setCounty(elements.county.list, county);},300);
|
86 |
+
}
|
87 |
+
if(typeof elements.county.input != 'undefined' && elements.county.input !== null){
|
88 |
+
setTimeout(function(){c2a.setCounty(elements.county.input, county);},300);
|
89 |
+
}
|
90 |
+
},
|
91 |
+
tag: 'Magento 1'
|
92 |
+
};
|
93 |
+
if(parseInt(c2a_config.texts.country_language) !== 0){
|
94 |
+
switch(parseInt(c2a_config.texts.country_language)){
|
95 |
+
case 1:
|
96 |
+
config.countryLanguage = 'de';
|
97 |
+
break;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
if(parseInt(c2a_config.advanced.match_countries_to_magento) == 1){
|
101 |
+
config.countryMatchWith = 'iso_2';
|
102 |
+
config.enabledCountries = c2a_config.enabled_countries;
|
103 |
+
}
|
104 |
+
config.defaultCountry = c2a_config.default_country;
|
105 |
+
cc_search = new clickToAddress(config);
|
106 |
+
|
107 |
+
if ($('billing:postcode')) {
|
108 |
+
cc_magento({
|
109 |
+
prefix: 'billing',
|
110 |
+
fields: {
|
111 |
+
postcode_obj: $('billing:postcode'),
|
112 |
+
company_obj : $('billing:company'),
|
113 |
+
street1_obj : $('billing:street1'),
|
114 |
+
street2_obj : $('billing:street2'),
|
115 |
+
street3_obj : $('billing:street3'),
|
116 |
+
street4_obj : $('billing:street4'),
|
117 |
+
town_obj : $('billing:city'),
|
118 |
+
county_obj : {
|
119 |
+
input : $('billing:region'),
|
120 |
+
list : $('billing:region_id')
|
121 |
+
},
|
122 |
+
country_obj : $('billing:country_id')
|
123 |
+
}
|
124 |
+
});
|
125 |
+
}
|
126 |
+
if ($('shipping:postcode')) {
|
127 |
+
cc_magento({
|
128 |
+
prefix : 'shipping',
|
129 |
+
fields : {
|
130 |
+
postcode_obj : $('shipping:postcode'),
|
131 |
+
company_obj : $('shipping:company'),
|
132 |
+
street1_obj : $('shipping:street1'),
|
133 |
+
street2_obj : $('shipping:street2'),
|
134 |
+
street3_obj : $('shipping:street3'),
|
135 |
+
street4_obj : $('shipping:street4'),
|
136 |
+
town_obj : $('shipping:city'),
|
137 |
+
county_obj : {
|
138 |
+
input : $('shipping:region'),
|
139 |
+
list : $('shipping:region_id')
|
140 |
+
},
|
141 |
+
country_obj : $('shipping:country_id')
|
142 |
+
}
|
143 |
+
});
|
144 |
+
}
|
145 |
+
|
146 |
+
if ($('zip')) {
|
147 |
+
cc_magento({
|
148 |
+
prefix : '',
|
149 |
+
fields : {
|
150 |
+
postcode_obj : $('zip'),
|
151 |
+
company_obj : $('company'),
|
152 |
+
street1_obj : $('street_1'),
|
153 |
+
street2_obj : $('street_2'),
|
154 |
+
street3_obj : $('street_3'),
|
155 |
+
street4_obj : $('street_4'),
|
156 |
+
town_obj : $('city'),
|
157 |
+
county_obj : {
|
158 |
+
input : $('region'),
|
159 |
+
list : $('region_id')
|
160 |
+
},
|
161 |
+
country_obj : $('country')
|
162 |
+
}
|
163 |
+
});
|
164 |
+
}
|
165 |
+
});
|
166 |
+
|
167 |
+
/*
|
168 |
+
* Protolicious
|
169 |
+
* Extension to Prototype to add support to simulate JS events
|
170 |
+
* https://github.com/kangax/protolicious
|
171 |
+
* Protolicious is licensed under the terms of the MIT license
|
172 |
+
*/
|
173 |
+
(function(){
|
174 |
+
|
175 |
+
var eventMatchers = {
|
176 |
+
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
|
177 |
+
'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/
|
178 |
+
}
|
179 |
+
var defaultOptions = {
|
180 |
+
pointerX: 0,
|
181 |
+
pointerY: 0,
|
182 |
+
button: 0,
|
183 |
+
ctrlKey: false,
|
184 |
+
altKey: false,
|
185 |
+
shiftKey: false,
|
186 |
+
metaKey: false,
|
187 |
+
bubbles: true,
|
188 |
+
cancelable: true
|
189 |
+
}
|
190 |
+
|
191 |
+
Event.simulate = function(element, eventName) {
|
192 |
+
var options = Object.extend(defaultOptions, arguments[2] || { });
|
193 |
+
var oEvent, eventType = null;
|
194 |
+
|
195 |
+
element = $(element);
|
196 |
+
|
197 |
+
for (var name in eventMatchers) {
|
198 |
+
if (eventMatchers[name].test(eventName)) { eventType = name; break; }
|
199 |
+
}
|
200 |
+
|
201 |
+
if (!eventType)
|
202 |
+
throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
|
203 |
+
|
204 |
+
if (document.createEvent) {
|
205 |
+
oEvent = document.createEvent(eventType);
|
206 |
+
if (eventType == 'HTMLEvents') {
|
207 |
+
oEvent.initEvent(eventName, options.bubbles, options.cancelable);
|
208 |
+
}
|
209 |
+
else {
|
210 |
+
oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
|
211 |
+
options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
|
212 |
+
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
|
213 |
+
}
|
214 |
+
element.dispatchEvent(oEvent);
|
215 |
+
}
|
216 |
+
else {
|
217 |
+
options.clientX = options.pointerX;
|
218 |
+
options.clientY = options.pointerY;
|
219 |
+
oEvent = Object.extend(document.createEventObject(), options);
|
220 |
+
element.fireEvent('on' + eventName, oEvent);
|
221 |
+
}
|
222 |
+
return element;
|
223 |
+
}
|
224 |
+
|
225 |
+
Element.addMethods({ simulate: Event.simulate });
|
226 |
+
})()
|
227 |
+
/* End of Protolicious */
|
@@ -6,7 +6,7 @@
|
|
6 |
//
|
7 |
// Provided by www.CraftyClicks.co.uk
|
8 |
//
|
9 |
-
// Requires the new fancy Crafty Clicks Global JS library - Tested with
|
10 |
//
|
11 |
// If you copy/use/modify this code - please keep this
|
12 |
// comment header in place
|
@@ -25,7 +25,7 @@ function cc_magento(magentoCfg){
|
|
25 |
|
26 |
if (c2a_config.design.search_position == 1){
|
27 |
if (!$(magentoCfg.prefix+'_cc_search_input')) {
|
28 |
-
var tmp_html = '<li class="'+li_class+'"><label>'+c2a_config.texts.search_label+'</label><div class="input-box"><input class="input-text" id="'+magentoCfg.prefix+'_cc_search_input" type="
|
29 |
magentoCfg.fields.line_1.up('li').insert( {before: tmp_html} );
|
30 |
}
|
31 |
cc_search.attach({
|
@@ -111,12 +111,12 @@ document.observe('dom:loaded', function() {
|
|
111 |
var config = {
|
112 |
accessToken: c2a_config.access_token,
|
113 |
domMode: 'object',
|
114 |
-
geocode: false,
|
115 |
gfxMode: c2a_config.design.mode,
|
116 |
style: {
|
117 |
ambient: c2a_config.design.ambient,
|
118 |
accent: c2a_config.design.accent
|
119 |
},
|
|
|
120 |
showLogo: false,
|
121 |
texts: c2a_config.texts,
|
122 |
onSetCounty: function(c2a, elements, county){
|
@@ -158,6 +158,7 @@ document.observe('dom:loaded', function() {
|
|
158 |
config.countryMatchWith = 'iso_2';
|
159 |
config.enabledCountries = c2a_config.enabled_countries;
|
160 |
}
|
|
|
161 |
if(c2a_config.advanced.lock_country_to_dropdown){
|
162 |
config.countrySelector = false;
|
163 |
config.onSearchFocus = function(c2a, dom){
|
6 |
//
|
7 |
// Provided by www.CraftyClicks.co.uk
|
8 |
//
|
9 |
+
// Requires the new fancy Crafty Clicks Global JS library - Tested with 1.1.6
|
10 |
//
|
11 |
// If you copy/use/modify this code - please keep this
|
12 |
// comment header in place
|
25 |
|
26 |
if (c2a_config.design.search_position == 1){
|
27 |
if (!$(magentoCfg.prefix+'_cc_search_input')) {
|
28 |
+
var tmp_html = '<li class="'+li_class+'"><label>'+c2a_config.texts.search_label+'</label><div class="input-box"><input class="input-text" id="'+magentoCfg.prefix+'_cc_search_input" type="search"/></div></li>';
|
29 |
magentoCfg.fields.line_1.up('li').insert( {before: tmp_html} );
|
30 |
}
|
31 |
cc_search.attach({
|
111 |
var config = {
|
112 |
accessToken: c2a_config.access_token,
|
113 |
domMode: 'object',
|
|
|
114 |
gfxMode: c2a_config.design.mode,
|
115 |
style: {
|
116 |
ambient: c2a_config.design.ambient,
|
117 |
accent: c2a_config.design.accent
|
118 |
},
|
119 |
+
getIpLocation: c2a_config.advanced.geocoding,
|
120 |
showLogo: false,
|
121 |
texts: c2a_config.texts,
|
122 |
onSetCounty: function(c2a, elements, county){
|
158 |
config.countryMatchWith = 'iso_2';
|
159 |
config.enabledCountries = c2a_config.enabled_countries;
|
160 |
}
|
161 |
+
config.defaultCountry = c2a_config.default_country;
|
162 |
if(c2a_config.advanced.lock_country_to_dropdown){
|
163 |
config.countrySelector = false;
|
164 |
config.onSearchFocus = function(c2a, dom){
|
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Crafty_Clicks_Clicktoaddress</name>
|
4 |
-
<version>0.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://opensource.org/licenses/MIT">MIT License</license>
|
7 |
<channel>community</channel>
|
@@ -15,49 +15,89 @@ Benefits
|
|
15 |

|
16 |
Faster checkout/registration experience - a boost for conversions
|
17 |
More accurate addresses captured - fewer missed deliveries</description>
|
18 |
-
<notes>v0.5.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
- New feature: Hide Address Lines
|
|
|
20 |
Hides address lines until the search is performed.
|
|
|
21 |
- Fix: reduced the amount of change triggers for earlier versions of Magento
|
|
|
22 |
- New Feature: fallback solution for custom country names (translations)
|
|
|
23 |
- Checkout support added: IDEV, MageStore, OneStepCheckout.
|
24 |

|
|
|
25 |
v0.5.7b
|
|
|
26 |
- Core JS is now loaded from CDN
|
|
|
27 |
- Fix: on admin / edit customer pages our code that sets the county / state ran faster than Magento would change the dropdown's content. Now it will await the county / state element to refresh
|
28 |

|
|
|
29 |
v0.5.7
|
|
|
30 |
- Core JS v1.1.2
|
|
|
31 |
- Change: the company input field will stay unmodified if there's no company data available for the selected address.
|
32 |

|
|
|
33 |
v0.5.6
|
|
|
34 |
- Core JS v1.1.1
|
|
|
35 |
- New feature: Lock country to dropdown
|
|
|
36 |
- Fix: "no results" and the "generic error" messages weren't passed correctly.
|
|
|
37 |
- Fix: added "input-text" class to the "Address Search" element on the front-end.
|
38 |

|
|
|
39 |
v0.5.5
|
|
|
40 |
- Core JS v1.0.2
|
|
|
41 |
- Added Texts option to change the country dropdown's language from English to German.
|
42 |

|
|
|
43 |
v0.5.4
|
|
|
44 |
- Core JS v0.1.8
|
|
|
45 |
- Added Advanced Option to limit selectable countries to match countries set by Magento
|
46 |

|
47 |
v0.5.3
|
|
|
48 |
- Core JS v0.1.3.2
|
|
|
49 |
- New Feature: Use Address Line #1 instead of a new dropdown
|
50 |

|
|
|
51 |
v0.5.2
|
|
|
52 |
- Updated core js
|
|
|
53 |
- Modified some javascript files to match with altered js functionality
|
54 |

|
|
|
55 |
v0.5.0
|
|
|
56 |
- Initial release for our global address endpoint.</notes>
|
57 |
<authors><author><name>Gabor Suranyi</name><user>gabor</user><email>gabor@craftyclicks.co.uk</email></author></authors>
|
58 |
-
<date>2016-
|
59 |
-
<time>
|
60 |
-
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="C2a"><dir name="Block"><dir name="Adminhtml"><file name="Version.php" hash="8c0e2fbb25e5a54214fb7a017f579dd8"/></dir><file name="Feedback.php" hash="e4470dcbe52e00586e2ab6c1d7daa62f"/><file name="Gridlight.php" hash="a13aefca2c8e9b47836468fba4935b00"/><file name="Integration.php" hash="
|
61 |
<compatible/>
|
62 |
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
|
63 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Crafty_Clicks_Clicktoaddress</name>
|
4 |
+
<version>0.5.11</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://opensource.org/licenses/MIT">MIT License</license>
|
7 |
<channel>community</channel>
|
15 |

|
16 |
Faster checkout/registration experience - a boost for conversions
|
17 |
More accurate addresses captured - fewer missed deliveries</description>
|
18 |
+
<notes>v0.5.11
|
19 |
+

|
20 |
+
- New feature: geocoding sets the default country to the user's location
|
21 |
+

|
22 |
+
- New feature: lock selected country in search interface to selected country in dropdown
|
23 |
+

|
24 |
+
- Improved compatibility with our Postcode Lookup extension
|
25 |
+

|
26 |
+
- Excluded search input box from browser auto-fill functionality
|
27 |
+

|
28 |
+

|
29 |
+
v0.5.8
|
30 |
+

|
31 |
- New feature: Hide Address Lines
|
32 |
+

|
33 |
Hides address lines until the search is performed.
|
34 |
+

|
35 |
- Fix: reduced the amount of change triggers for earlier versions of Magento
|
36 |
+

|
37 |
- New Feature: fallback solution for custom country names (translations)
|
38 |
+

|
39 |
- Checkout support added: IDEV, MageStore, OneStepCheckout.
|
40 |

|
41 |
+

|
42 |
v0.5.7b
|
43 |
+

|
44 |
- Core JS is now loaded from CDN
|
45 |
+

|
46 |
- Fix: on admin / edit customer pages our code that sets the county / state ran faster than Magento would change the dropdown's content. Now it will await the county / state element to refresh
|
47 |

|
48 |
+

|
49 |
v0.5.7
|
50 |
+

|
51 |
- Core JS v1.1.2
|
52 |
+

|
53 |
- Change: the company input field will stay unmodified if there's no company data available for the selected address.
|
54 |

|
55 |
+

|
56 |
v0.5.6
|
57 |
+

|
58 |
- Core JS v1.1.1
|
59 |
+

|
60 |
- New feature: Lock country to dropdown
|
61 |
+

|
62 |
- Fix: "no results" and the "generic error" messages weren't passed correctly.
|
63 |
+

|
64 |
- Fix: added "input-text" class to the "Address Search" element on the front-end.
|
65 |

|
66 |
+

|
67 |
v0.5.5
|
68 |
+

|
69 |
- Core JS v1.0.2
|
70 |
+

|
71 |
- Added Texts option to change the country dropdown's language from English to German.
|
72 |

|
73 |
+

|
74 |
v0.5.4
|
75 |
+

|
76 |
- Core JS v0.1.8
|
77 |
+

|
78 |
- Added Advanced Option to limit selectable countries to match countries set by Magento
|
79 |

|
80 |
v0.5.3
|
81 |
+

|
82 |
- Core JS v0.1.3.2
|
83 |
+

|
84 |
- New Feature: Use Address Line #1 instead of a new dropdown
|
85 |

|
86 |
+

|
87 |
v0.5.2
|
88 |
+

|
89 |
- Updated core js
|
90 |
+

|
91 |
- Modified some javascript files to match with altered js functionality
|
92 |

|
93 |
+

|
94 |
v0.5.0
|
95 |
+

|
96 |
- Initial release for our global address endpoint.</notes>
|
97 |
<authors><author><name>Gabor Suranyi</name><user>gabor</user><email>gabor@craftyclicks.co.uk</email></author></authors>
|
98 |
+
<date>2016-11-17</date>
|
99 |
+
<time>15:20:53</time>
|
100 |
+
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="C2a"><dir name="Block"><dir name="Adminhtml"><file name="Version.php" hash="8c0e2fbb25e5a54214fb7a017f579dd8"/></dir><file name="Feedback.php" hash="e4470dcbe52e00586e2ab6c1d7daa62f"/><file name="Gridlight.php" hash="a13aefca2c8e9b47836468fba4935b00"/><file name="Integration.php" hash="5b6874f21ff5cc1c82e63113e4d36263"/><file name="Ordergrid.php" hash="edc2c351992cf6c54fd953c1e38c56e0"/></dir><dir name="Helper"><file name="Data.php" hash="eec8278fb149d3884dd886365e5a410b"/></dir><dir name="Model"><file name="Address.php" hash="9e2d6ece83d4aedd9a1218b2023fdfaa"/><file name="Ambient.php" hash="f165ad641db7de86123107394aaee4a3"/><file name="Countrylanguage.php" hash="459bd3d9cf0e1138e91668434d71113c"/><file name="Mode.php" hash="777e339aad59783ddea82de1277c3ae8"/><file name="Position.php" hash="d70c139a43e738edce192bc5ecd8b04d"/><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="c8fb17f7ece7ff7ed6e7b2b80df91799"/></dir><dir name="etc"><file name="config.xml" hash="e8d8d9f61e4528239f09e891e551d4cc"/><file name="system.xml" hash="1c19aac862c746f600fb4228d9527396"/></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="c768961bc22f68c72f3841dba8fec054"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="c447b46c1a3034f7d80b0893128d0cca"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="977a74824add61b0d573d219c7bece49"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="craftyclicks_c2a.xml" hash="40856fbd4db86262f2c36d328cfb6249"/></dir><dir name="template"><dir name="craftyclicks"><dir name="c2a"><file name="c2a_config.phtml" hash="b3a1f247dbdb0dd5d06b207fce025c48"/></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="bd031782df831cd74d8e94f2efd86c5b"/></dir><file name="admin.js" hash="80041dd47a2bd508d1b705c440e693d4"/><file name="advanced.js" hash="007fb8b8f1f27bcb468c95efd11407ee"/><file name="clarion.js" hash="28dac729cffdf94663c5080d28375dee"/><file name="default.js" hash="5e6bdcad177f3ee5814716a57b40c55e"/></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="enhance.css" hash="53d7a61bf3b953c31c8bdbccfacddb8b"/></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_frontend.css" hash="e1bc276523e657c014c154a2d7f1ddc3"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
101 |
<compatible/>
|
102 |
<dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies>
|
103 |
</package>
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
input.c2a-highlight:not(:focus){
|
2 |
+
margin: -1px;
|
3 |
+
border: 2px solid red;
|
4 |
+
animation: border-pulsate 1s infinite;
|
5 |
+
}
|
6 |
+
input.c2a-highlight:focus{
|
7 |
+
margin: 0px;
|
8 |
+
}
|
9 |
+
|
10 |
+
@keyframes border-pulsate {
|
11 |
+
0% { border-color: red; }
|
12 |
+
50% { border-color: green; }
|
13 |
+
100% { border-color: red; }
|
14 |
+
}
|