UK_Postcode_Address_Finder - Version 2.4.5

Version Notes

Release History
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

Download this release

Release Info

Developer Magento Core Team
Extension UK_Postcode_Address_Finder
Version 2.4.5
Comparing to
See all releases


Code changes from version 2.4.4 to 2.4.5

app/code/local/CraftyClicks/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
<config>
13
<modules>
14
<CraftyClicks>
15
- <version>2.4.3</version>
16
</CraftyClicks>
17
</modules>
18
12
<config>
13
<modules>
14
<CraftyClicks>
15
+ <version>2.4.5</version>
16
</CraftyClicks>
17
</modules>
18
app/design/frontend/base/default/layout/craftyclicks.xml CHANGED
@@ -4,7 +4,7 @@
4
* Crafty Clicks Postcode Lookup
5
*
6
* @category Extension
7
- * @copyright Copyright (c) 2009-2012 Crafty Clicks (http://www.craftyclicks.com)
8
* @author Crafty Clicks
9
*/
10
-->
@@ -119,4 +119,13 @@
119
<block type="page/html" name="craftyclicks_config" template="craftyclicks/common_config.phtml"/>
120
</reference>
121
</aw_onestepcheckout_index_index>
122
</layout>
4
* Crafty Clicks Postcode Lookup
5
*
6
* @category Extension
7
+ * @copyright Copyright (c) 2009-2013 Crafty Clicks (http://www.craftyclicks.com)
8
* @author Crafty Clicks
9
*/
10
-->
119
<block type="page/html" name="craftyclicks_config" template="craftyclicks/common_config.phtml"/>
120
</reference>
121
</aw_onestepcheckout_index_index>
122
+
123
+ <firecheckout_index_index>
124
+ <!-- Tempates Master FireCheckout - http://www.magentocommerce.com/magento-connect/fire-checkout-ultimate-one-page-checkout.html -->
125
+ <reference name="head">
126
+ <action method="addJs"><script>craftyclicks/crafty_postcode.class.js</script></action>
127
+ <action method="addJs"><script>craftyclicks/craftyclicks_tm_firecheckout.js</script></action>
128
+ <block type="page/html" name="craftyclicks_config" template="craftyclicks/common_config.phtml"/>
129
+ </reference>
130
+ </firecheckout_index_index>
131
</layout>
app/design/frontend/base/default/template/craftyclicks/common_config.phtml CHANGED
@@ -49,10 +49,10 @@ if (1 == $conf['craftyclicks']['active']) {
49
$js_config.= " var _cp_error_class = '';";
50
}
51
52
- if (array_key_exists('move_fields',$conf['craftyclicks']) && '' != $conf['craftyclicks']['move_fields']) {
53
- $js_config.= " var _cp_move_fields = '".$conf['craftyclicks']['move_fields']."';";
54
} else {
55
- $js_config.= " var _cp_move_fields = 'false';";
56
}
57
58
} else { //if (1 == $conf['craftyclicks']['active']) {
49
$js_config.= " var _cp_error_class = '';";
50
}
51
52
+ if (array_key_exists('move_fields',$conf['craftyclicks']) && $conf['craftyclicks']['move_fields']) {
53
+ $js_config.= " var _cp_move_fields = true;";
54
} else {
55
+ $js_config.= " var _cp_move_fields = false;";
56
}
57
58
} else { //if (1 == $conf['craftyclicks']['active']) {
app/etc/modules/CraftyClicks.xml CHANGED
@@ -4,7 +4,7 @@
4
<CraftyClicks>
5
<active>true</active>
6
<codePool>local</codePool>
7
- <version>2.4.3</version>
8
</CraftyClicks>
9
</modules>
10
</config>
4
<CraftyClicks>
5
<active>true</active>
6
<codePool>local</codePool>
7
+ <version>2.4.5</version>
8
</CraftyClicks>
9
</modules>
10
</config>
js/craftyclicks/craftyclicks_gomage_lightcheckout.js CHANGED
@@ -101,8 +101,10 @@ function CraftyClicksMagentoClass () {
101
// check if we need to do anything
102
if ('uk' != this.current_setup) {
103
// do the magic for UK
104
- // move postcode to the uk position after the country li
105
- $(this.fields.country_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
106
// add result box
107
if (!$(this.prefix+'_cp_result_display')) {
108
var tmp_html = '<li class="'+this.li_class+'" style="display: none"><div class="input-box" id="'+this.prefix+'_cp_result_display">&nbsp;</div></li>';
@@ -170,11 +172,13 @@ function CraftyClicksMagentoClass () {
170
if ($(this.prefix+"_cp_button_div_id")) {
171
$(this.prefix+"_cp_button_div_id").hide();
172
}
173
- // move postcode to the non-uk position after the town/county li
174
- if ($(this.fields.county_id)) {
175
- $(this.fields.county_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
176
- } else if ($(this.fields.town_id)) {
177
- $(this.fields.town_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
178
}
179
// restore postcode field width if needed
180
if ('' != this.old_postcode_width) {
@@ -239,7 +243,7 @@ function CraftyClicksMagentoClass () {
239
// initial page setup
240
this.set_div_depth();
241
if (this.rearrange_fields()) {
242
- if (_cp_enable_for_uk_only) {
243
this.country_changed();
244
$(this.fields.country_id).observe('change', this.country_changed.bindAsEventListener(this));
245
} else {
101
// check if we need to do anything
102
if ('uk' != this.current_setup) {
103
// do the magic for UK
104
+ if ($(this.fields.country_id)) {
105
+ // move postcode to the uk position after the country li
106
+ $(this.fields.country_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
107
+ }
108
// add result box
109
if (!$(this.prefix+'_cp_result_display')) {
110
var tmp_html = '<li class="'+this.li_class+'" style="display: none"><div class="input-box" id="'+this.prefix+'_cp_result_display">&nbsp;</div></li>';
172
if ($(this.prefix+"_cp_button_div_id")) {
173
$(this.prefix+"_cp_button_div_id").hide();
174
}
175
+ if ($(this.fields.country_id)) {
176
+ // move postcode to the non-uk position after the town/county li
177
+ if ($(this.fields.county_id)) {
178
+ $(this.fields.county_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
179
+ } else if ($(this.fields.town_id)) {
180
+ $(this.fields.town_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
181
+ }
182
}
183
// restore postcode field width if needed
184
if ('' != this.old_postcode_width) {
243
// initial page setup
244
this.set_div_depth();
245
if (this.rearrange_fields()) {
246
+ if ($(this.fields.country_id) && _cp_enable_for_uk_only) {
247
this.country_changed();
248
$(this.fields.country_id).observe('change', this.country_changed.bindAsEventListener(this));
249
} else {
js/craftyclicks/craftyclicks_onepagecheckout.js CHANGED
@@ -9,9 +9,6 @@
9
// Magestore OneStepCheckout (www.magestore.com)
10
// http://www.magentocommerce.com/magento-connect/one-step-checkout-4908.html
11
//
12
- // Tempates Master FireCheckout (templates-master.com)
13
- // http://www.magentocommerce.com/magento-connect/fire-checkout-ultimate-one-page-checkout.html
14
- //
15
// Provided by www.CraftyClicks.co.uk
16
//
17
// Requires standard CraftyClicks JS - tested with v4.9.1
@@ -67,27 +64,27 @@ function CraftyClicksMagentoClass () {
67
_cp_hide_fields = false;
68
}
69
70
- if (_cp_move_fields) {
71
- // postcode could be bundled with county/state or with town in the same li on the OSC templates
72
- if ($(fields.county_id) && $(fields.county_id).up('li') == $(fields.postcode_id).up('li')) {
73
- // create a new li to hold the county on its own and put it after the town
74
- if ($(fields.town_id)) {
75
- $(fields.town_id).up('li').insert( {after: '<li class="'+this.li_class+'" id="'+this.prefix+'_county_placeholder_id"></li>'} );
76
- $(this.prefix+"_county_placeholder_id").insert( $(fields.county_id).up('div', this.div_depth) );
77
- }
78
- } else if ($(fields.town_id) && $(fields.town_id).up('li') == $(fields.postcode_id).up('li')) {
79
- // create a new li to hold the town on its own and put it after the postcode for now
80
- $(fields.postcode_id).up('li').insert( {after: '<li class="'+this.li_class+'" id="'+this.prefix+'_county_placeholder_id"></li>'} );
81
- $(this.prefix+"_county_placeholder_id").insert( $(fields.town_id).up('div', this.div_depth) );
82
- // we probably have the state/county field sitting with the country - separate
83
- if ($(fields.county_id) && $(fields.county_id).up('li') == $(fields.country_id).up('li')) {
84
- // put county with the town
85
- $(fields.town_id).up('div', this.div_depth).insert( {after: $(fields.county_id).up('div', this.div_depth)} );
86
- }
87
- // and now move country to the top
88
- $(fields.street1_id).up('li').insert( {before: $(fields.country_id).up('li')} );
89
- }
90
- }
91
92
if ($(fields.company_id)) {
93
$(fields.company_id).up('li').addClassName(this.prefix+'_cp_address_class');
@@ -121,16 +118,16 @@ function CraftyClicksMagentoClass () {
121
// check if we need to do anything
122
if ('uk' != this.current_setup) {
123
// do the magic for UK
124
- if (_cp_move_fields) {
125
- // move postcode to the uk position after the country li
126
- if ('hidden' != $(this.fields.country_id).readAttribute('type')) {
127
- $(this.fields.country_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
128
- }
129
- }
130
// add result box
131
if (!$(this.prefix+'_cp_result_display')) {
132
var tmp_html = '<li class="'+this.li_class+'" style="display: none"><div class="input-box input-country" id="'+this.prefix+'_cp_result_display">&nbsp;</div></li>';
133
- // var tmp_html = '<li class="'+this.li_class+'" style="display: none"><div class="one-field" id="'+this.prefix+'_cp_result_display">&nbsp;</div></li>';
134
$(this.fields.postcode_id).up('li').insert( {after: tmp_html} );
135
}
136
// show result box
@@ -195,13 +192,13 @@ function CraftyClicksMagentoClass () {
195
if ($(this.prefix+"_cp_button_div_id")) {
196
$(this.prefix+"_cp_button_div_id").hide();
197
}
198
- if (_cp_move_fields) {
199
- // move postcode to the non-uk position after the town/county li
200
- if ($(this.fields.county_id)) {
201
- $(this.fields.county_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
202
- } else if ($(this.fields.town_id)) {
203
- $(this.fields.town_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
204
- }
205
}
206
// restore postcode field width if needed
207
if ('' != this.old_postcode_width) {
@@ -266,7 +263,7 @@ function CraftyClicksMagentoClass () {
266
// initial page setup
267
this.set_div_depth();
268
if (this.rearrange_fields()) {
269
- if (_cp_enable_for_uk_only && 'hidden' != $(this.fields.country_id).readAttribute('type')) {
270
this.country_changed();
271
$(this.fields.country_id).observe('change', this.country_changed.bindAsEventListener(this));
272
} else {
9
// Magestore OneStepCheckout (www.magestore.com)
10
// http://www.magentocommerce.com/magento-connect/one-step-checkout-4908.html
11
//
12
// Provided by www.CraftyClicks.co.uk
13
//
14
// Requires standard CraftyClicks JS - tested with v4.9.1
64
_cp_hide_fields = false;
65
}
66
67
+ if (_cp_move_fields) {
68
+ // postcode could be bundled with county/state or with town in the same li on the OSC templates
69
+ if ($(fields.county_id) && $(fields.county_id).up('li') == $(fields.postcode_id).up('li')) {
70
+ // create a new li to hold the county on its own and put it after the town
71
+ if ($(fields.town_id)) {
72
+ $(fields.town_id).up('li').insert( {after: '<li class="'+this.li_class+'" id="'+this.prefix+'_county_placeholder_id"></li>'} );
73
+ $(this.prefix+"_county_placeholder_id").insert( $(fields.county_id).up('div', this.div_depth) );
74
+ }
75
+ } else if ($(fields.town_id) && $(fields.town_id).up('li') == $(fields.postcode_id).up('li')) {
76
+ // create a new li to hold the town on its own and put it after the postcode for now
77
+ $(fields.postcode_id).up('li').insert( {after: '<li class="'+this.li_class+'" id="'+this.prefix+'_county_placeholder_id"></li>'} );
78
+ $(this.prefix+"_county_placeholder_id").insert( $(fields.town_id).up('div', this.div_depth) );
79
+ // we probably have the state/county field sitting with the country - separate
80
+ if ($(fields.county_id) && $(fields.county_id).up('li') == $(fields.country_id).up('li')) {
81
+ // put county with the town
82
+ $(fields.town_id).up('div', this.div_depth).insert( {after: $(fields.county_id).up('div', this.div_depth)} );
83
+ }
84
+ // and now move country to the top
85
+ $(fields.street1_id).up('li').insert( {before: $(fields.country_id).up('li')} );
86
+ }
87
+ }
88
89
if ($(fields.company_id)) {
90
$(fields.company_id).up('li').addClassName(this.prefix+'_cp_address_class');
118
// check if we need to do anything
119
if ('uk' != this.current_setup) {
120
// do the magic for UK
121
+ if (_cp_move_fields) {
122
+ // move postcode to the uk position after the country li
123
+ if ('hidden' != $(this.fields.country_id).readAttribute('type')) {
124
+ $(this.fields.country_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
125
+ }
126
+ }
127
// add result box
128
if (!$(this.prefix+'_cp_result_display')) {
129
var tmp_html = '<li class="'+this.li_class+'" style="display: none"><div class="input-box input-country" id="'+this.prefix+'_cp_result_display">&nbsp;</div></li>';
130
+ // var tmp_html = '<li class="'+this.li_class+'" style="display: none"><div class="one-field" id="'+this.prefix+'_cp_result_display">&nbsp;</div></li>';
131
$(this.fields.postcode_id).up('li').insert( {after: tmp_html} );
132
}
133
// show result box
192
if ($(this.prefix+"_cp_button_div_id")) {
193
$(this.prefix+"_cp_button_div_id").hide();
194
}
195
+ if (_cp_move_fields) {
196
+ // move postcode to the non-uk position after the town/county li
197
+ if ($(this.fields.county_id)) {
198
+ $(this.fields.county_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
199
+ } else if ($(this.fields.town_id)) {
200
+ $(this.fields.town_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
201
+ }
202
}
203
// restore postcode field width if needed
204
if ('' != this.old_postcode_width) {
263
// initial page setup
264
this.set_div_depth();
265
if (this.rearrange_fields()) {
266
+ if (_cp_enable_for_uk_only && 'hidden' != $(this.fields.country_id).readAttribute('type')) {
267
this.country_changed();
268
$(this.fields.country_id).observe('change', this.country_changed.bindAsEventListener(this));
269
} else {
js/craftyclicks/craftyclicks_tm_firecheckout.js ADDED
@@ -0,0 +1,309 @@
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
+ // checkout extensions :
5
+ //
6
+ // Tempates Master FireCheckout (templates-master.com)
7
+ // http://www.magentocommerce.com/magento-connect/fire-checkout-ultimate-one-page-checkout.html
8
+ //
9
+ // Provided by www.CraftyClicks.co.uk
10
+ //
11
+ // Requires standard CraftyClicks JS - tested with v4.9.1
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
+ };
36
+
37
+ this.current_setup = 'initial'; // can be 'uk' or 'non_uk'
38
+ this.uk_postcode_width = ''
39
+ this.old_postcode_width = '';
40
+ this.cp_obj = 0;
41
+ this.div_depth = 0;
42
+ this.li_class = "wide";
43
+
44
+ this.rearrange_fields = function() {
45
+ var fields = this.fields;
46
+
47
+ // check we have a postcode field
48
+ if ($(fields.postcode_id)) {
49
+ if ('' != $(fields.town_id).getValue()) {
50
+ _cp_hide_fields = false;
51
+ }
52
+
53
+ if ($(fields.company_id)) {
54
+ $(fields.company_id).up('li').addClassName(this.prefix+'_cp_address_class');
55
+ }
56
+ if ($(fields.street1_id)) {
57
+ $(fields.street1_id).up('li').addClassName(this.prefix+'_cp_address_class');
58
+ }
59
+ if ($(fields.street2_id)) {
60
+ $(fields.street2_id).up('li').addClassName(this.prefix+'_cp_address_class');
61
+ }
62
+ if ($(fields.street3_id)) {
63
+ $(fields.street3_id).up('li').addClassName(this.prefix+'_cp_address_class');
64
+ }
65
+ if ($(fields.street4_id)) {
66
+ $(fields.street4_id).up('li').addClassName(this.prefix+'_cp_address_class');
67
+ }
68
+ if ($(fields.town_id)) {
69
+ $(fields.town_id).up('li').addClassName(this.prefix+'_cp_address_class');
70
+ }
71
+ if ($(fields.county_id)) {
72
+ $(fields.county_id).up('li').addClassName(this.prefix+'_cp_address_class');
73
+ }
74
+
75
+ return (true);
76
+ } else {
77
+ return (false);
78
+ }
79
+ }
80
+
81
+ this.setup_for_uk = function() {
82
+ // check if we need to do anything
83
+ if ('uk' != this.current_setup) {
84
+ // do the magic for UK
85
+ if (_cp_move_fields) {
86
+ // move postcode to the uk position after the country li
87
+ if ('hidden' != $(this.fields.country_id).readAttribute('type')) {
88
+ $(this.fields.country_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
89
+ }
90
+ }
91
+ // add result box
92
+ if (!$(this.prefix+'_cp_result_display')) {
93
+ var tmp_html = '<li class="wide" style="display: none"><div class="input-box" id="'+this.prefix+'_cp_result_display">&nbsp;</div></li>';
94
+ $(this.fields.postcode_id).up('li').insert( {after: tmp_html} );
95
+ $(this.fields.postcode_id).up('li').removeClassName('wide');
96
+ $(this.fields.postcode_id).up('li').addClassName('fields');
97
+ }
98
+ // show result box
99
+ $(this.prefix+"_cp_result_display").up('li').show();
100
+ // add button
101
+ if (!$(this.prefix+'_cp_button_div_id')) {
102
+ var tmp_html = '';
103
+ // check that postcode is wrapped up in two layers of div
104
+ if (!$(this.fields.postcode_id).up('div', 1).descendantOf($(this.fields.postcode_id).up('li'))) {
105
+ var newel = new Element('div', {'class': 'field'}).update($(this.fields.postcode_id).up('li').innerHTML);
106
+ $(this.fields.postcode_id).up('li').update(newel);
107
+ }
108
+
109
+ tmp_html = '<div class="field" id="'+this.prefix+'_cp_button_div_id"><label style="width:5px" for="'+this.prefix+'_cp_button_id">&nbsp;</label><div class="input-box">';
110
+ if ('' != _cp_button_image) {
111
+ tmp_html += '<img style="cursor: pointer;" src="'+_cp_button_image+'" id="'+this.prefix+'_cp_button_id" class="'+_cp_button_class+'" title="'+_cp_button_text+'"/>';
112
+ } else {
113
+ tmp_html += '<button type="button" id="'+this.prefix+'_cp_button_id" class="'+_cp_button_class+'"><span><span>'+_cp_button_text+'</span></span></button>';
114
+ }
115
+ tmp_html += '</div></div>';
116
+ $(this.fields.postcode_id).up('div', 1).insert( {after : tmp_html} );
117
+ $(this.prefix+"_cp_button_id").observe('click', this.button_clicked.bindAsEventListener(this));
118
+ }
119
+ // show button
120
+ $(this.prefix+"_cp_button_div_id").show();
121
+
122
+ // shrink postcode field if needed
123
+ if ('' != this.uk_postcode_width) {
124
+ this.old_postcode_width = $(this.fields.postcode_id).getStyle("width");
125
+ $(this.fields.postcode_id).setStyle({width: this.uk_postcode_width});
126
+ }
127
+
128
+ // hide county if requested (and if it exists in the html at all)
129
+ if (_cp_hide_county) {
130
+ ne = $(this.fields.county_id);
131
+ if (ne) {
132
+ ne.up('div').hide();
133
+ }
134
+ }
135
+ }
136
+
137
+ if ('initial' == this.current_setup && _cp_hide_fields) {
138
+ // first time and default to UK, hide address fields
139
+ $('.'+this.prefix+'_cp_address_class').invoke('hide');
140
+ }
141
+
142
+ // set state
143
+ this.current_setup = 'uk';
144
+ }
145
+
146
+ this.setup_for_non_uk = function() {
147
+ // check if we need to do anything
148
+ if ('non_uk' != this.current_setup) {
149
+ // hide result box (if it exist already)
150
+ if ($(this.prefix+"_cp_result_display")) {
151
+ this.cp_obj.update_res(null);
152
+ $(this.prefix+"_cp_result_display").up('li').hide();
153
+ }
154
+ // hide button (if it exist already)
155
+ if ($(this.prefix+"_cp_button_div_id")) {
156
+ $(this.prefix+"_cp_button_div_id").hide();
157
+ }
158
+ if (_cp_move_fields) {
159
+ // move postcode to the non-uk position after the town/county li
160
+ if ($(this.fields.county_id)) {
161
+ $(this.fields.county_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
162
+ } else if ($(this.fields.town_id)) {
163
+ $(this.fields.town_id).up('li').insert( {after: $(this.fields.postcode_id).up('li')} );
164
+ }
165
+ }
166
+ // restore postcode field width if needed
167
+ if ('' != this.old_postcode_width) {
168
+ $(this.fields.postcode_id).setStyle({width: this.old_postcode_width});
169
+ }
170
+ // show county if it was hidden (and exists in the html at all)
171
+ if (_cp_hide_county) {
172
+ ne = $(this.fields.county_id);
173
+ if (ne) {
174
+ ne.up('div').show();
175
+ }
176
+ }
177
+
178
+ // show all other addres lines
179
+ $('.'+this.prefix+'_cp_address_class').invoke('show');
180
+ // set state
181
+ this.current_setup = 'non_uk';
182
+ }
183
+ }
184
+
185
+ this.add_lookup = function(setup) {
186
+ cp_obj = CraftyPostcodeCreate();
187
+ this.cp_obj = cp_obj;
188
+ // config
189
+ this.prefix = setup.prefix;
190
+ this.fields = setup.fields;
191
+ cp_obj.set("access_token", _cp_token_fe);
192
+ cp_obj.set("res_autoselect", "0");
193
+ cp_obj.set("result_elem_id", this.prefix+"_cp_result_display");
194
+ cp_obj.set("form", "");
195
+ cp_obj.set("elem_company" , this.fields.company_id); // optional
196
+ cp_obj.set("elem_street1" , this.fields.street1_id);
197
+ cp_obj.set("elem_street2" , this.fields.street2_id);
198
+ cp_obj.set("elem_street3" , this.fields.street3_id);
199
+ cp_obj.set("elem_town" , this.fields.town_id);
200
+ if (_cp_hide_county) {
201
+ cp_obj.set("elem_county" , ""); // optional
202
+ } else {
203
+ cp_obj.set("elem_county" , this.fields.county_id); // optional
204
+ }
205
+ cp_obj.set("elem_postcode" , this.fields.postcode_id);
206
+ cp_obj.set("single_res_autoselect" , 1); // don't show a drop down box if only one matching address is found
207
+ cp_obj.set("max_width" , _cp_result_box_width);
208
+ if (1 < _cp_result_box_height) {
209
+ cp_obj.set("first_res_line", "");
210
+ cp_obj.set("max_lines" , _cp_result_box_height);
211
+ } else {
212
+ cp_obj.set("first_res_line", "----- please select your address ----");
213
+ cp_obj.set("max_lines" , 1);
214
+ }
215
+ cp_obj.set("busy_img_url" , _cp_busy_img_url);
216
+ cp_obj.set("hide_result" , _cp_clear_result);
217
+ cp_obj.set("traditional_county" , 1);
218
+ cp_obj.set("on_result_ready", this.result_ready.bindAsEventListener(this));
219
+ cp_obj.set("on_result_selected", this.result_selected.bindAsEventListener(this));
220
+ cp_obj.set("on_error", this.result_error.bindAsEventListener(this));
221
+ cp_obj.set("first_res_line", _cp_1st_res_line);
222
+ cp_obj.set("err_msg1", _cp_err_msg1);
223
+ cp_obj.set("err_msg2", _cp_err_msg2);
224
+ cp_obj.set("err_msg3", _cp_err_msg3);
225
+ cp_obj.set("err_msg4", _cp_err_msg4);
226
+ // initial page setup
227
+ if (this.rearrange_fields()) {
228
+ if (_cp_enable_for_uk_only && 'hidden' != $(this.fields.country_id).readAttribute('type')) {
229
+ this.country_changed();
230
+ $(this.fields.country_id).observe('change', this.country_changed.bindAsEventListener(this));
231
+ } else {
232
+ this.setup_for_uk();
233
+ }
234
+ } else {
235
+ // alert ('Postcode Lookup could not be added!');
236
+ }
237
+ }
238
+
239
+ this.country_changed = function(e) {
240
+ // show postcode lookup for:
241
+ // "GB" UK
242
+ // "JE" Jersey
243
+ // "GG" Guernsey
244
+ // "IM" Isle of Man
245
+ var curr_country = $(this.fields.country_id).getValue();
246
+ if ('GB' == curr_country || 'JE' == curr_country || 'GG' == curr_country || 'IM' == curr_country) {
247
+ this.setup_for_uk();
248
+ } else {
249
+ this.setup_for_non_uk();
250
+ }
251
+ }
252
+
253
+ this.button_clicked = function(e) {
254
+ if ('' != _cp_error_class) $(this.prefix+'_cp_result_display').removeClassName(_cp_error_class);
255
+ this.cp_obj.doLookup();
256
+ }
257
+
258
+ this.result_ready = function() {
259
+ $('.'+this.prefix+'_cp_address_class').invoke('show');
260
+ }
261
+
262
+ this.result_selected = function() {
263
+ if (_cp_clear_result) this.cp_obj.update_res(null);
264
+ }
265
+
266
+ this.result_error = function() {
267
+ $('.'+this.prefix+'_cp_address_class').invoke('show');
268
+ if ('' != _cp_error_class) $(this.prefix+'_cp_result_display').addClassName(_cp_error_class);
269
+ }
270
+ }
271
+
272
+ document.observe("dom:loaded", function() {
273
+
274
+ if (!_cp_integrate) return;
275
+
276
+ if ($("billing:postcode")) {
277
+ var cc1 = new CraftyClicksMagentoClass();
278
+ cc1.add_lookup({
279
+ "prefix" : "billing",
280
+ "fields" : { "postcode_id" : "billing:postcode",
281
+ "company_id" : "billing:company",
282
+ "street1_id" : "billing:street1",
283
+ "street2_id" : "billing:street2",
284
+ "street3_id" : "billing:street3",
285
+ "street4_id" : "billing:street4",
286
+ "town_id" : "billing:city",
287
+ "county_id" : "billing:region",
288
+ "country_id" : "billing:country_id" }
289
+ });
290
+ }
291
+
292
+ if ($("shipping:postcode")) {
293
+ var cc2 = new CraftyClicksMagentoClass();
294
+ cc2.add_lookup({
295
+ "prefix" : "shipping",
296
+ "fields" : { "postcode_id" : "shipping:postcode",
297
+ "company_id" : "shipping:company",
298
+ "street1_id" : "shipping:street1",
299
+ "street2_id" : "shipping:street2",
300
+ "street3_id" : "shipping:street3",
301
+ "street4_id" : "shipping:street4",
302
+ "town_id" : "shipping:city",
303
+ "county_id" : "shipping:region",
304
+ "country_id" : "shipping:country_id" }
305
+ });
306
+ }
307
+
308
+ });
309
+
package.xml CHANGED
@@ -1,7 +1,7 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>UK_Postcode_Address_Finder</name>
4
- <version>2.4.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,6 +15,9 @@ UK address entry is greatly speeded up thus improving the user experience. The b
15
&#xD;
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 &#xD;
18
v2.4.4&#xD;
19
* update support for Templates Master Firecheckout&#xD;
20
* test and mark as Magento 1.8 compatible&#xD;
@@ -117,9 +120,9 @@ v 1.1.0 &#xD;
117
&#xD;
118
v 1.0.0 - Initial Release</notes>
119
<authors><author><name>Crafty Clicks</name><user>auto-converted</user><email>support@craftyclicks.co.uk</email></author></authors>
120
- <date>2013-10-11</date>
121
- <time>17:02:37</time>
122
- <contents><target name="mage"><dir name="app"><dir name="code"><dir name="local"><dir name="CraftyClicks"><dir name="Helper"><file name="Data.php" hash="e5f75947ad629aabb2e3cbcde412e2cc"/></dir><dir name="etc"><file name="config.xml" hash="afad8500a6a3191f7b923ced7dae1d70"/><file name="config.xml~" hash="899a2ba8e56a4040aa16f164e34afc48"/><file name="system.xml" hash="4d59155995bbeef1f8056a4b5f24cab1"/><file name="system.xml~" hash="dcde0b35d40eac36790d7180675de55d"/></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="CraftyClicks.xml" hash="a67641987f005f4651a8cdf764454334"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="craftyclicks"><file name="common_config.phtml" hash="5a9ebbf859f53cd0ea44f54e4abf51e8"/><file name="common_config.phtml~" hash="11c42a7f0366225407a2a6a883cf2e1a"/></dir></dir><dir name="layout"><file name="craftyclicks.xml" hash="dd6d8026d40a30011010df8363e22fd7"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="craftyclicks.xml" hash="dad3bdf940efdc974b86784da78fe822"/></dir><dir name="template"><dir name="craftyclicks"><file name="common_config.phtml" hash="e1bb4493d4c35f46a1d3cfe60d503d97"/></dir></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="craftyclicks"><file name="crafty_mage_onepage.js~" hash="70e8f88943a3fbf69747bb91327ca4a4"/><file name="crafty_postcode.class.js" hash="44593e9ea50fbfb6a6a35760b878331f"/><file name="craftyclicks_aheadworks_onestepcheckout.js" hash="06427c8acf5fdf405c4e95d37c301205"/><file name="craftyclicks_ath_oscheckout.js" hash="50f8f84903bb2e89195d1161bff6c0ac"/><file name="craftyclicks_ecomm_easycheckout.js" hash="4663cfd160a135e9a85756050f52c5f5"/><file name="craftyclicks_gomage_lightcheckout.js" hash="cd1f53eb75cc60e0e14512d2a6424394"/><file name="craftyclicks_iwd_onestepcheckout.js" hash="28ebdefad4e7d5f8a2a0b5bfc3b425e1"/><file name="craftyclicks_magento.js" hash="4623a021c53a0ae94655d6e6f1f66673"/><file name="craftyclicks_magento.js~" hash="47dc15c554e7e767bfe1dfba723e5f50"/><file name="craftyclicks_magento_admin.js" hash="83aa04c1a46c9d0db0d56c8c5439c85f"/><file name="craftyclicks_magento_multiship.js~" hash="6793b51960f5cbf2a4eef2b2293e6c9c"/><file name="craftyclicks_onepagecheckout.js" hash="2e17e7d0aedbb914bf742afb8bc57008"/><file name="craftyclicks_vinagentocheckout.js" hash="0e2aae082fe6474184ecfe90e983ca66"/><file name="craftyclicks_webandpeople_onepagecheckout.js" hash="ef63d952fced1577e75a3446418eb478"/></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="craftyclicks"><file name="button_find_address.gif" hash="0fdef9bf7ad0f7ec3f6530b7ff40bf59"/><file name="crafty_postcode_busy.gif" hash="618a14f4dca4f51100cd2400e7f9049c"/></dir></dir></dir></dir></dir></dir></target></contents>
123
<compatible/>
124
<dependencies/>
125
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>UK_Postcode_Address_Finder</name>
4
+ <version>2.4.5</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
&#xD;
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 &#xD;
18
+ v2.4.5&#xD;
19
+ * fix packaging issue with v2.4.4, no changes.&#xD;
20
+ &#xD;
21
v2.4.4&#xD;
22
* update support for Templates Master Firecheckout&#xD;
23
* test and mark as Magento 1.8 compatible&#xD;
120
&#xD;
121
v 1.0.0 - Initial Release</notes>
122
<authors><author><name>Crafty Clicks</name><user>auto-converted</user><email>support@craftyclicks.co.uk</email></author></authors>
123
+ <date>2013-10-14</date>
124
+ <time>14:04:33</time>
125
+ <contents><target name="mage"><dir name="app"><dir name="code"><dir name="local"><dir name="CraftyClicks"><dir name="Helper"><file name="Data.php" hash="e5f75947ad629aabb2e3cbcde412e2cc"/></dir><dir name="etc"><file name="config.xml" hash="8b9ebb016b837afc216c3af27daffb7f"/><file name="config.xml~" hash="899a2ba8e56a4040aa16f164e34afc48"/><file name="system.xml" hash="4d59155995bbeef1f8056a4b5f24cab1"/><file name="system.xml~" hash="dcde0b35d40eac36790d7180675de55d"/></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="CraftyClicks.xml" hash="64fc8c4a15bc3ee1e1d45911199a3b01"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="craftyclicks"><file name="common_config.phtml" hash="3d132fde56e2f849a9b4128f9b1437fe"/><file name="common_config.phtml~" hash="11c42a7f0366225407a2a6a883cf2e1a"/></dir></dir><dir name="layout"><file name="craftyclicks.xml" hash="564e0fc7c3800c85e51e6cbdd1f33413"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="craftyclicks.xml" hash="dad3bdf940efdc974b86784da78fe822"/></dir><dir name="template"><dir name="craftyclicks"><file name="common_config.phtml" hash="e1bb4493d4c35f46a1d3cfe60d503d97"/></dir></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="craftyclicks"><file name="crafty_mage_onepage.js~" hash="70e8f88943a3fbf69747bb91327ca4a4"/><file name="crafty_postcode.class.js" hash="44593e9ea50fbfb6a6a35760b878331f"/><file name="craftyclicks_aheadworks_onestepcheckout.js" hash="06427c8acf5fdf405c4e95d37c301205"/><file name="craftyclicks_ath_oscheckout.js" hash="50f8f84903bb2e89195d1161bff6c0ac"/><file name="craftyclicks_ecomm_easycheckout.js" hash="4663cfd160a135e9a85756050f52c5f5"/><file name="craftyclicks_gomage_lightcheckout.js" hash="64954821816280d7855cb642b7012dd4"/><file name="craftyclicks_iwd_onestepcheckout.js" hash="28ebdefad4e7d5f8a2a0b5bfc3b425e1"/><file name="craftyclicks_magento.js" hash="4623a021c53a0ae94655d6e6f1f66673"/><file name="craftyclicks_magento.js~" hash="47dc15c554e7e767bfe1dfba723e5f50"/><file name="craftyclicks_magento_admin.js" hash="83aa04c1a46c9d0db0d56c8c5439c85f"/><file name="craftyclicks_magento_multiship.js~" hash="6793b51960f5cbf2a4eef2b2293e6c9c"/><file name="craftyclicks_onepagecheckout.js" hash="92acad18a8b7b40b6151db7c8ea99f47"/><file name="craftyclicks_tm_firecheckout.js" hash="4c0fdcf7f04a704cee0997221bee7fc1"/><file name="craftyclicks_vinagentocheckout.js" hash="0e2aae082fe6474184ecfe90e983ca66"/><file name="craftyclicks_webandpeople_onepagecheckout.js" hash="ef63d952fced1577e75a3446418eb478"/></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="craftyclicks"><file name="button_find_address.gif" hash="0fdef9bf7ad0f7ec3f6530b7ff40bf59"/><file name="crafty_postcode_busy.gif" hash="618a14f4dca4f51100cd2400e7f9049c"/></dir></dir></dir></dir></dir></dir></target></contents>
126
<compatible/>
127
<dependencies/>
128
</package>