Version Notes
Release History
v2.5.4
* Added support for AheadWorks shipping selection, with the help of Protolicious.
* Added support for IWD's shipping selection.
v2.5.3
* Fixed extra js include for wp & ecommerceteam checkouts
* Added support for Unicode Systems' Express Checkout
v2.5.2
* Fixed special character escaping issue with error messages
* Added support for Lotus Breath one step checkout
* New feature: detect & change country after address selected. (Guernsey, Jersey, Isle of Man or UK)
v2.5.1
* Fixed issue in Admin Panel
* Fixed issue with Amasty Checkout
* Fine tuned a county hiding for Firecheckout
v2.5.0
* Major Code Rework.
v2.4.9
* Added support for Awesome Checkout
v2.4.8
* Added support for the new Responsive Magento Template. New option in settings: Button Absolute Position.
* If the company field is hidden, push the company data into the address field.
v2.4.7
*Added support for AITOC Checkout.
v2.4.6
* Added support for Amesty One Step Checkout. Updated IWD Checkout support for a newer version. (backwards compatible to older IWD versions)
v2.4.5
* fix packaging issue with v2.4.4, no changes.
v2.4.4
* update support for Templates Master Firecheckout
* test and mark as Magento 1.8 compatible
v2.4.3
* add support of AheadWorks OneStepCheckout
v2.4.2
* add support for further one-page-checkout extensions, supported now are: AHT, EcommerceTeam, GoMage, IWD, Magestore, Mage World, OneStepCheckout, Tempates Master, Vinagento, Web Experiment
* small changes to config settings
v2.4.1
* add support for Magestore OneStepCheckout
* bug fix - if county field is hidden, don't populate it
v2.4.0
* major rework. Keeping compatible with the growing list of one-page-checkout extensions was a pain.
* now using the Magento prototype JS framework to do most of the heavy lifiting. Less tweaks to .phtml files means we can better maintain compativility with all possible checkout layouts.
v2.3.3
* no changes - repackaged to keep Magento Connect happy
v 2.3.2
* update to GoMage integration
v 2.3.1
* workaround for Firefox 4 bug
v 2.3.0
* updated to support Magento v 1.5
v 2.2.0
* added support for Gomage Light Checkout
v 2.1.0
* added support for One Step Checkout
v 2.0.2
* fix layout problem on in IE8 on onepage checkout
v 2.0.1
* fix minor typo in default config
v 2.0
* big re-design for compatibility with Magento 1.4
* added ability to search by house name/number + postcode (previous versions can search by postcode only)
* pressing enter key in the postcode input field does a search
v 1.6.2
* fix for Internet Explorer in admin panel - new customer page; the add address button didn't always work
* use default country in admin pannel - Magento doesn't do this by default
* in one page checkout unhide billing address fields on 'continue' - this esures any error messages are placed correctly if parts of the address are missing
v 1.6.1
* fix for admin panel - sales pages; Added a 1s delay before CraftyClicks stuff is added to a form.
In some rare cases the timing was such that the form may not yet exist in DOM when we tried to add
address finder button etc.
v 1.6.0
* added address lookup to the admin panel, to change order of address fields please see the
documentation tab - http://www.magentocommerce.com/boards/viewchild/17082/
v 1.5.1
* small modification following tests with the blank theme (changed order of initialisation in JavaScript)
v 1.5.0
* add config option for 1st result line.
* avoid using JavaScript DOM for modifying address forms - it was conflicting with Magento JavaScript.
We now edit the template .phtml files directly.
* fix problems with re-displaying state select box when country is changed from UK to USA.
* fix problem with postcode error message affecting button position if form was submitted with a blank postcode.
v 1.4.0
* make error message class configurable - it can now be styled to match other Magento errors
* make error message text configurable
* fix issue with error message not being shown if hiding of address fields was enabled
v 1.3.0
* populate the company field if company name is available
* unhide all address lines on lookup error to allow customer to enter the address manually
* update to latest CraftyClicks JavaScript (v3.5):
- added the on_error event
- fixed selection of result using keyboard (got broken in latest Firefox v3.5)
v 1.2.0
* can now hide the region/province (county) field
* update to latest CraftyClicks JavaScript (v3.4)
v 1.1.2 (bug fix release)
* fix typo in JS code
v 1.1.1 (bug fix release)
* fix rearranging address fields order; was causing problems on one page checkout
* fix hiding of result box on result select
* hide result box on country change
v 1.1.0
* added Admin Panel options to configure look and feel of the module
* add address lookup to multiship checkout pages
v 1.0.0 - Initial Release
Release Info
Developer | Crafty Clicks |
Extension | UK_Postcode_Address_Finder |
Version | 2.5.4 |
Comparing to | |
See all releases |
Code changes from version 2.5.3 to 2.5.4
- app/code/community/Craftyclicks/Clicktoaddress/etc/config.xml +1 -1
- js/craftyclicks/clicktoaddress/craftyclicks_aheadworks_onestepcheckout.js +131 -66
- js/craftyclicks/clicktoaddress/craftyclicks_iwd_onestepcheckout_v2_2.js +2 -0
- js/craftyclicks/clicktoaddress/craftyclicks_magento.js~ +0 -438
- js/craftyclicks/clicktoaddress/craftyclicks_opcheckout.js +2 -2
- package.xml +8 -4
@@ -12,7 +12,7 @@
|
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Craftyclicks_Clicktoaddress>
|
15 |
-
<version>2.5.
|
16 |
</Craftyclicks_Clicktoaddress>
|
17 |
</modules>
|
18 |
|
12 |
<config>
|
13 |
<modules>
|
14 |
<Craftyclicks_Clicktoaddress>
|
15 |
+
<version>2.5.4</version>
|
16 |
</Craftyclicks_Clicktoaddress>
|
17 |
</modules>
|
18 |
|
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
// This is a collection of JavaScript code to allow easy integration of
|
3 |
// the Crafty Clicks postcode / address finder functionality into these
|
4 |
// Magento checkout extensions :
|
5 |
//
|
@@ -8,29 +8,29 @@
|
|
8 |
//
|
9 |
// Provided by www.CraftyClicks.co.uk
|
10 |
//
|
11 |
-
// Requires standard CraftyClicks JS - tested with v4.9.2
|
12 |
//
|
13 |
// If you copy/use/modify this code - please keep this
|
14 |
-
// comment header in place
|
15 |
//
|
16 |
// Copyright (c) 2009-2013 Crafty Clicks (http://www.craftyclicks.com)
|
17 |
//
|
18 |
-
// This code relies on prototype js, you must have a reasonably recent version loaded
|
19 |
// in your template. Magento should include it as standard.
|
20 |
-
//
|
21 |
// If you need any help, contact support@craftyclicks.co.uk - we will help!
|
22 |
//
|
23 |
-
**********************************************************************************/
|
24 |
function CraftyClicksMagentoClass () {
|
25 |
-
this.prefix = "";
|
26 |
this.fields = { "postcode_id" : "", // required
|
27 |
-
"company_id" : "", // optional
|
28 |
-
"street1_id" : "", // required
|
29 |
"street2_id" : "", // optional
|
30 |
"street3_id" : "", // optional
|
31 |
"street4_id" : "", // optional
|
32 |
"town_id" : "", // required
|
33 |
-
"county_id" : "", // optional
|
34 |
"country_id" : "", // required
|
35 |
"telephone_id" : "" // required
|
36 |
};
|
@@ -40,9 +40,9 @@ function CraftyClicksMagentoClass () {
|
|
40 |
this.old_postcode_width = '';
|
41 |
this.cp_obj = 0;
|
42 |
this.change_field_order = 1;
|
43 |
-
|
44 |
this.elem_move = function(e1, e2) {
|
45 |
-
e1.insert({after : e2});
|
46 |
}
|
47 |
|
48 |
this.rearrange_fields = function() {
|
@@ -50,22 +50,22 @@ function CraftyClicksMagentoClass () {
|
|
50 |
// check postcode field exists
|
51 |
if (! $(fields.postcode_id)) return false;
|
52 |
|
53 |
-
// postcode could be bundled with county
|
54 |
if ($(fields.county_id).up('div', 1) == $(fields.postcode_id).up('div', 1).next() &&
|
55 |
$(fields.county_id).up('div', 1).hasClassName('aw-onestepcheckout-general-form-field-right') &&
|
56 |
$(fields.postcode_id).up('div', 1).hasClassName('aw-onestepcheckout-general-form-field-left')) {
|
57 |
-
|
58 |
// move the county and postcode on its own lines
|
59 |
$(fields.county_id).up('div', 1).removeClassName('aw-onestepcheckout-general-form-field-right');
|
60 |
$(fields.county_id).up('div', 1).addClassName('aw-onestepcheckout-general-form-field-wide');
|
61 |
$(fields.postcode_id).up('div', 1).removeClassName('aw-onestepcheckout-general-form-field-left');
|
62 |
$(fields.postcode_id).up('div', 1).addClassName('aw-onestepcheckout-general-form-field-wide');
|
63 |
}
|
64 |
-
|
65 |
if ('' != $(fields.town_id).getValue()) {
|
66 |
_cp_hide_fields = false;
|
67 |
}
|
68 |
-
|
69 |
// order for non-UK: country, company (if we have it), street1, street2, street3 (if we have it), town, county (if we have it), postcode
|
70 |
var li_list = [ $(fields.country_id).up('div', 1) ];
|
71 |
var idx = 1;
|
@@ -93,10 +93,10 @@ function CraftyClicksMagentoClass () {
|
|
93 |
li_list[idx] = ne.up('div', 1); idx++;
|
94 |
ne.up('div', 1).addClassName(this.prefix+'_cp_address_class');
|
95 |
}
|
96 |
-
li_list[idx] = $(fields.town_id).up('div', 1); idx++;
|
97 |
$(fields.town_id).up('div', 1).addClassName(this.prefix+'_cp_address_class');
|
98 |
|
99 |
-
li_list[idx] = $(fields.county_id).up('div', 1); idx++;
|
100 |
$(fields.county_id).up('div', 1).addClassName(this.prefix+'_cp_address_class');
|
101 |
|
102 |
li_list[idx] = $(fields.postcode_id).up('div', 1); idx++;
|
@@ -106,14 +106,14 @@ function CraftyClicksMagentoClass () {
|
|
106 |
this.elem_move(li_list[ii], li_list[ii+1]);
|
107 |
}
|
108 |
}
|
109 |
-
|
110 |
/*
|
111 |
// shrink postcode field width, so the lookup button fits on the form next to the postcode field
|
112 |
var pcWidth = parseInt($(this.fields.postcode_id).getStyle("width"));
|
113 |
if (350 < pcWidth) {
|
114 |
this.uk_postcode_width = '100px';
|
115 |
}
|
116 |
-
*/
|
117 |
return (true);
|
118 |
}
|
119 |
|
@@ -148,9 +148,9 @@ function CraftyClicksMagentoClass () {
|
|
148 |
$(this.fields.postcode_id).up('div', 1).insert( {after : tmp_html} );
|
149 |
$(this.prefix+"_cp_button_id").observe('click', this.button_clicked.bindAsEventListener(this));
|
150 |
}
|
151 |
-
// show button
|
152 |
$(this.prefix+"_cp_button_div_id").show();
|
153 |
-
|
154 |
// shrink postcode field if needed
|
155 |
if ('' != this.uk_postcode_width) {
|
156 |
this.old_postcode_width = $(this.fields.postcode_id).getStyle("width");
|
@@ -164,16 +164,16 @@ function CraftyClicksMagentoClass () {
|
|
164 |
ne.up('div', 1).hide();
|
165 |
}
|
166 |
}
|
167 |
-
}
|
168 |
-
|
169 |
if ('initial' == this.current_setup && _cp_hide_fields) {
|
170 |
// first time and default to UK, hide address fields
|
171 |
$$('.'+this.prefix+'_cp_address_class').invoke('hide');
|
172 |
}
|
173 |
-
|
174 |
// set state
|
175 |
this.current_setup = 'uk';
|
176 |
-
}
|
177 |
|
178 |
this.setup_for_non_uk = function() {
|
179 |
// check if we need to do anything
|
@@ -204,28 +204,28 @@ function CraftyClicksMagentoClass () {
|
|
204 |
ne.up('div', 1).show();
|
205 |
}
|
206 |
}
|
207 |
-
|
208 |
// show all other addres lines
|
209 |
$$('.'+this.prefix+'_cp_address_class').invoke('show');
|
210 |
// set state
|
211 |
this.current_setup = 'non_uk';
|
212 |
-
}
|
213 |
-
}
|
214 |
|
215 |
this.add_lookup = function(setup) {
|
216 |
cp_obj = CraftyPostcodeCreate();
|
217 |
this.cp_obj = cp_obj;
|
218 |
-
// config
|
219 |
this.prefix = setup.prefix;
|
220 |
this.fields = setup.fields;
|
221 |
-
cp_obj.set("access_token", _cp_token_fe);
|
222 |
cp_obj.set("res_autoselect", "0");
|
223 |
cp_obj.set("result_elem_id", this.prefix+"_cp_result_display");
|
224 |
cp_obj.set("form", "");
|
225 |
cp_obj.set("elem_company" , this.fields.company_id); // optional
|
226 |
cp_obj.set("elem_street1" , this.fields.street1_id);
|
227 |
cp_obj.set("elem_street2" , this.fields.street2_id);
|
228 |
-
cp_obj.set("elem_street3" , this.fields.street3_id);
|
229 |
cp_obj.set("elem_town" , this.fields.town_id);
|
230 |
if (_cp_hide_county) {
|
231 |
cp_obj.set("elem_county" , ""); // optional
|
@@ -236,10 +236,10 @@ function CraftyClicksMagentoClass () {
|
|
236 |
cp_obj.set("single_res_autoselect" , 1); // don't show a drop down box if only one matching address is found
|
237 |
cp_obj.set("max_width" , _cp_result_box_width);
|
238 |
if (1 < _cp_result_box_height) {
|
239 |
-
cp_obj.set("first_res_line", "");
|
240 |
cp_obj.set("max_lines" , _cp_result_box_height);
|
241 |
} else {
|
242 |
-
cp_obj.set("first_res_line", "----- please select your address ----");
|
243 |
cp_obj.set("max_lines" , 1);
|
244 |
}
|
245 |
cp_obj.set("busy_img_url" , _cp_busy_img_url);
|
@@ -284,10 +284,10 @@ function CraftyClicksMagentoClass () {
|
|
284 |
if ('' != _cp_error_class) $(this.prefix+'_cp_result_display').removeClassName(_cp_error_class);
|
285 |
this.cp_obj.doLookup();
|
286 |
}
|
287 |
-
|
288 |
this.result_ready = function() {
|
289 |
}
|
290 |
-
|
291 |
this.result_selected = function() {
|
292 |
if (_cp_clear_result) this.cp_obj.update_res(null);
|
293 |
$$('.'+this.prefix+'_cp_address_class').invoke('show');
|
@@ -299,54 +299,55 @@ function CraftyClicksMagentoClass () {
|
|
299 |
case "JE":
|
300 |
$(this.fields.country_id).setValue("JE");
|
301 |
break;
|
302 |
-
case "IM":
|
303 |
$(this.fields.country_id).setValue("IM");
|
304 |
break;
|
305 |
default:
|
306 |
$(this.fields.country_id).setValue("GB");
|
307 |
break;
|
308 |
}
|
|
|
309 |
}
|
310 |
-
|
311 |
-
this.result_error = function() {
|
312 |
$$('.'+this.prefix+'_cp_address_class').invoke('show');
|
313 |
if ('' != _cp_error_class) $(this.prefix+'_cp_result_display').addClassName(_cp_error_class);
|
314 |
}
|
315 |
}
|
316 |
|
317 |
document.observe("dom:loaded", function() {
|
318 |
-
|
319 |
if (!_cp_integrate) return;
|
320 |
-
|
321 |
if ($("billing:postcode")) {
|
322 |
var cc1 = new CraftyClicksMagentoClass();
|
323 |
cc1.add_lookup({
|
324 |
-
"prefix" : "billing",
|
325 |
-
"fields" : { "postcode_id" : "billing:postcode",
|
326 |
-
"company_id" : "billing:company",
|
327 |
-
"street1_id" : "billing:street1",
|
328 |
-
"street2_id" : "billing:street2",
|
329 |
-
"street3_id" : "billing:street3",
|
330 |
-
"street4_id" : "billing:street4",
|
331 |
"town_id" : "billing:city",
|
332 |
-
"county_id" : "billing:region",
|
333 |
"country_id" : "billing:country_id",
|
334 |
"telephone_id": "billing:telephone" }
|
335 |
});
|
336 |
}
|
337 |
-
|
338 |
if ($("shipping:postcode")) {
|
339 |
var cc2 = new CraftyClicksMagentoClass();
|
340 |
cc2.add_lookup({
|
341 |
-
"prefix" : "shipping",
|
342 |
-
"fields" : { "postcode_id" : "shipping:postcode",
|
343 |
-
"company_id" : "shipping:company",
|
344 |
-
"street1_id" : "shipping:street1",
|
345 |
-
"street2_id" : "shipping:street2",
|
346 |
-
"street3_id" : "shipping:street3",
|
347 |
-
"street4_id" : "shipping:street4",
|
348 |
"town_id" : "shipping:city",
|
349 |
-
"county_id" : "shipping:region",
|
350 |
"country_id" : "shipping:country_id",
|
351 |
"telephone_id": "shipping:telephone" }
|
352 |
});
|
@@ -355,15 +356,15 @@ document.observe("dom:loaded", function() {
|
|
355 |
if ($("zip")) {
|
356 |
var cc3 = new CraftyClicksMagentoClass();
|
357 |
cc3.add_lookup({
|
358 |
-
"prefix" : "",
|
359 |
-
"fields" : { "postcode_id" : "zip",
|
360 |
-
"company_id" : "company",
|
361 |
-
"street1_id" : "street_1",
|
362 |
-
"street2_id" : "street_2",
|
363 |
-
"street3_id" : "street_3",
|
364 |
-
"street4_id" : "street_4",
|
365 |
"town_id" : "city",
|
366 |
-
"county_id" : "region",
|
367 |
"country_id" : "country",
|
368 |
"telephone_id": "telephone" }
|
369 |
});
|
@@ -371,3 +372,67 @@ document.observe("dom:loaded", function() {
|
|
371 |
|
372 |
});
|
373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/*
|
2 |
+
// This is a collection of JavaScript code to allow easy integration of
|
3 |
// the Crafty Clicks postcode / address finder functionality into these
|
4 |
// Magento checkout extensions :
|
5 |
//
|
8 |
//
|
9 |
// Provided by www.CraftyClicks.co.uk
|
10 |
//
|
11 |
+
// Requires standard CraftyClicks JS - tested with v4.9.2
|
12 |
//
|
13 |
// If you copy/use/modify this code - please keep this
|
14 |
+
// comment header in place
|
15 |
//
|
16 |
// Copyright (c) 2009-2013 Crafty Clicks (http://www.craftyclicks.com)
|
17 |
//
|
18 |
+
// This code relies on prototype js, you must have a reasonably recent version loaded
|
19 |
// in your template. Magento should include it as standard.
|
20 |
+
//
|
21 |
// If you need any help, contact support@craftyclicks.co.uk - we will help!
|
22 |
//
|
23 |
+
**********************************************************************************/
|
24 |
function CraftyClicksMagentoClass () {
|
25 |
+
this.prefix = "";
|
26 |
this.fields = { "postcode_id" : "", // required
|
27 |
+
"company_id" : "", // optional
|
28 |
+
"street1_id" : "", // required
|
29 |
"street2_id" : "", // optional
|
30 |
"street3_id" : "", // optional
|
31 |
"street4_id" : "", // optional
|
32 |
"town_id" : "", // required
|
33 |
+
"county_id" : "", // optional
|
34 |
"country_id" : "", // required
|
35 |
"telephone_id" : "" // required
|
36 |
};
|
40 |
this.old_postcode_width = '';
|
41 |
this.cp_obj = 0;
|
42 |
this.change_field_order = 1;
|
43 |
+
|
44 |
this.elem_move = function(e1, e2) {
|
45 |
+
e1.insert({after : e2});
|
46 |
}
|
47 |
|
48 |
this.rearrange_fields = function() {
|
50 |
// check postcode field exists
|
51 |
if (! $(fields.postcode_id)) return false;
|
52 |
|
53 |
+
// postcode could be bundled with county
|
54 |
if ($(fields.county_id).up('div', 1) == $(fields.postcode_id).up('div', 1).next() &&
|
55 |
$(fields.county_id).up('div', 1).hasClassName('aw-onestepcheckout-general-form-field-right') &&
|
56 |
$(fields.postcode_id).up('div', 1).hasClassName('aw-onestepcheckout-general-form-field-left')) {
|
57 |
+
|
58 |
// move the county and postcode on its own lines
|
59 |
$(fields.county_id).up('div', 1).removeClassName('aw-onestepcheckout-general-form-field-right');
|
60 |
$(fields.county_id).up('div', 1).addClassName('aw-onestepcheckout-general-form-field-wide');
|
61 |
$(fields.postcode_id).up('div', 1).removeClassName('aw-onestepcheckout-general-form-field-left');
|
62 |
$(fields.postcode_id).up('div', 1).addClassName('aw-onestepcheckout-general-form-field-wide');
|
63 |
}
|
64 |
+
|
65 |
if ('' != $(fields.town_id).getValue()) {
|
66 |
_cp_hide_fields = false;
|
67 |
}
|
68 |
+
|
69 |
// order for non-UK: country, company (if we have it), street1, street2, street3 (if we have it), town, county (if we have it), postcode
|
70 |
var li_list = [ $(fields.country_id).up('div', 1) ];
|
71 |
var idx = 1;
|
93 |
li_list[idx] = ne.up('div', 1); idx++;
|
94 |
ne.up('div', 1).addClassName(this.prefix+'_cp_address_class');
|
95 |
}
|
96 |
+
li_list[idx] = $(fields.town_id).up('div', 1); idx++;
|
97 |
$(fields.town_id).up('div', 1).addClassName(this.prefix+'_cp_address_class');
|
98 |
|
99 |
+
li_list[idx] = $(fields.county_id).up('div', 1); idx++;
|
100 |
$(fields.county_id).up('div', 1).addClassName(this.prefix+'_cp_address_class');
|
101 |
|
102 |
li_list[idx] = $(fields.postcode_id).up('div', 1); idx++;
|
106 |
this.elem_move(li_list[ii], li_list[ii+1]);
|
107 |
}
|
108 |
}
|
109 |
+
|
110 |
/*
|
111 |
// shrink postcode field width, so the lookup button fits on the form next to the postcode field
|
112 |
var pcWidth = parseInt($(this.fields.postcode_id).getStyle("width"));
|
113 |
if (350 < pcWidth) {
|
114 |
this.uk_postcode_width = '100px';
|
115 |
}
|
116 |
+
*/
|
117 |
return (true);
|
118 |
}
|
119 |
|
148 |
$(this.fields.postcode_id).up('div', 1).insert( {after : tmp_html} );
|
149 |
$(this.prefix+"_cp_button_id").observe('click', this.button_clicked.bindAsEventListener(this));
|
150 |
}
|
151 |
+
// show button
|
152 |
$(this.prefix+"_cp_button_div_id").show();
|
153 |
+
|
154 |
// shrink postcode field if needed
|
155 |
if ('' != this.uk_postcode_width) {
|
156 |
this.old_postcode_width = $(this.fields.postcode_id).getStyle("width");
|
164 |
ne.up('div', 1).hide();
|
165 |
}
|
166 |
}
|
167 |
+
}
|
168 |
+
|
169 |
if ('initial' == this.current_setup && _cp_hide_fields) {
|
170 |
// first time and default to UK, hide address fields
|
171 |
$$('.'+this.prefix+'_cp_address_class').invoke('hide');
|
172 |
}
|
173 |
+
|
174 |
// set state
|
175 |
this.current_setup = 'uk';
|
176 |
+
}
|
177 |
|
178 |
this.setup_for_non_uk = function() {
|
179 |
// check if we need to do anything
|
204 |
ne.up('div', 1).show();
|
205 |
}
|
206 |
}
|
207 |
+
|
208 |
// show all other addres lines
|
209 |
$$('.'+this.prefix+'_cp_address_class').invoke('show');
|
210 |
// set state
|
211 |
this.current_setup = 'non_uk';
|
212 |
+
}
|
213 |
+
}
|
214 |
|
215 |
this.add_lookup = function(setup) {
|
216 |
cp_obj = CraftyPostcodeCreate();
|
217 |
this.cp_obj = cp_obj;
|
218 |
+
// config
|
219 |
this.prefix = setup.prefix;
|
220 |
this.fields = setup.fields;
|
221 |
+
cp_obj.set("access_token", _cp_token_fe);
|
222 |
cp_obj.set("res_autoselect", "0");
|
223 |
cp_obj.set("result_elem_id", this.prefix+"_cp_result_display");
|
224 |
cp_obj.set("form", "");
|
225 |
cp_obj.set("elem_company" , this.fields.company_id); // optional
|
226 |
cp_obj.set("elem_street1" , this.fields.street1_id);
|
227 |
cp_obj.set("elem_street2" , this.fields.street2_id);
|
228 |
+
cp_obj.set("elem_street3" , this.fields.street3_id);
|
229 |
cp_obj.set("elem_town" , this.fields.town_id);
|
230 |
if (_cp_hide_county) {
|
231 |
cp_obj.set("elem_county" , ""); // optional
|
236 |
cp_obj.set("single_res_autoselect" , 1); // don't show a drop down box if only one matching address is found
|
237 |
cp_obj.set("max_width" , _cp_result_box_width);
|
238 |
if (1 < _cp_result_box_height) {
|
239 |
+
cp_obj.set("first_res_line", "");
|
240 |
cp_obj.set("max_lines" , _cp_result_box_height);
|
241 |
} else {
|
242 |
+
cp_obj.set("first_res_line", "----- please select your address ----");
|
243 |
cp_obj.set("max_lines" , 1);
|
244 |
}
|
245 |
cp_obj.set("busy_img_url" , _cp_busy_img_url);
|
284 |
if ('' != _cp_error_class) $(this.prefix+'_cp_result_display').removeClassName(_cp_error_class);
|
285 |
this.cp_obj.doLookup();
|
286 |
}
|
287 |
+
|
288 |
this.result_ready = function() {
|
289 |
}
|
290 |
+
|
291 |
this.result_selected = function() {
|
292 |
if (_cp_clear_result) this.cp_obj.update_res(null);
|
293 |
$$('.'+this.prefix+'_cp_address_class').invoke('show');
|
299 |
case "JE":
|
300 |
$(this.fields.country_id).setValue("JE");
|
301 |
break;
|
302 |
+
case "IM":
|
303 |
$(this.fields.country_id).setValue("IM");
|
304 |
break;
|
305 |
default:
|
306 |
$(this.fields.country_id).setValue("GB");
|
307 |
break;
|
308 |
}
|
309 |
+
$(this.fields.town_id).simulate('change');
|
310 |
}
|
311 |
+
|
312 |
+
this.result_error = function() {
|
313 |
$$('.'+this.prefix+'_cp_address_class').invoke('show');
|
314 |
if ('' != _cp_error_class) $(this.prefix+'_cp_result_display').addClassName(_cp_error_class);
|
315 |
}
|
316 |
}
|
317 |
|
318 |
document.observe("dom:loaded", function() {
|
319 |
+
|
320 |
if (!_cp_integrate) return;
|
321 |
+
|
322 |
if ($("billing:postcode")) {
|
323 |
var cc1 = new CraftyClicksMagentoClass();
|
324 |
cc1.add_lookup({
|
325 |
+
"prefix" : "billing",
|
326 |
+
"fields" : { "postcode_id" : "billing:postcode",
|
327 |
+
"company_id" : "billing:company",
|
328 |
+
"street1_id" : "billing:street1",
|
329 |
+
"street2_id" : "billing:street2",
|
330 |
+
"street3_id" : "billing:street3",
|
331 |
+
"street4_id" : "billing:street4",
|
332 |
"town_id" : "billing:city",
|
333 |
+
"county_id" : "billing:region",
|
334 |
"country_id" : "billing:country_id",
|
335 |
"telephone_id": "billing:telephone" }
|
336 |
});
|
337 |
}
|
338 |
+
|
339 |
if ($("shipping:postcode")) {
|
340 |
var cc2 = new CraftyClicksMagentoClass();
|
341 |
cc2.add_lookup({
|
342 |
+
"prefix" : "shipping",
|
343 |
+
"fields" : { "postcode_id" : "shipping:postcode",
|
344 |
+
"company_id" : "shipping:company",
|
345 |
+
"street1_id" : "shipping:street1",
|
346 |
+
"street2_id" : "shipping:street2",
|
347 |
+
"street3_id" : "shipping:street3",
|
348 |
+
"street4_id" : "shipping:street4",
|
349 |
"town_id" : "shipping:city",
|
350 |
+
"county_id" : "shipping:region",
|
351 |
"country_id" : "shipping:country_id",
|
352 |
"telephone_id": "shipping:telephone" }
|
353 |
});
|
356 |
if ($("zip")) {
|
357 |
var cc3 = new CraftyClicksMagentoClass();
|
358 |
cc3.add_lookup({
|
359 |
+
"prefix" : "",
|
360 |
+
"fields" : { "postcode_id" : "zip",
|
361 |
+
"company_id" : "company",
|
362 |
+
"street1_id" : "street_1",
|
363 |
+
"street2_id" : "street_2",
|
364 |
+
"street3_id" : "street_3",
|
365 |
+
"street4_id" : "street_4",
|
366 |
"town_id" : "city",
|
367 |
+
"county_id" : "region",
|
368 |
"country_id" : "country",
|
369 |
"telephone_id": "telephone" }
|
370 |
});
|
372 |
|
373 |
});
|
374 |
|
375 |
+
/**
|
376 |
+
* Event.simulate(@element, eventName[, options]) -> Element
|
377 |
+
*
|
378 |
+
* - @element: element to fire event on
|
379 |
+
* - eventName: name of event to fire (only MouseEvents and HTMLEvents interfaces are supported)
|
380 |
+
* - options: optional object to fine-tune event properties - pointerX, pointerY, ctrlKey, etc.
|
381 |
+
*
|
382 |
+
* $('foo').simulate('click'); // => fires "click" event on an element with id=foo
|
383 |
+
*
|
384 |
+
**/
|
385 |
+
(function(){
|
386 |
+
|
387 |
+
var eventMatchers = {
|
388 |
+
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
|
389 |
+
'MouseEvents': /^(?:click|dblclick|mouse(?:down|up|over|move|out))$/
|
390 |
+
}
|
391 |
+
var defaultOptions = {
|
392 |
+
pointerX: 0,
|
393 |
+
pointerY: 0,
|
394 |
+
button: 0,
|
395 |
+
ctrlKey: false,
|
396 |
+
altKey: false,
|
397 |
+
shiftKey: false,
|
398 |
+
metaKey: false,
|
399 |
+
bubbles: true,
|
400 |
+
cancelable: true
|
401 |
+
}
|
402 |
+
|
403 |
+
Event.simulate = function(element, eventName) {
|
404 |
+
var options = Object.extend(Object.clone(defaultOptions), arguments[2] || { });
|
405 |
+
var oEvent, eventType = null;
|
406 |
+
|
407 |
+
element = $(element);
|
408 |
+
|
409 |
+
for (var name in eventMatchers) {
|
410 |
+
if (eventMatchers[name].test(eventName)) { eventType = name; break; }
|
411 |
+
}
|
412 |
+
|
413 |
+
if (!eventType)
|
414 |
+
throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
|
415 |
+
|
416 |
+
if (document.createEvent) {
|
417 |
+
oEvent = document.createEvent(eventType);
|
418 |
+
if (eventType == 'HTMLEvents') {
|
419 |
+
oEvent.initEvent(eventName, options.bubbles, options.cancelable);
|
420 |
+
}
|
421 |
+
else {
|
422 |
+
oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
|
423 |
+
options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
|
424 |
+
options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
|
425 |
+
}
|
426 |
+
element.dispatchEvent(oEvent);
|
427 |
+
}
|
428 |
+
else {
|
429 |
+
options.clientX = options.pointerX;
|
430 |
+
options.clientY = options.pointerY;
|
431 |
+
oEvent = Object.extend(document.createEventObject(), options);
|
432 |
+
element.fireEvent('on' + eventName, oEvent);
|
433 |
+
}
|
434 |
+
return element;
|
435 |
+
}
|
436 |
+
|
437 |
+
Element.addMethods({ simulate: Event.simulate });
|
438 |
+
})();
|
@@ -323,6 +323,8 @@ function CraftyClicksMagentoClass () {
|
|
323 |
$(this.fields.country_id).setValue("GB");
|
324 |
break;
|
325 |
}
|
|
|
|
|
326 |
}
|
327 |
|
328 |
this.result_error = function() {
|
323 |
$(this.fields.country_id).setValue("GB");
|
324 |
break;
|
325 |
}
|
326 |
+
|
327 |
+
jQuery('#'+this.fields.street1_id.replace(":","\\:")).trigger( "keydown" );
|
328 |
}
|
329 |
|
330 |
this.result_error = function() {
|
@@ -1,438 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
// This is a collection of JavaScript code to allow easy integration of
|
3 |
-
// the Crafty Clicks postcode / address finder functionality into Magento
|
4 |
-
//
|
5 |
-
// This file works for the standard magento checkout (both community and enterprise)
|
6 |
-
//
|
7 |
-
// It also covers, these aftermarket extensions:
|
8 |
-
//
|
9 |
-
// OneStepCheckout Pro by Mage World
|
10 |
-
// http://www.mage-world.com/one-step-checkout-pro-magento-extension.html
|
11 |
-
//
|
12 |
-
// Provided by www.CraftyClicks.co.uk
|
13 |
-
//
|
14 |
-
// Requires standard CraftyClicks JS - tested with v4.9.1
|
15 |
-
//
|
16 |
-
// If you copy/use/modify this code - please keep this
|
17 |
-
// comment header in place
|
18 |
-
//
|
19 |
-
// Copyright (c) 2009-2014 Crafty Clicks (http://www.craftyclicks.com)
|
20 |
-
//
|
21 |
-
// This code relies on prototype js, you must have a reasonably recent version loaded
|
22 |
-
// in your template. Magento should include it as standard.
|
23 |
-
//
|
24 |
-
// If you need any help, contact support@craftyclicks.co.uk - we will help!
|
25 |
-
//
|
26 |
-
**********************************************************************************/
|
27 |
-
function CraftyClicksMagentoClass () {
|
28 |
-
this.prefix = "";
|
29 |
-
this.fields = { "postcode_id" : "", // required
|
30 |
-
"company_id" : "", // optional
|
31 |
-
"street1_id" : "", // required
|
32 |
-
"street2_id" : "", // optional
|
33 |
-
"street3_id" : "", // optional
|
34 |
-
"street4_id" : "", // optional
|
35 |
-
"town_id" : "", // required
|
36 |
-
"county_id" : "", // optional
|
37 |
-
"country_id" : "", // required
|
38 |
-
"email_id" : "" // required
|
39 |
-
};
|
40 |
-
|
41 |
-
this.current_setup = 'initial'; // can be 'uk' or 'non_uk'
|
42 |
-
this.uk_postcode_width = ''
|
43 |
-
this.old_postcode_width = '';
|
44 |
-
this.cp_obj = 0;
|
45 |
-
this.div_depth = 0;
|
46 |
-
this.li_class = '';
|
47 |
-
this.mw_opc = false;
|
48 |
-
|
49 |
-
this.elem_move = function(e1, e2) {
|
50 |
-
e1.insert({after : e2});
|
51 |
-
}
|
52 |
-
|
53 |
-
// test div depth - some magento temlates wrap fields in two layers of div in a li
|
54 |
-
this.set_div_depth = function() {
|
55 |
-
if ($(this.fields.postcode_id).up('div', 1).descendantOf($(this.fields.postcode_id).up('li'))) {
|
56 |
-
this.div_depth = 1;
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
this.rearrange_fields = function() {
|
61 |
-
var fields = this.fields;
|
62 |
-
|
63 |
-
this.mw_opc = (typeof $MW_Onestepcheckout !== "undefined" ? true : false);
|
64 |
-
this.crafty_melissa = false;
|
65 |
-
if(typeof crafty_melissa_cfg !== "undefined"){
|
66 |
-
this.crafty_melissa = (parseInt(crafty_melissa_cfg.usaauto.active) || parseInt(crafty_melissa_cfg.globalauto.active)) ? true : false;
|
67 |
-
}
|
68 |
-
|
69 |
-
if (this.mw_opc) {
|
70 |
-
this.li_class = 'fields';
|
71 |
-
}
|
72 |
-
|
73 |
-
// postcode should be bundled with country in the same li on the standard magento address templates
|
74 |
-
// if this isn't the case, the rest of this code unlikely to work!
|
75 |
-
if ($(fields.country_id).up('li') == $(fields.postcode_id).up('li') || this.mw_opc || this.crafty_melissa) {
|
76 |
-
|
77 |
-
if ('' != $(fields.town_id).getValue()) {
|
78 |
-
_cp_hide_fields = false;
|
79 |
-
}
|
80 |
-
|
81 |
-
// order for non-UK: country, company (if we have it), street1, street2, street3 (if we have it), town, county (if we have it), postcode
|
82 |
-
var li_list = [ $(fields.country_id).up('li') ];
|
83 |
-
var idx = 1;
|
84 |
-
|
85 |
-
var ne = $(fields.company_id);
|
86 |
-
if (ne) {
|
87 |
-
// check if the email address is bundled with the company - on some templates it is and we then should separate it out.
|
88 |
-
if ($(fields.email_id) && ne.up('li') == $(fields.email_id).up('li') && !this.mw_opc) {
|
89 |
-
// create a new li to hold the company on its own
|
90 |
-
$(fields.street1_id).up('li').insert( {before: '<li class="'+this.li_class+'" id="'+this.prefix+'_company_placeholder_id"></li>'} );
|
91 |
-
$(this.prefix+"_company_placeholder_id").insert( $(fields.company_id).up('div', this.div_depth) );
|
92 |
-
ne = $(fields.company_id);
|
93 |
-
}
|
94 |
-
li_list[idx] = ne.up('li'); idx++;
|
95 |
-
ne.up('li').addClassName(this.prefix+'_cp_address_class');
|
96 |
-
}
|
97 |
-
|
98 |
-
li_list[idx] = $(fields.street1_id).up('li'); idx++;
|
99 |
-
$(fields.street1_id).up('li').addClassName(this.prefix+'_cp_address_class');
|
100 |
-
ne = $(fields.street2_id);
|
101 |
-
if (ne) {
|
102 |
-
li_list[idx] = ne.up('li'); idx++;
|
103 |
-
ne.up('li').addClassName(this.prefix+'_cp_address_class');
|
104 |
-
}
|
105 |
-
ne = $(fields.street3_id);
|
106 |
-
if (ne) {
|
107 |
-
li_list[idx] = ne.up('li'); idx++;
|
108 |
-
ne.up('li').addClassName(this.prefix+'_cp_address_class');
|
109 |
-
}
|
110 |
-
ne = $(fields.street4_id);
|
111 |
-
if (ne) {
|
112 |
-
li_list[idx] = ne.up('li'); idx++;
|
113 |
-
ne.up('li').addClassName(this.prefix+'_cp_address_class');
|
114 |
-
}
|
115 |
-
li_list[idx] = $(fields.town_id).up('li'); idx++; // town and county are on the same li, so will move together
|
116 |
-
$(fields.town_id).up('li').addClassName(this.prefix+'_cp_address_class');
|
117 |
-
|
118 |
-
if (this.mw_opc) {
|
119 |
-
$(fields.county_id).up('li').addClassName(this.prefix+'_cp_address_class');
|
120 |
-
this.uk_postcode_width = '100px';
|
121 |
-
} else {
|
122 |
-
for (var ii = 0; ii < idx; ii++) {
|
123 |
-
this.elem_move(li_list[ii], li_list[ii+1]);
|
124 |
-
}
|
125 |
-
// create a new li to hold the postcode on its own
|
126 |
-
$(fields.town_id).up('li').insert( {after: '<li class="'+this.li_class+'" id="'+this.prefix+'_cp_postcode_placeholder_id"></li>'} );
|
127 |
-
$(this.prefix+"_cp_postcode_placeholder_id").insert( $(this.fields.postcode_id).up('div', this.div_depth) );
|
128 |
-
|
129 |
-
// check postcode field width, longer than 350px means we are on a magento enterprise template and we need to shrink things a bit
|
130 |
-
// so the lookup button fits on the form next to the postcode field
|
131 |
-
var pcWidth = parseInt($(this.fields.postcode_id).getStyle("width"));
|
132 |
-
if (350 < pcWidth || _cp_button_fixposition) {
|
133 |
-
this.uk_postcode_width = '100px';
|
134 |
-
}
|
135 |
-
|
136 |
-
// move the telephone above the address - we move it only if we hide other address fields
|
137 |
-
ne = $(fields.telephone_id);
|
138 |
-
if (_cp_hide_fields && ne) {
|
139 |
-
// telephone may be bundled with company, if so separate it out
|
140 |
-
if ($(fields.company_id) && ne.up('li') == $(fields.company_id).up('li')) {
|
141 |
-
// create a new li to hold the telephone on its own at the top of the address
|
142 |
-
$(fields.country_id).up('li').insert( {before: '<li class="'+this.li_class+'" id="'+this.prefix+'_telephone_placeholder_id"></li>'} );
|
143 |
-
$(this.prefix+"_telephone_placeholder_id").insert( ne.up('div', this.div_depth) );
|
144 |
-
} else {
|
145 |
-
// telephone is probably on its own, or with fax
|
146 |
-
$(fields.country_id).up('li').insert({before : ne.up('li')});
|
147 |
-
}
|
148 |
-
}
|
149 |
-
}
|
150 |
-
return (true);
|
151 |
-
} else {
|
152 |
-
return (false);
|
153 |
-
}
|
154 |
-
}
|
155 |
-
|
156 |
-
this.setup_for_uk = function() {
|
157 |
-
// check if we need to do anything
|
158 |
-
if ('uk' != this.current_setup) {
|
159 |
-
// do the magic for UK
|
160 |
-
if (this.mw_opc) {
|
161 |
-
// add result box
|
162 |
-
if (!$(this.prefix+'_cp_result_display')) {
|
163 |
-
var tmp_html = '<li class="'+this.li_class+'" style="display: none"><div class="widthfull"><div class="field"><label> </label><div class="input-box" id="'+this.prefix+'_cp_result_display"> </div></div></div></li>';
|
164 |
-
$(this.fields.postcode_id).up('li').insert( {after: tmp_html} );
|
165 |
-
}
|
166 |
-
} else {
|
167 |
-
// move postcode to the uk position after the country li
|
168 |
-
$(this.fields.country_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
|
169 |
-
// add result box
|
170 |
-
if (!$(this.prefix+'_cp_result_display')) {
|
171 |
-
var tmp_html = '<li class="'+this.li_class+'" style="display: none"><label> </label><div class="input-box" id="'+this.prefix+'_cp_result_display"> </div></li>';
|
172 |
-
$(this.fields.postcode_id).up('li').insert( {after: tmp_html} );
|
173 |
-
}
|
174 |
-
}
|
175 |
-
// show result box
|
176 |
-
$(this.prefix+"_cp_result_display").up('li').show();
|
177 |
-
// add button
|
178 |
-
if (!$(this.prefix+'_cp_button_div_id')) {
|
179 |
-
var tmp_html = '';
|
180 |
-
if (0 == this.div_depth) {
|
181 |
-
tmp_html = '<div class="input-box" id="'+this.prefix+'_cp_button_div_id"><label style="width:5px" for="'+this.prefix+'_cp_button_id"> </label>';
|
182 |
-
} else {
|
183 |
-
tmp_html = '<div class="field" id="'+this.prefix+'_cp_button_div_id"><label style="width:5px" for="'+this.prefix+'_cp_button_id"> </label><div class="input-box">';
|
184 |
-
}
|
185 |
-
if ('' != _cp_button_image) {
|
186 |
-
tmp_html += '<img style="cursor: pointer;" src="'+_cp_button_image+'" id="'+this.prefix+'_cp_button_id" class="'+_cp_button_class+'" title="'+_cp_button_text+'"/>';
|
187 |
-
} else {
|
188 |
-
tmp_html += '<button type="button" id="'+this.prefix+'_cp_button_id" class="'+_cp_button_class+'"><span><span>'+_cp_button_text+'</span></span></button>';
|
189 |
-
}
|
190 |
-
if (0 == this.div_depth) {
|
191 |
-
tmp_html += '</div>';
|
192 |
-
} else {
|
193 |
-
tmp_html += '</div></div>';
|
194 |
-
}
|
195 |
-
$(this.fields.postcode_id).up('div', this.div_depth).insert( {after : tmp_html} );
|
196 |
-
$(this.prefix+"_cp_button_id").observe('click', this.button_clicked.bindAsEventListener(this));
|
197 |
-
}
|
198 |
-
|
199 |
-
// shrink postcode field if needed
|
200 |
-
if ('' != this.uk_postcode_width) {
|
201 |
-
this.old_postcode_width = $(this.fields.postcode_id).getStyle("width");
|
202 |
-
$(this.fields.postcode_id).setStyle({width: this.uk_postcode_width});
|
203 |
-
}
|
204 |
-
|
205 |
-
// black magic against new magento template
|
206 |
-
|
207 |
-
if(_cp_button_fixposition){
|
208 |
-
// button is below the input box. Set the bounding LI element relative
|
209 |
-
$(this.prefix+'_cp_button_div_id').up('li').setStyle({position:'relative'});
|
210 |
-
// set the button's div to absolute. (0,0 is the li's 0,0)
|
211 |
-
// set the button's div to be on same distance on Y axis as the input box & input box width + 10 px extra on the X axis.
|
212 |
-
$(this.prefix+'_cp_button_div_id').setStyle({position:'absolute', top: "0px", left: parseInt($(this.fields.postcode_id).getStyle('width')) + 10 + "px"});
|
213 |
-
}
|
214 |
-
// show button
|
215 |
-
$(this.prefix+"_cp_button_div_id").show();
|
216 |
-
|
217 |
-
// hide county if requested (and if it exists in the html at all)
|
218 |
-
if (_cp_hide_county) {
|
219 |
-
ne = $(this.fields.county_id);
|
220 |
-
if (ne) {
|
221 |
-
ne.up('div', this.div_depth).hide();
|
222 |
-
}
|
223 |
-
}
|
224 |
-
}
|
225 |
-
|
226 |
-
if ('initial' == this.current_setup && _cp_hide_fields) {
|
227 |
-
// first time and default to UK, hide address fields
|
228 |
-
$$('.'+this.prefix+'_cp_address_class').invoke('hide');
|
229 |
-
}
|
230 |
-
|
231 |
-
// set state
|
232 |
-
this.current_setup = 'uk';
|
233 |
-
}
|
234 |
-
|
235 |
-
this.setup_for_non_uk = function() {
|
236 |
-
// check if we need to do anything
|
237 |
-
if ('non_uk' != this.current_setup) {
|
238 |
-
// hide result box (if it exist already)
|
239 |
-
if ($(this.prefix+"_cp_result_display")) {
|
240 |
-
this.cp_obj.update_res(null);
|
241 |
-
$(this.prefix+"_cp_result_display").up('li').hide();
|
242 |
-
}
|
243 |
-
// hide button (if it exist already)
|
244 |
-
if ($(this.prefix+"_cp_button_div_id")) {
|
245 |
-
$(this.prefix+"_cp_button_div_id").hide();
|
246 |
-
}
|
247 |
-
if (!this.mw_opc) {
|
248 |
-
// move postcode to the non-uk position after the town/county li
|
249 |
-
$(this.fields.town_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
|
250 |
-
}
|
251 |
-
// restore postcode field width if needed
|
252 |
-
if ('' != this.old_postcode_width) {
|
253 |
-
$(this.fields.postcode_id).setStyle({width: this.old_postcode_width});
|
254 |
-
}
|
255 |
-
// show county if it was hidden (and exists in the html at all)
|
256 |
-
if (_cp_hide_county) {
|
257 |
-
ne = $(this.fields.county_id);
|
258 |
-
if (ne) {
|
259 |
-
ne.up('div', this.div_depth).show();
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
// show all other addres lines
|
264 |
-
$$('.'+this.prefix+'_cp_address_class').invoke('show');
|
265 |
-
// set state
|
266 |
-
this.current_setup = 'non_uk';
|
267 |
-
}
|
268 |
-
}
|
269 |
-
|
270 |
-
this.add_lookup = function(setup) {
|
271 |
-
cp_obj = CraftyPostcodeCreate();
|
272 |
-
this.cp_obj = cp_obj;
|
273 |
-
// config
|
274 |
-
this.prefix = setup.prefix;
|
275 |
-
this.fields = setup.fields;
|
276 |
-
cp_obj.set("access_token", _cp_token_fe);
|
277 |
-
cp_obj.set("res_autoselect", "0");
|
278 |
-
cp_obj.set("result_elem_id", this.prefix+"_cp_result_display");
|
279 |
-
cp_obj.set("form", "");
|
280 |
-
if ($(this.fields.company_id)) cp_obj.set("elem_company" , this.fields.company_id); // company field exists, use it
|
281 |
-
else cp_obj.set("elem_company" , this.fields.street1_id); // no company field, put company names on 1st line of address
|
282 |
-
cp_obj.set("elem_street1" , this.fields.street1_id);
|
283 |
-
cp_obj.set("elem_street2" , this.fields.street2_id);
|
284 |
-
cp_obj.set("elem_street3" , this.fields.street3_id);
|
285 |
-
cp_obj.set("elem_town" , this.fields.town_id);
|
286 |
-
if (_cp_hide_county) {
|
287 |
-
cp_obj.set("elem_county" , ""); // optional
|
288 |
-
} else {
|
289 |
-
cp_obj.set("elem_county" , this.fields.county_id); // optional
|
290 |
-
}
|
291 |
-
cp_obj.set("elem_postcode" , this.fields.postcode_id);
|
292 |
-
cp_obj.set("single_res_autoselect" , 1); // don't show a drop down box if only one matching address is found
|
293 |
-
cp_obj.set("max_width" , _cp_result_box_width);
|
294 |
-
if (1 < _cp_result_box_height) {
|
295 |
-
cp_obj.set("first_res_line", "");
|
296 |
-
cp_obj.set("max_lines" , _cp_result_box_height);
|
297 |
-
} else {
|
298 |
-
cp_obj.set("first_res_line", "----- please select your address ----");
|
299 |
-
cp_obj.set("max_lines" , 1);
|
300 |
-
}
|
301 |
-
cp_obj.set("busy_img_url" , _cp_busy_img_url);
|
302 |
-
cp_obj.set("hide_result" , _cp_clear_result);
|
303 |
-
cp_obj.set("traditional_county" , 1);
|
304 |
-
cp_obj.set("on_result_ready", this.result_ready.bindAsEventListener(this));
|
305 |
-
cp_obj.set("on_result_selected", this.result_selected.bindAsEventListener(this));
|
306 |
-
cp_obj.set("on_error", this.result_error.bindAsEventListener(this));
|
307 |
-
cp_obj.set("first_res_line", _cp_1st_res_line);
|
308 |
-
cp_obj.set("err_msg1", _cp_err_msg1);
|
309 |
-
cp_obj.set("err_msg2", _cp_err_msg2);
|
310 |
-
cp_obj.set("err_msg3", _cp_err_msg3);
|
311 |
-
cp_obj.set("err_msg4", _cp_err_msg4);
|
312 |
-
// initial page setup
|
313 |
-
this.set_div_depth();
|
314 |
-
if (this.rearrange_fields()) {
|
315 |
-
if (_cp_enable_for_uk_only) {
|
316 |
-
this.country_changed();
|
317 |
-
$(this.fields.country_id).observe('change', this.country_changed.bindAsEventListener(this));
|
318 |
-
} else {
|
319 |
-
this.setup_for_uk();
|
320 |
-
}
|
321 |
-
} else {
|
322 |
-
// alert ('Postcode Lookup could not be added!');
|
323 |
-
}
|
324 |
-
}
|
325 |
-
|
326 |
-
this.country_changed = function(e) {
|
327 |
-
// show postcode lookup for:
|
328 |
-
// "GB" UK
|
329 |
-
// "JE" Jersey
|
330 |
-
// "GG" Guernsey
|
331 |
-
// "IM" Isle of Man
|
332 |
-
var curr_country = $(this.fields.country_id).getValue();
|
333 |
-
if ('GB' == curr_country || 'JE' == curr_country || 'GG' == curr_country || 'IM' == curr_country) {
|
334 |
-
this.setup_for_uk();
|
335 |
-
} else {
|
336 |
-
this.setup_for_non_uk();
|
337 |
-
}
|
338 |
-
}
|
339 |
-
|
340 |
-
this.button_clicked = function(e) {
|
341 |
-
if ('' != _cp_error_class) $(this.prefix+'_cp_result_display').removeClassName(_cp_error_class);
|
342 |
-
this.cp_obj.doLookup();
|
343 |
-
}
|
344 |
-
|
345 |
-
this.result_ready = function() {
|
346 |
-
}
|
347 |
-
|
348 |
-
this.result_selected = function() {
|
349 |
-
if (_cp_clear_result) this.cp_obj.update_res(null);
|
350 |
-
$$('.'+this.prefix+'_cp_address_class').invoke('show');
|
351 |
-
|
352 |
-
switch($(this.fields.postcode_id).getValue().substring(0,2)){
|
353 |
-
case "GY":
|
354 |
-
$(this.fields.country_id).setValue("GG");
|
355 |
-
break;
|
356 |
-
case "JE":
|
357 |
-
$(this.fields.country_id).setValue("JE");
|
358 |
-
break;
|
359 |
-
case "IM":
|
360 |
-
$(this.fields.country_id).setValue("IM");
|
361 |
-
break;
|
362 |
-
case default:
|
363 |
-
$(this.fields.country_id).setValue("GB");
|
364 |
-
break;
|
365 |
-
}
|
366 |
-
}
|
367 |
-
|
368 |
-
this.result_error = function() {
|
369 |
-
$$('.'+this.prefix+'_cp_address_class').invoke('show');
|
370 |
-
if ('' != _cp_error_class) $(this.prefix+'_cp_result_display').addClassName(_cp_error_class);
|
371 |
-
}
|
372 |
-
}
|
373 |
-
|
374 |
-
document.observe("dom:loaded", function() {
|
375 |
-
|
376 |
-
if (!_cp_integrate) return;
|
377 |
-
|
378 |
-
if ($("billing:postcode")) {
|
379 |
-
var cc1 = new CraftyClicksMagentoClass();
|
380 |
-
cc1.add_lookup({
|
381 |
-
"prefix" : "billing",
|
382 |
-
"fields" : { "postcode_id" : "billing:postcode",
|
383 |
-
"company_id" : "billing:company",
|
384 |
-
"street1_id" : "billing:street1",
|
385 |
-
"street2_id" : "billing:street2",
|
386 |
-
"street3_id" : "billing:street3",
|
387 |
-
"street4_id" : "billing:street4",
|
388 |
-
"town_id" : "billing:city",
|
389 |
-
"county_id" : "billing:region",
|
390 |
-
"country_id" : "billing:country_id",
|
391 |
-
"email_id" : "billing:email",
|
392 |
-
"telephone_id": "billing:telephone" }
|
393 |
-
});
|
394 |
-
}
|
395 |
-
|
396 |
-
if ($("shipping:postcode")) {
|
397 |
-
var cc2 = new CraftyClicksMagentoClass();
|
398 |
-
cc2.add_lookup({
|
399 |
-
"prefix" : "shipping",
|
400 |
-
"fields" : { "postcode_id" : "shipping:postcode",
|
401 |
-
"company_id" : "shipping:company",
|
402 |
-
"street1_id" : "shipping:street1",
|
403 |
-
"street2_id" : "shipping:street2",
|
404 |
-
"street3_id" : "shipping:street3",
|
405 |
-
"street4_id" : "shipping:street4",
|
406 |
-
"town_id" : "shipping:city",
|
407 |
-
"county_id" : "shipping:region",
|
408 |
-
"country_id" : "shipping:country_id",
|
409 |
-
"email_id" : "shipping:email",
|
410 |
-
"telephone_id": "shipping:telephone" }
|
411 |
-
});
|
412 |
-
}
|
413 |
-
|
414 |
-
if ($("zip")) {
|
415 |
-
var cc3 = new CraftyClicksMagentoClass();
|
416 |
-
cc3.add_lookup({
|
417 |
-
"prefix" : "",
|
418 |
-
"fields" : { "postcode_id" : "zip",
|
419 |
-
"company_id" : "company",
|
420 |
-
"street1_id" : "street_1",
|
421 |
-
"street2_id" : "street_2",
|
422 |
-
"street3_id" : "street_3",
|
423 |
-
"street4_id" : "street_4",
|
424 |
-
"town_id" : "city",
|
425 |
-
"county_id" : "region",
|
426 |
-
"country_id" : "country",
|
427 |
-
"email_id" : "email_address",
|
428 |
-
"telephone_id": "telephone" }
|
429 |
-
});
|
430 |
-
}
|
431 |
-
|
432 |
-
// preload the busy img
|
433 |
-
if ('' != _cp_busy_img_url) {
|
434 |
-
var image = new Image();
|
435 |
-
image.src = _cp_busy_img_url;
|
436 |
-
}
|
437 |
-
});
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -107,8 +107,8 @@ function CraftyClicksMagentoClass () {
|
|
107 |
$(fields.street1_id).up('td').insert({after: $(this.fields.postcode_id).up('td')});
|
108 |
$$('label[for="'+fields.street1_id+'"]')[0].up('td').insert({after: $$('label[for="'+this.fields.postcode_id+'"]')[0].up('td')});
|
109 |
|
110 |
-
$(fields.town_id).up('tr').insert({
|
111 |
-
$(fields.town_id).up('tr').insert({
|
112 |
|
113 |
$(this.fields.street1_id).up('td').wrap(new Element('tr'));
|
114 |
$$('label[for="'+this.fields.street1_id+'"]')[0].up('td').wrap(new Element('tr'));
|
107 |
$(fields.street1_id).up('td').insert({after: $(this.fields.postcode_id).up('td')});
|
108 |
$$('label[for="'+fields.street1_id+'"]')[0].up('td').insert({after: $$('label[for="'+this.fields.postcode_id+'"]')[0].up('td')});
|
109 |
|
110 |
+
$($$('label[for="'+this.fields.town_id+'"]')[0]).up('tr').insert({before: $$('label[for="'+this.fields.street1_id+'"]')[0].up('td')});
|
111 |
+
$($$('label[for="'+this.fields.town_id+'"]')[0]).up('tr').insert({before: $(this.fields.street1_id).up('td')});
|
112 |
|
113 |
$(this.fields.street1_id).up('td').wrap(new Element('tr'));
|
114 |
$$('label[for="'+this.fields.street1_id+'"]')[0].up('td').wrap(new Element('tr'));
|
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>UK_Postcode_Address_Finder</name>
|
4 |
-
<version>2.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -15,6 +15,10 @@ UK address entry is greatly speeded up thus improving the user experience. The b
|
|
15 |

|
16 |
The extension is free to try and install, but to go live a paid up account with Crafty Clicks will be required. For current prices please go to http://www.craftyclicks.co.uk/paf-database-pricing</description>
|
17 |
<notes>Release History
|
|
|
|
|
|
|
|
|
18 |
v2.5.3
|
19 |
* Fixed extra js include for wp & ecommerceteam checkouts
|
20 |
* Added support for Unicode Systems' Express Checkout
|
@@ -150,9 +154,9 @@ v 1.1.0 
|
|
150 |

|
151 |
v 1.0.0 - Initial Release</notes>
|
152 |
<authors><author><name>Crafty Clicks</name><user>styloa</user><email>support@craftyclicks.co.uk</email></author></authors>
|
153 |
-
<date>2015-03-
|
154 |
-
<time>
|
155 |
-
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="Clicktoaddress"><dir name="Helper"><file name="Data.php" hash="a561b9307d3a038e91d32c232820f54d"/></dir><dir name="data"><dir name="craftyclicks_clicktoaddress_setup"><file name="data-upgrade-2.4.9-2.5.0.php" hash="580589f5aff53b041773886008b23743"/></dir></dir><dir name="etc"><file name="config.xml" hash="
|
156 |
<compatible/>
|
157 |
<dependencies><required><php><min>4.0.0</min><max>6.0.0</max></php></required></dependencies>
|
158 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>UK_Postcode_Address_Finder</name>
|
4 |
+
<version>2.5.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
15 |

|
16 |
The extension is free to try and install, but to go live a paid up account with Crafty Clicks will be required. For current prices please go to http://www.craftyclicks.co.uk/paf-database-pricing</description>
|
17 |
<notes>Release History
|
18 |
+
v2.5.4
|
19 |
+
* Added support for AheadWorks shipping selection, with the help of Protolicious.
|
20 |
+
* Added support for IWD's shipping selection.
|
21 |
+

|
22 |
v2.5.3
|
23 |
* Fixed extra js include for wp & ecommerceteam checkouts
|
24 |
* Added support for Unicode Systems' Express Checkout
|
154 |

|
155 |
v 1.0.0 - Initial Release</notes>
|
156 |
<authors><author><name>Crafty Clicks</name><user>styloa</user><email>support@craftyclicks.co.uk</email></author></authors>
|
157 |
+
<date>2015-03-31</date>
|
158 |
+
<time>14:55:32</time>
|
159 |
+
<contents><target name="mage"><dir name="app"><dir name="code"><dir name="community"><dir name="Craftyclicks"><dir name="Clicktoaddress"><dir name="Helper"><file name="Data.php" hash="a561b9307d3a038e91d32c232820f54d"/></dir><dir name="data"><dir name="craftyclicks_clicktoaddress_setup"><file name="data-upgrade-2.4.9-2.5.0.php" hash="580589f5aff53b041773886008b23743"/></dir></dir><dir name="etc"><file name="config.xml" hash="972e59722f77d8a12ffbe795d497d897"/><file name="config.xml~" hash="972e59722f77d8a12ffbe795d497d897"/><file name="system.xml" hash="9ab78f3e038966c6c147932367a3586b"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Craftyclicks_Clicktoaddress.xml" hash="66e9933c58e73eaebf95266ea67b11bc"/><file name="CraftyClicks.xml" hash="34ceb62bbcd46b57947d369bf58737a1"/></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="craftyclicks_clicktoaddress.xml" hash="76a352b24809cb433f0dfe0beadb4144"/></dir><dir name="template"><dir name="craftyclicks"><dir name="clicktoaddress"><file name="common_config.phtml" hash="105cfbd98b0da641df4c182b5a1930b1"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir><dir name="layout"><file name="craftyclicks_clicktoaddress.xml" hash="eb137a167c971b7e57f771d6fbbe05c8"/></dir></dir><dir name="template"><dir name="craftyclicks"><dir name="clicktoaddress"><file name="common_config.phtml" hash="f5790f5c764684d79d4a0a9fa1d23344"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="craftyclicks"><dir name="clicktoaddress"><file name="crafty_postcode.class.js" hash="44593e9ea50fbfb6a6a35760b878331f"/><file name="craftyclicks_aheadworks_onestepcheckout.js" hash="c66e4c0335ff61a2c242e066669894b8"/><file name="craftyclicks_aitoc_checkout.js" hash="e4e1128e97c78545afe5a2b176c3865c"/><file name="craftyclicks_amesty_onepagecheckout.js" hash="9b1040089d3e4fbfcac15474c959b46a"/><file name="craftyclicks_ath_oscheckout.js" hash="5b1bf7b4b52750c3495ed028ababad2b"/><file name="craftyclicks_awesome_checkout.js" hash="3acb3da5f1fa843046076fb1c8f4b9cf"/><file name="craftyclicks_ecomm_easycheckout.js" hash="dfa623bd3ec54f5680c9da6a01825142"/><file name="craftyclicks_gomage_lightcheckout.js" hash="1c6f9d930a3d946508bda2bd54b8f93b"/><file name="craftyclicks_iwd_onestepcheckout.js" hash="4134989d3d606a052f62e8f2cf304c0c"/><file name="craftyclicks_iwd_onestepcheckout_v2_2.js" hash="9136e7fe5c10175dcf157fe1656c6ff3"/><file name="craftyclicks_magento.js" hash="e37d09979e449bc98bb99b2e99895a5d"/><file name="craftyclicks_magento_admin.js" hash="84a831a251d80e5b4ba6513431a4c98d"/><file name="craftyclicks_onepagecheckout.js" hash="d0cfccf16beb7586b4eba73edeb0fd58"/><file name="craftyclicks_opcheckout.js" hash="9973cdeef653347b6b45d89f8ff9bd55"/><file name="craftyclicks_tm_firecheckout.js" hash="f3173c46c6d131c2021172919adcba3b"/><file name="craftyclicks_vinagentocheckout.js" hash="1157f50866b78fdecaf948e3f07d23b0"/><file name="craftyclicks_webandpeople_onepagecheckout.js" hash="7c319da4b6889fbe75ba8c5abfb503ec"/></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="craftyclicks"><dir name="clicktoaddress"><file name="button_find_address.gif" hash="0fdef9bf7ad0f7ec3f6530b7ff40bf59"/><file name="crafty_postcode_busy.gif" hash="618a14f4dca4f51100cd2400e7f9049c"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
160 |
<compatible/>
|
161 |
<dependencies><required><php><min>4.0.0</min><max>6.0.0</max></php></required></dependencies>
|
162 |
</package>
|