PostcodeNl_Api - Version 1.0.6.1

Version Notes

Changes:
- Improved support for non-standard/non-default templates
- Fixed bug when switching from non-NL country to non-NL country
- Improved Billing to Shipping synchronization
- Added support for `Apptha One Page Checkout`
- Added support for `Ecommerce Three-Step Checkout`
- Fixed issue where not all templates were added in 1.0.6.0 release

Download this release

Release Info

Developer Magento Core Team
Extension PostcodeNl_Api
Version 1.0.6.1
Comparing to
See all releases


Code changes from version 1.0.6.0 to 1.0.6.1

app/code/community/PostcodeNl/Api/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <PostcodeNl_Api>
5
- <version>1.0.6.0</version>
6
  </PostcodeNl_Api>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <PostcodeNl_Api>
5
+ <version>1.0.6.1</version>
6
  </PostcodeNl_Api>
7
  </modules>
8
  <frontend>
app/design/frontend/base/default/layout/postcodenl/api/lookup.xml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <!-- Regular Magento Checkout, and other checkout modules which use the same page -->
4
+ <checkout_onepage_index>
5
+ <reference name="head">
6
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
7
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
8
+ </reference>
9
+ <reference name="content">
10
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
11
+ </reference>
12
+ </checkout_onepage_index>
13
+ <customer_address_form>
14
+ <reference name="head">
15
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
16
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
17
+ </reference>
18
+ <reference name="content">
19
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
20
+ </reference>
21
+ </customer_address_form>
22
+ <checkout_multishipping_register>
23
+ <reference name="head">
24
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
25
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
26
+ </reference>
27
+ <reference name="content">
28
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
29
+ </reference>
30
+ </checkout_multishipping_register>
31
+ <checkout_multishipping_address_newshipping>
32
+ <reference name="head">
33
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
34
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
35
+ </reference>
36
+ <reference name="content">
37
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
38
+ </reference>
39
+ </checkout_multishipping_address_newshipping>
40
+ <checkout_multishipping_address_editshipping>
41
+ <reference name="head">
42
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
43
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
44
+ </reference>
45
+ <reference name="content">
46
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
47
+ </reference>
48
+ </checkout_multishipping_address_editshipping>
49
+ <checkout_multishipping_address_editbilling>
50
+ <reference name="head">
51
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
52
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
53
+ </reference>
54
+ <reference name="content">
55
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
56
+ </reference>
57
+ </checkout_multishipping_address_editbilling>
58
+ <!-- Used for `OneStepCheckout(.com)`, but also for `MageStore One Step Checkout` and `Apptha One Step Checkout` -->
59
+ <onestepcheckout_index_index>
60
+ <reference name="head">
61
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
62
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
63
+ </reference>
64
+ <reference name="content">
65
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
66
+ </reference>
67
+ </onestepcheckout_index_index>
68
+ <!-- For `GoMage LightCheckout` -->
69
+ <gomage_checkout_onepage_index>
70
+ <reference name="head">
71
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
72
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
73
+ </reference>
74
+ <reference name="content">
75
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
76
+ </reference>
77
+ </gomage_checkout_onepage_index>
78
+ <!-- For `Fire Checkout` -->
79
+ <firecheckout_onepage_index>
80
+ <reference name="head">
81
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
82
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
83
+ </reference>
84
+ <reference name="content">
85
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
86
+ </reference>
87
+ </firecheckout_onepage_index>
88
+ <!-- For `FME One Step Checkout` -->
89
+ <checkout_onestep_index>
90
+ <reference name="head">
91
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
92
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
93
+ </reference>
94
+ <reference name="content">
95
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
96
+ </reference>
97
+ </checkout_onestep_index>
98
+ <!-- For `IWD Free One Page / Step Checkout` -->
99
+ <onepagecheckout_index_index>
100
+ <reference name="head">
101
+ <action method="addCss" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/css/lookup.css</script></action>
102
+ <action method="addJs" ifconfig="postcodenl/config/enabled"><script>postcodenl/api/lookup.js</script></action>
103
+ </reference>
104
+ <reference name="content">
105
+ <block type="postcodenl/jsinit" name="postcodenl.jsinit" template="postcodenl/api/jsinit.phtml" />
106
+ </reference>
107
+ </onepagecheckout_index_index>
108
+ </layout>
app/locale/nl_NL/PostcodeNl_Api.csv DELETED
@@ -1,27 +0,0 @@
1
- "Unknown postcode + housenumber combination.","Onbekende postcode + huisnummer combinatie."
2
- "Housenumber addition `{addition}` is unknown.","Huisnummer toevoeging `{addition}` is onbekend."
3
- "Housenumber addition required.","Huisnummer toevoeging vereist."
4
- "Invalid postcode format, use `1234AB` format.","Onbekend postcode formaat, gebruik het `1234AB` formaat."
5
- "Validation error, please use manual input.","Validatie fout, gebruik de handmatige invoer."
6
- "Validation unavailable, please use manual input.","Validatie onbereikbaar, gebruik de handmatige invoer."
7
- "Cannot connect to Postcode.nl API: Server is missing SSL (https) support for CURL.","Kan geen connectie maken naar Postcode.nl API: Server mist SSL (https) ondersteuning voor CURL."
8
- "Postcode","Postcode"
9
- "Postcode (auto-validating)","Postcode (automatisch validerend)"
10
- "Housenumber","Huisnummer"
11
- "Houseno addition","Huisnr toevoeging"
12
- "Housenumber addition","Huisnummer toevoeging"
13
- "Select...","Selecteer..."
14
- "No addition.","Geen toevoeging."
15
- "`No addition`","Toch geen toevoeging"
16
- "`{addition}`","`{addition}`"
17
- "Housenumber (with any additions)","Huisnummer (met toevoeging)"
18
- "Postcode.nl API not configured.","Postcode.nl API niet configureerd."
19
- "Postcode.nl API not enabled.","Postcode.nl API niet ingeschakeld."
20
- "- disabled -","- uitgeschakeld -"
21
- "Address validation","Adresvalidatie"
22
- "Fill out your postcode and housenumber to auto-complete your address. You can also manually set your address information.","Vul uw postcode en huisnummer in en uw adres wordt automatisch en foutloos aangevuld. Handmatig invullen kan natuurlijk ook."
23
- "Manual input","Handmatige invoer"
24
- "Fill out address information manually","Handmatig adres invullen"
25
- "Validated address","Gevalideerd adres"
26
- "API Showcase","API Showcase"
27
- "API Debug Info","API Debug Info"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/postcodenl/api/lookup.js DELETED
@@ -1,974 +0,0 @@
1
- document.observe("dom:loaded", function()
2
- {
3
- // If we have no configuration, do not do anything
4
- if (typeof PCNLAPI_CONFIG == 'undefined')
5
- return;
6
-
7
- if (typeof String.prototype.trim !== 'function')
8
- {
9
- String.prototype.trim = function()
10
- {
11
- return this.replace(/^\s+|\s+$/g, '');
12
- }
13
- }
14
-
15
- var PostcodeNl_Api = {
16
- /**
17
- * Cache requests to improve multiple identical requests (billing / shipping, etc)
18
- */
19
- requestCache: {},
20
-
21
- /**
22
- * Hide multiple field-rows in forms
23
- */
24
- hideFields: function (fields)
25
- {
26
- fields.each(function (fieldId)
27
- {
28
- if ($(fieldId))
29
- {
30
- if ($(fieldId).up('div.two_fields'))
31
- {
32
- // For `IWD Free One Page / Step Checkout`
33
- $(fieldId).up('div.two_fields').addClassName('pcnl-hidden-field');
34
- }
35
- else if ($(fieldId).up('div.full'))
36
- {
37
- // For `IWD Free One Page / Step Checkout`
38
- $(fieldId).up('div.full').addClassName('pcnl-hidden-field');
39
- }
40
- else if ($(fieldId).up('li'))
41
- {
42
- $(fieldId).up('li').addClassName('pcnl-hidden-field');
43
- }
44
- else if ($(fieldId).up('tr'))
45
- {
46
- $(fieldId).up('tr').addClassName('pcnl-hidden-field');
47
- }
48
- }
49
- });
50
- },
51
-
52
- /**
53
- * Un-hide multiple field-rows in forms
54
- */
55
- showFields: function (fields)
56
- {
57
- fields.each(function (fieldId)
58
- {
59
- if ($(fieldId))
60
- {
61
- if ($(fieldId).up('div.two_fields'))
62
- {
63
- // For `IWD Free One Page / Step Checkout`
64
- $(fieldId).up('div.two_fields').removeClassName('pcnl-hidden-field');
65
- }
66
- else if ($(fieldId).up('div.full'))
67
- {
68
- // For `IWD Free One Page / Step Checkout`
69
- $(fieldId).up('div.full').removeClassName('pcnl-hidden-field');
70
- }
71
- else if ($(fieldId).up('li'))
72
- {
73
- $(fieldId).up('li').removeClassName('pcnl-hidden-field');
74
- }
75
- else if ($(fieldId).up('tr'))
76
- {
77
- $(fieldId).up('tr').removeClassName('pcnl-hidden-field');
78
- }
79
- }
80
- });
81
- },
82
-
83
- /**
84
- * Remove all validation messages
85
- */
86
- removeValidationMessages: function (prefix)
87
- {
88
- var advice = Validation.getAdvice('invalid-postcode', $(prefix +'postcode_housenumber'));
89
- if (advice)
90
- {
91
- Validation.hideAdvice($(prefix +'postcode_housenumber'), advice, 'invalid-postcode');
92
- }
93
- var advice = Validation.getAdvice('invalid-postcode', $(prefix +'postcode_input'));
94
- if (advice)
95
- {
96
- Validation.hideAdvice($(prefix +'postcode_input'), advice, 'invalid-postcode');
97
- }
98
- if ($(prefix +'postcode_housenumber_addition'))
99
- {
100
- var additionAdvice = Validation.getAdvice('invalid-addition', $(prefix +'postcode_housenumber_addition'));
101
- if (additionAdvice)
102
- {
103
- Validation.hideAdvice($(prefix +'postcode_housenumber_addition'), additionAdvice, 'invalid-addition');
104
- }
105
- }
106
- },
107
-
108
- /**
109
- * Remove housenumber addition selectbox, and any related elements / classes.
110
- */
111
- removeHousenumberAddition: function (prefix)
112
- {
113
- if ($(prefix +'postcode_housenumber_addition'))
114
- {
115
- Element.remove($(prefix +'postcode_housenumber_addition'));
116
- if ($(prefix +'postcode_housenumber_addition:wrapper'))
117
- {
118
- Element.remove($(prefix +'postcode_housenumber_addition:wrapper'));
119
- }
120
- if ($(prefix + 'postcode_housenumber').up('li'))
121
- {
122
- $(prefix + 'postcode_housenumber').up('li').removeClassName('pcnl-with-addition');
123
- }
124
- }
125
- },
126
-
127
- /**
128
- * Get HTML format for info. (used in Showcode / Debug)
129
- */
130
- getFieldListHtml: function (data, className)
131
- {
132
- var toType = function(obj) {
133
- return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase();
134
- }
135
-
136
- var html = '';
137
- if (toType(data) == 'object' ) {
138
-
139
- if (className) {
140
- html = '<dl class="'+ String(className).escapeHTML() +'">';
141
- } else {
142
- html = '<dl>';
143
- }
144
-
145
- for (var prop in data)
146
- {
147
- var name = prop.charAt(0).toUpperCase() + prop.slice(1);
148
- if (prop == 'modules') {
149
- html += '<dt>'+ name.escapeHTML() +'</dt><dd>';
150
- for (var moduleName in data[prop]) {
151
- html += String(moduleName +'-'+ data[prop][moduleName].codePool + (data[prop][moduleName].version != undefined ? '-' + data[prop][moduleName].version : '') + (data[prop][moduleName].active ? '' : ' (inactive)')).escapeHTML() +'<br />';
152
- }
153
- html += '</dd>';
154
- }
155
- else {
156
- html += '<dt>'+ name.escapeHTML() +'</dt><dd>'+ this.getFieldListHtml(data[prop]) +'</dd>';
157
- }
158
- }
159
- html += '</dl>';
160
- } else {
161
- html = String(data === null ? '- none -' : data).escapeHTML();
162
- }
163
- return html;
164
- },
165
-
166
-
167
- /**
168
- * Toggle 'readonly' on multiple fields. Sets class, attribute.
169
- */
170
- setFieldsReadonly: function (fields, readonly)
171
- {
172
- fields.each(function (fieldId)
173
- {
174
- if ($(fieldId))
175
- {
176
- if (readonly)
177
- {
178
- if ($(fieldId).nodeName == 'SELECT')
179
- {
180
- $(fieldId).disabled = true;
181
- }
182
- else
183
- {
184
- $(fieldId).setAttribute('readonly', true);
185
- }
186
- $(fieldId).addClassName('pcnl-readonly');
187
- if ($(fieldId).hasClassName('required-entry'))
188
- {
189
- $(fieldId).removeClassName('required-entry');
190
- $(fieldId).addClassName('pcnl-disabled-required-entry');
191
- }
192
- }
193
- else
194
- {
195
- if ($(fieldId).nodeName == 'SELECT')
196
- {
197
- $(fieldId).disabled = false;
198
- }
199
- else
200
- {
201
- $(fieldId).removeAttribute('readonly');
202
- }
203
- $(fieldId).removeClassName('pcnl-readonly');
204
- if ($(fieldId).hasClassName('pcnl-disabled-required-entry'))
205
- {
206
- $(fieldId).addClassName('required-entry');
207
- $(fieldId).removeClassName('pcnl-disabled-required-entry');
208
- }
209
- }
210
- }
211
- });
212
- },
213
-
214
- /**
215
- * Look up the address for a form, validate & enrich target form.
216
- */
217
- lookupPostcode: function (prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, event)
218
- {
219
- var pcnlapi = this;
220
- if (!$(prefix + 'postcode_housenumber'))
221
- {
222
- return;
223
- }
224
-
225
- var postcode = $(prefix + 'postcode_input').getValue();
226
-
227
- postcode = postcode.replace(/\s+/, '');
228
-
229
- var housenumber_mixed = $(prefix + 'postcode_housenumber').getValue().trim();
230
- // Number, followed by non alphanumberic chars, and then additional number ("123 A", "123-rood", etc)
231
- // or: Number, followed directly by a letter and then alphanumeric/space charcters ("123b3", "123berk 23", etc)
232
- var housenumber_match = housenumber_mixed.match(/^([0-9]+)([^0-9a-zA-Z]+([0-9a-zA-Z ]+)|([a-zA-Z]([0-9a-zA-Z ]*)))?$/);
233
- var housenumber_addition_select = $(prefix +'postcode_housenumber_addition') ? $(prefix +'postcode_housenumber_addition').getValue() : null;
234
-
235
- var housenumber = housenumber_match ? housenumber_match[1].trim() : '';
236
-
237
- var housenumber_addition = '';
238
-
239
- if (!housenumber_match)
240
- housenumber_addition = '';
241
- else if (housenumber_match[3])
242
- housenumber_addition = housenumber_match[3].trim();
243
- else if (housenumber_match[4])
244
- housenumber_addition = housenumber_match[4].trim();
245
-
246
- if (housenumber_addition == '' && housenumber_addition_select != '__none__' && housenumber_addition_select != '__select__' && housenumber_addition_select != null)
247
- housenumber_addition = housenumber_addition_select;
248
-
249
- if ($(prefix + countryFieldId).getValue() != 'NL' || postcode == '' || housenumber_mixed == '')
250
- return;
251
-
252
- // Make uppercase to prevent double, but identical, requests
253
- postcode = postcode.toUpperCase();
254
-
255
- var url = PCNLAPI_CONFIG.baseUrl +'lookup?postcode=' + postcode + '&houseNumber=' + housenumber + '&houseNumberAddition=' + housenumber_addition;
256
- if (typeof this.requestCache[url] === 'undefined')
257
- {
258
- new Ajax.Request(url,
259
- {
260
- method: 'get',
261
- onException: function(transport, e)
262
- {
263
- throw e;
264
- },
265
- onComplete: function(transport)
266
- {
267
- var json = transport.responseText.evalJSON();
268
- if (!PCNLAPI_CONFIG.debug) {
269
- pcnlapi.requestCache[url] = json;
270
- }
271
- pcnlapi.updatePostcodeLookup(json, housenumber_addition, housenumber_addition_select, prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, event);
272
- }
273
- });
274
- }
275
- else
276
- {
277
- this.updatePostcodeLookup(this.requestCache[url], housenumber_addition, housenumber_addition_select, prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, event);
278
- }
279
- },
280
-
281
- /**
282
- * Update the address fields, given the validated data.
283
- */
284
- updatePostcodeLookup: function(data, housenumber_addition, housenumber_addition_select, prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, event)
285
- {
286
- if (PCNLAPI_CONFIG.showcase)
287
- {
288
- if ($(prefix +'showcase'))
289
- $(prefix +'showcase').remove();
290
-
291
- var info = this.getFieldListHtml(data.showcaseResponse, 'pcnl-showcase');
292
-
293
- var map = '';
294
- if (data.showcaseResponse.longitude && data.showcaseResponse.latitude)
295
- {
296
- map = '<iframe frameborder="0" scrolling="no" marginheight="0" marginwidth="0" class="map" src="http://maps.google.com/maps?t=h&amp;q='+ data.showcaseResponse.latitude +','+ data.showcaseResponse.longitude +'+(Location found)&amp;z=19&amp;output=embed&amp;iwloc=near"></iframe>';
297
- }
298
-
299
- if ($(prefix + countryFieldId).parentNode.tagName == 'TD')
300
- {
301
- // We're probably in the admin
302
- $(prefix + street1).up('tr').insert({before: '<tr id="' + prefix + 'showcase"><td class="label">'+ PCNLAPI_CONFIG.translations.apiShowcase.escapeHTML() +'</label></td><td class="value"><h4 class="pcnl-showcase">'+ PCNLAPI_CONFIG.translations.apiShowcase.escapeHTML() +'</h4>'+ info + '</td></tr>'});
303
- }
304
- else if ($(prefix + street1).up('div.full'))
305
- {
306
- // For `IWD Free One Page / Step Checkout`
307
- $(prefix + street1).up('div.full').insert({before: '<div id="' + prefix + 'showcase"><h4 class="pcnl-showcase">'+ PCNLAPI_CONFIG.translations.apiShowcase.escapeHTML() +'</h4>'+ info + '</div>'});
308
- }
309
- else
310
- {
311
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix +'showcase" class="wide"><div class="input-box"><h4 class="pcnl-showcase">'+ PCNLAPI_CONFIG.translations.apiShowcase.escapeHTML() +'</h4>'+ map + info + '</div></li>'});
312
- }
313
- }
314
- if (PCNLAPI_CONFIG.debug)
315
- {
316
- if ($(prefix +'debug'))
317
- $(prefix +'debug').remove();
318
-
319
- var info = this.getFieldListHtml(data.debugInfo, 'pcnl-debug');
320
-
321
- if ($(prefix + countryFieldId).parentNode.tagName == 'TD')
322
- {
323
- // We're probably in the admin
324
- $(prefix + street1).up('tr').insert({before: '<tr id="' + prefix + 'debug"><td class="label">'+ PCNLAPI_CONFIG.translations.apiDebug.escapeHTML() +'</label></td><td class="value"><h4 class="pcnl-debug">'+ PCNLAPI_CONFIG.translations.apiDebug.escapeHTML() +'</h4>'+ info + '</td></tr>'});
325
- }
326
- else if ($(prefix + street1).up('div.full'))
327
- {
328
- // For `IWD Free One Page / Step Checkout`
329
- $(prefix + street1).up('div.full').insert({before: '<div id="' + prefix +'debug" class="full"><div class="input-box"><h4 class="pcnl-debug">'+ PCNLAPI_CONFIG.translations.apiDebug.escapeHTML() +'</h4>'+ info + '</div></div>'});
330
- }
331
- else
332
- {
333
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix +'debug" class="wide"><div class="input-box"><h4 class="pcnl-debug">'+ PCNLAPI_CONFIG.translations.apiDebug.escapeHTML() +'</h4>'+ info + '</div></li>'});
334
- }
335
- }
336
-
337
- // Remove any existing error messages
338
- this.removeValidationMessages(prefix);
339
-
340
- if (data.postcode != undefined)
341
- {
342
- // Set data from request on form fields
343
- $(prefix + postcodeFieldId).setValue(data.postcode);
344
- $(prefix + 'postcode_input').setValue(data.postcode);
345
- if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2))
346
- {
347
- $(prefix + street1).setValue((data.street).trim());
348
- $(prefix + street2).setValue((data.houseNumber +' '+ (data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition)).trim());
349
- }
350
- else
351
- {
352
- $(prefix + street1).setValue((data.street +' '+ data.houseNumber +' '+ (data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition)).trim());
353
- }
354
- $(prefix +'city').setValue(data.city);
355
- if ($(prefix +'region'))
356
- {
357
- $(prefix +'region').setValue(data.province);
358
- }
359
- $(prefix +'postcode_housenumber').setValue(data.houseNumber);
360
-
361
- // Update address result text block
362
- if ($(prefix + 'postcode_output'))
363
- {
364
- this.showFields([prefix +'postcode_output']);
365
- $(prefix + 'postcode_output').update((data.street +' '+ data.houseNumber +' '+ (data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition)).trim() + "<br>" + data.postcode + " " + data.city);
366
- }
367
-
368
- // Handle all housenumber addition possiblities
369
- if (data.houseNumberAddition == null && (housenumber_addition_select == housenumber_addition || (housenumber_addition_select == '__none__' && housenumber_addition == '')))
370
- {
371
- // Selected housenumber addition is not known, and the select dropdown already contains that value
372
-
373
- var additionSelect = this.createPostcodeHouseNumberAddition(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, data.houseNumberAdditions, housenumber_addition_select);
374
-
375
- // Re-select value if it was selected through the selectbox
376
- if (event && event.element().id == prefix +'postcode_housenumber_addition')
377
- additionSelect.setValue(housenumber_addition_select);
378
-
379
- if (additionSelect.getValue() != housenumber_addition_select)
380
- {
381
- newAdvice = Validation.createAdvice('invalid-addition', $(prefix +'postcode_housenumber_addition'), false, (housenumber_addition != '' ? PCNLAPI_CONFIG.translations.houseNumberAdditionUnknown.replace('{addition}', housenumber_addition) : PCNLAPI_CONFIG.translations.houseNumberAdditionRequired));
382
- Validation.showAdvice($(prefix +'postcode_housenumber_addition'), newAdvice, 'invalid-addition');
383
- }
384
- }
385
- else if (data.houseNumberAddition == null)
386
- {
387
- // Selected housenumber addition is not known, and the select dropdown does not contain that value
388
-
389
- var additionSelect = this.createPostcodeHouseNumberAddition(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, data.houseNumberAdditions, housenumber_addition);
390
-
391
- newAdvice = Validation.createAdvice('invalid-addition', $(prefix +'postcode_housenumber_addition'), false, (housenumber_addition != '' ? PCNLAPI_CONFIG.translations.houseNumberAdditionUnknown.replace('{addition}', housenumber_addition) : PCNLAPI_CONFIG.translations.houseNumberAdditionRequired));
392
- Validation.showAdvice($(prefix +'postcode_housenumber_addition'), newAdvice, 'invalid-addition');
393
- }
394
- else if (data.houseNumberAdditions.length > 1 || (data.houseNumberAdditions.length == 1 && data.houseNumberAdditions[0] != ''))
395
- {
396
- // Address has multiple housenumber additions
397
- var additionSelect = this.createPostcodeHouseNumberAddition(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, data.houseNumberAdditions);
398
- additionSelect.setValue(data.houseNumberAddition);
399
- }
400
- else
401
- {
402
- // Address has only one valid addition, and it is the 'no addition' option
403
- this.removeHousenumberAddition(prefix);
404
- }
405
- }
406
- else if (data.message != undefined)
407
- {
408
- // Address check returned an error
409
-
410
- newAdvice = Validation.createAdvice('invalid-postcode', $(prefix + (data.messageTarget == 'postcode' ? 'postcode_input' : 'postcode_housenumber')), false, data.message);
411
- Validation.showAdvice($(prefix +'postcode_housenumber'), newAdvice, 'invalid-postcode');
412
-
413
- this.removeHousenumberAddition(prefix);
414
- }
415
- else
416
- {
417
- // Address check did not return an error or a postcode result (something else wrong)
418
-
419
- newAdvice = Validation.createAdvice('invalid-postcode', $(prefix + (data.messageTarget == 'postcode' ? 'postcode_input' : 'postcode_housenumber')), false, '');
420
- Validation.showAdvice($(prefix +'postcode_housenumber'), newAdvice, 'invalid-postcode');
421
-
422
- this.removeHousenumberAddition(prefix);
423
- }
424
-
425
- $(prefix + postcodeFieldId).fire('postcode:updated');
426
-
427
- // Add support for syncing Billing & Shipping
428
- if (prefix == 'billing:' && $('shipping:' + postcodeFieldId)) {
429
- if (typeof shipping != 'undefined') {
430
- if ($('shipping:same_as_billing') && $('shipping:same_as_billing').checked) {
431
- shipping.syncWithBilling();
432
- }
433
- }
434
- this.lookupPostcode('shipping:', postcodeFieldId, countryFieldId, street1, street2, street3, street4);
435
- }
436
- },
437
-
438
- /**
439
- * Toggle country selection for a form. Only when the Netherlands is selected, add address enrichment.
440
- */
441
- toggleCountryPostcode: function (prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4)
442
- {
443
- var pcnlapi = this;
444
- if ($(prefix + countryFieldId).getValue() == 'NL')
445
- {
446
- // The Netherlands is selected - add our own validated inputs.
447
-
448
- if (!$(prefix +'postcode_input:wrapper'))
449
- {
450
- if ($(prefix + postcodeFieldId).parentNode.tagName == 'TD')
451
- {
452
- // We're probably in the admin
453
- if (PCNLAPI_CONFIG.adminValidationDisabled)
454
- {
455
- return;
456
- }
457
-
458
- $(prefix + street1).up('tr').insert({before: '<tr id="' + prefix + 'postcode_input:wrapper"><td class="label"><label for="' + prefix + 'postcode_input">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +' <span class="required">*</span></label></td><td class="value"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></td></tr><tr id="' + prefix + 'postcode_housenumber:wrapper"><td class="label"><label for="' + prefix + 'postcode_housenumber">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +' <span class="required">*</span></label></td><td class="value"><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="billing[postcode_housenumber]" id="' + prefix + 'postcode_housenumber" value="" class="input-text pcnl-input-text-half required-entry" /></td></tr>'});
459
- $(prefix + street1).up('tr').insert({before: '<tr id="' + prefix + 'postcode_input:checkbox"><td class="label"><label for="' + prefix + 'postcode_input_checkbox"> '+ PCNLAPI_CONFIG.translations.manualInputLabel +' <span class="required">*</span></label></td><td class="value"><input type="checkbox" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox" /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></td></tr>'});
460
- $(prefix +'postcode_input_checkbox').observe('click', function () { pcnlapi.toggleCountryPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4); });
461
- }
462
- else if ($(document.body).hasClassName('onestepcheckout-index-index') && $('onestepcheckout-form'))
463
- {
464
- // Support for OneStepCheckout extension
465
-
466
- if (!$(prefix +'postcode_input:info'))
467
- {
468
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:info" class="clearfix"><div class="input-box"><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></div></li>'});
469
- }
470
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:wrapper" class="clearfix"><div class="field input-postcode"><label for="' + prefix + 'postcode_input">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +'<em class="required">*</em></label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></div></div><div class="field input-postcode pcnl-input-housenumber"><label for="' + prefix + 'postcode_housenumber">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +' <em class="required">*</em></label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="billing[postcode_housenumber]" id="' + prefix + 'postcode_housenumber" value="" class="input-text pcnl-input-text-half required-entry" /></div></div></li>'});
471
- if (!$(prefix +'postcode_input:checkbox'))
472
- {
473
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:checkbox" class="clearfix"><div class="field"><div class="input-box"><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox" /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></div></div></li>'});
474
- $(prefix +'postcode_input_checkbox').observe('click', function () { pcnlapi.toggleCountryPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4); });
475
- }
476
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:output" class="pcnl-hidden-field"><div class="input-box"><label>'+ PCNLAPI_CONFIG.translations.outputLabel +'</label><div id="' + prefix + 'postcode_output" class="pcnl-address-text"></div></div></li>'});
477
- }
478
- else if ($(document.body).hasClassName('onestepcheckout-index-index') && $('co-form'))
479
- {
480
- // Support for Apptha One Step Checkout extension
481
-
482
- if (!$(prefix +'postcode_input:info'))
483
- {
484
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:info"><div class="input-box"><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></div></li>'});
485
- }
486
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:wrapper" class="fields"><div class="pcnl-apptha-fields"><div class="field"><label for="' + prefix + 'postcode_input" class="required">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +'<em>*</em></label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></div></div>'+
487
- '<div class="field input-postcode pcnl-input-housenumber"><label for="' + prefix + 'postcode_housenumber" class="required">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +' <em>*</em></label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="billing[postcode_housenumber]" id="' + prefix + 'postcode_housenumber" value="" class="input-text pcnl-input-text-half required-entry" /></div></div></div></li>'});
488
- if (!$(prefix +'postcode_input:checkbox'))
489
- {
490
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:checkbox" class="pcnl-apptha-checkbox"><div class="field"><div class="input-box"><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox" /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></div></div></li>'});
491
- $(prefix +'postcode_input_checkbox').observe('click', function () { pcnlapi.toggleCountryPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4); });
492
- }
493
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:output" class="pcnl-hidden-field"><div class="input-box"><label>'+ PCNLAPI_CONFIG.translations.outputLabel +'</label><div id="' + prefix + 'postcode_output" class="pcnl-address-text"></div></div></li>'});
494
- }
495
- else if ($(document.body).hasClassName('onestepcheckout-index-index') && $('one-step-checkout-form'))
496
- {
497
- // Support for MageStore One Step Checkout extension
498
-
499
- if (!$(prefix +'postcode_input:info'))
500
- {
501
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:info" class="wide"><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></li>'});
502
- }
503
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:wrapper" class="input-box"><div class="input-box input-postcode"><label for="' + prefix + 'postcode_input">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +' <span class="required">*</span></label><br>'+
504
- '<input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></div>'+
505
- '<div class="input-box input-postcode pcnl-input-housenumber"><label for="' + prefix + 'postcode_housenumber">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +' <span class="required">*</span></label><br><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="billing[postcode_housenumber]" id="' + prefix + 'postcode_housenumber" value="" class="input-text pcnl-input-text-half required-entry" /></div></li>'});
506
-
507
- if (!$(prefix +'postcode_input:checkbox'))
508
- {
509
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:checkbox" class="clearfix"><div class="input-box"><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox" /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></div></li>'});
510
- $(prefix +'postcode_input_checkbox').observe('click', function () { pcnlapi.toggleCountryPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4); });
511
- }
512
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:output" class="pcnl-hidden-field"><div class="input-box"><label>'+ PCNLAPI_CONFIG.translations.outputLabel +'</label><div id="' + prefix + 'postcode_output" class="pcnl-address-text"></div></div></li>'});
513
- }
514
- else if ($(document.body).hasClassName('gomage-checkout-onepage-index'))
515
- {
516
- // Support for GoMage LightCheckout extension
517
-
518
- if (!$(prefix +'postcode_input:info'))
519
- {
520
- $(prefix + 'country_id').up('li').insert({before: '<li id="' + prefix + 'postcode_input:info" class="pcnl-info"><div class="input-box"><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></div></li>'});
521
- }
522
- $(prefix + 'country_id').up('li').insert({before: '<li id="' + prefix + 'postcode_input:wrapper" class="fields"><div class="field input-postcode"><label for="' + prefix + 'postcode_input" class="required">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +'<em class="required">*</em></label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></div></div><div class="field input-postcode pcnl-input-housenumber"><label for="' + prefix + 'postcode_housenumber" class="required">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +' <em class="required">*</em></label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="billing[postcode_housenumber]" id="' + prefix + 'postcode_housenumber" value="" class="input-text pcnl-input-text-half required-entry" /></div></div></li>'});
523
- if (!$(prefix +'postcode_input:checkbox'))
524
- {
525
- $(prefix + 'country_id').up('li').insert({before: '<li id="' + prefix + 'postcode_input:checkbox" class="pcnl-manual-checkbox"><div class="field"><div class="input-box"><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox " /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></div></div></li>'});
526
- $(prefix + 'postcode_input_checkbox').observe('click', function () { pcnlapi.toggleCountryPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4); });
527
- }
528
- $(prefix + 'country_id').up('li').insert({before: '<li id="' + prefix + 'postcode_input:output" class="pcnl-hidden-field"><div class="input-box"><label>'+ PCNLAPI_CONFIG.translations.outputLabel +'</label><div id="' + prefix + 'postcode_output" class="pcnl-address-text"></div></div></li>'});
529
- }
530
- else if ($(document.body).hasClassName('checkout-onestep-index'))
531
- {
532
- // FME One Step Checkout
533
-
534
- if (!$(prefix +'postcode_input:info'))
535
- {
536
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:info" class="pcnl-info d_3"><div class="input-box"><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></div></li>'});
537
- }
538
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:wrapper" class="d_2"><div class="input-postcode d_1"><label for="' + prefix + 'postcode_input" class="required">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +'<em class="required">*</em></label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></div></div><div class="input-postcode pcnl-input-housenumber d_4"><label for="' + prefix + 'postcode_housenumber" class="required">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +' <em class="required">*</em></label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="billing[postcode_housenumber]" id="' + prefix + 'postcode_housenumber" value="" class="input-text pcnl-input-text-half required-entry" /></div></div></li>'});
539
- if (!$(prefix +'postcode_input:checkbox'))
540
- {
541
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:checkbox" class="pcnl-manual-checkbox d_3"><div><div class="input-box"><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox " /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></div></div></li>'});
542
- $(prefix + 'postcode_input_checkbox').observe('click', function () { pcnlapi.toggleCountryPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4); });
543
- }
544
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:output" class="pcnl-hidden-field d_3"><div class="input-box"><label>'+ PCNLAPI_CONFIG.translations.outputLabel +'</label><div id="' + prefix + 'postcode_output" class="pcnl-address-text"></div></div></li>'});
545
- }
546
- else if ($(document.body).hasClassName('onepagecheckout-index-index'))
547
- {
548
- // IWD Free One Page / Step Checkout
549
-
550
- if (!$(prefix +'postcode_input:info'))
551
- {
552
- $(prefix + street1).up('div.full').insert({before: '<div id="' + prefix + 'postcode_input:info" class="full"><div><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></div></div>'});
553
- }
554
- $(prefix + street1).up('div.full').insert({before: '<div id="' + prefix + 'postcode_input:wrapper" class="two_fields"><div class="input-postcode short"><label for="' + prefix + 'postcode_input" class="required">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +'</label> <sup>*</sup><div class="data_area"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="t1 required-entry" /></div></div>' +
555
- '<div class="input-postcode pcnl-input-housenumber short"><label for="' + prefix + 'postcode_housenumber" class="required">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +'</label> <sup>*</sup><div><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="billing[postcode_housenumber]" id="' + prefix + 'postcode_housenumber" value="" class="t1 pcnl-input-text-half required-entry" /></div></div></div>'});
556
- if (!$(prefix +'postcode_input:checkbox'))
557
- {
558
- $(prefix + street1).up('div.full').insert({before: '<ul id="' + prefix + 'postcode_input:checkbox" class="pcnl-manual-checkbox"><li class="options"><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox" /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></li></ul>'});
559
- $(prefix + 'postcode_input_checkbox').observe('click', function () { pcnlapi.toggleCountryPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4); });
560
- }
561
- $(prefix + street1).up('div.full').insert({before: '<div id="' + prefix + 'postcode_input:output" class="full pcnl-hidden-field"><label>'+ PCNLAPI_CONFIG.translations.outputLabel +'</label><div class="data_area"><div id="' + prefix + 'postcode_output" class="pcnl-address-text"></div></div></div>'});
562
-
563
- // Relocate telephone field, if it exists
564
- if ($(prefix + 'telephone'))
565
- {
566
- var clone = $(prefix + 'telephone').up('div.short').clone(true);
567
- $(prefix + 'telephone').up('div.short').remove();
568
- // Move to after country selector
569
- $(prefix + countryFieldId).up('div.full').insert({after: '<div class="two_fields" id="'+prefix + 'telephone-moved"></div><div class="clr"></div>'});
570
- $(prefix + 'telephone-moved').insert(clone);
571
- }
572
- }
573
- else
574
- {
575
- // Support for regular Magento 'one page' checkout
576
- // + Fire Checkout
577
- // + Quick One Page Checkout (by KAM)
578
-
579
- if (!$(prefix +'postcode_input:info'))
580
- {
581
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:info" class="wide"><div class="input-box"><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></div></li>'});
582
- }
583
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:wrapper" class="fields"><div class="field"><label for="' + prefix + 'postcode_input" class="required"><em>*</em>'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +'</label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></div></div><div class="field"><label for="' + prefix + 'postcode_housenumber" class="required"><em>*</em>'+ PCNLAPI_CONFIG.translations.houseNumberLabel +'</label><div class="input-box"><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="billing[postcode_housenumber]" id="' + prefix + 'postcode_housenumber" value="" class="input-text pcnl-input-text-half required-entry" /></div></div></li>'});
584
- if (!$(prefix +'postcode_input:checkbox'))
585
- {
586
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:checkbox" class="wide"><div class="field"><div class="input-box"><label><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox" /> '+ PCNLAPI_CONFIG.translations.manualInputText +'</label></div></div></li>'});
587
- $(prefix +'postcode_input_checkbox').observe('click', function () { pcnlapi.toggleCountryPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4); });
588
- }
589
- $(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:output" class="wide pcnl-hidden-field"><div class="input-box"><label>'+ PCNLAPI_CONFIG.translations.outputLabel +'</label><div id="' + prefix + 'postcode_output" class="pcnl-address-text"></div></div></li>'});
590
- }
591
-
592
- $(prefix +'postcode_input').observe('change', function(e) { pcnlapi.lookupPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, e); });
593
- $(prefix +'postcode_housenumber').observe('change', function(e) { pcnlapi.lookupPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, e); });
594
- }
595
- else
596
- {
597
- this.showFields([prefix +'postcode_input', prefix +'postcode_housenumber', prefix +'postcode_housenumber_addition'])
598
- }
599
-
600
- this.toggleAddressFields(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4);
601
-
602
- // Previous value was not NL, switch manual off
603
- if ($(prefix + 'postcode_input_checkbox').disabled)
604
- {
605
- $(prefix +'postcode_input_checkbox').checked = false;
606
- this.toggleAddressFields(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4);
607
- }
608
- // We're in NL, checkbox is enabled
609
- $(prefix + 'postcode_input_checkbox').disabled = false;
610
-
611
- // Fill postcode validation input with data from manual data fields (postcode + street)
612
- if ($(prefix + postcodeFieldId).getValue() != '' && $(prefix +'postcode_input').getValue() == '')
613
- {
614
- $(prefix +'postcode_input').setValue($(prefix + postcodeFieldId).getValue());
615
-
616
- var housenumber_match;
617
- if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2))
618
- {
619
- housenumber_match = $(prefix + street2).getValue().match(/([0-9]+)([^0-9a-zA-Z]+([0-9a-zA-Z ]+)|([a-zA-Z]([0-9a-zA-Z ]+)))?$/);
620
- }
621
- else
622
- {
623
- housenumber_match = $(prefix + street1).getValue().match(/([0-9]+)([^0-9a-zA-Z]+([0-9a-zA-Z ]+)|([a-zA-Z]([0-9a-zA-Z ]+)))?$/);
624
- }
625
-
626
- var housenumber = housenumber_match ? housenumber_match[1].trim() : '';
627
-
628
- var housenumber_addition = '';
629
-
630
- if (!housenumber_match)
631
- housenumber_addition = '';
632
- else if (housenumber_match[3])
633
- housenumber_addition = housenumber_match[3].trim();
634
- else if (housenumber_match[4])
635
- housenumber_addition = housenumber_match[4].trim();
636
-
637
- $(prefix +'postcode_housenumber').setValue((housenumber +' '+ housenumber_addition).trim());
638
- this.lookupPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4);
639
- }
640
- }
641
- else
642
- {
643
- // Address is not in the Netherlands
644
- // Only toggle things if we have already created elements (test for existence of input checkbox)
645
- if ($(prefix +'postcode_input_checkbox'))
646
- {
647
- $(prefix +'postcode_input_checkbox').checked = true;
648
- $(prefix +'postcode_input_checkbox').disabled = true;
649
-
650
- this.toggleAddressFields(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4);
651
-
652
- this.setFieldsReadonly([
653
- prefix +'city',
654
- prefix +'region',
655
- prefix + postcodeFieldId,
656
- prefix + street1,
657
- prefix + street2,
658
- prefix + street3,
659
- prefix + street4,
660
- ], false);
661
-
662
- this.setFieldsReadonly([prefix +'postcode_input', prefix +'postcode_housenumber', prefix +'postcode_housenumber_addition'], true);
663
- this.hideFields([prefix +'postcode_input', prefix +'postcode_housenumber', prefix +'postcode_housenumber_addition']);
664
-
665
- this.showFields([prefix + countryFieldId]);
666
-
667
- if ($(prefix +'showcase'))
668
- Element.remove($(prefix +'showcase'));
669
- }
670
- }
671
- },
672
-
673
- /**
674
- * Toggle address field visibility, to be in line with the value of the 'manual input' checkbox.
675
- */
676
- toggleAddressFields: function(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, values)
677
- {
678
- if (!$(prefix + 'postcode_input_checkbox').checked)
679
- {
680
- this.setFieldsReadonly([
681
- prefix + postcodeFieldId,
682
- prefix + street1,
683
- prefix + street2,
684
- prefix + street3,
685
- prefix + street4,
686
- prefix + 'city',
687
- prefix + 'region',
688
- ], true);
689
- this.hideFields([
690
- prefix + postcodeFieldId,
691
- prefix + street1,
692
- prefix + street2,
693
- prefix + street3,
694
- prefix + street4,
695
- prefix + 'city',
696
- prefix + 'region',
697
-
698
- ]);
699
- if (!PCNLAPI_CONFIG.neverHideCountry)
700
- {
701
- this.hideFields([prefix + countryFieldId]);
702
- }
703
-
704
- // Set empty, will be corrected later
705
- $(prefix +'postcode_input').value = '';
706
- $(prefix +'postcode_housenumber').value = '';
707
-
708
- this.setFieldsReadonly([prefix +'postcode_input', prefix + 'postcode_housenumber', prefix + 'postcode_housenumber_addition'], false);
709
- if ($(prefix +'postcode_output') && $(prefix +'postcode_output').innerHTML != '')
710
- {
711
- this.showFields([prefix +'postcode_output']);
712
- }
713
- }
714
- else
715
- {
716
- this.removeValidationMessages(prefix);
717
-
718
- this.setFieldsReadonly([
719
- prefix + postcodeFieldId,
720
- prefix + street1,
721
- prefix + street2,
722
- prefix + street3,
723
- prefix + street4,
724
- prefix + 'city',
725
- prefix + 'region',
726
- ], false);
727
- this.showFields([
728
- prefix + postcodeFieldId,
729
- prefix + street1,
730
- prefix + street2,
731
- prefix + street3,
732
- prefix + street4,
733
- prefix + 'city',
734
- prefix + 'region',
735
- prefix + countryFieldId,
736
- ]);
737
-
738
- // Disable fields
739
- $(prefix +'postcode_input').setValue(PCNLAPI_CONFIG.translations.disabledText);
740
- $(prefix +'postcode_housenumber').setValue(PCNLAPI_CONFIG.translations.disabledText);
741
- this.setFieldsReadonly([prefix +'postcode_input', prefix + 'postcode_housenumber', prefix + 'postcode_housenumber_addition'], true);
742
- this.hideFields([prefix +'postcode_output']);
743
- }
744
- },
745
-
746
- /**
747
- * (re)Create the postcode housenumber addition dropdown select box.
748
- */
749
- createPostcodeHouseNumberAddition: function (prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, values, custom)
750
- {
751
- var pcnlapi = this;
752
- if ($(prefix +'postcode_housenumber_addition:wrapper'))
753
- Element.remove($(prefix +'postcode_housenumber_addition:wrapper'));
754
- if ($(prefix +'postcode_housenumber_addition'))
755
- Element.remove($(prefix +'postcode_housenumber_addition'));
756
-
757
- var options = '';
758
- if (custom != null)
759
- {
760
- if (custom == '')
761
- custom = '__none__';
762
-
763
- options += '<option value="__select__">'+ PCNLAPI_CONFIG.translations.selectAddition +'</option>';
764
- options += '<option value="'+ custom.escapeHTML() +'">'+ (custom == '__none__' ? PCNLAPI_CONFIG.translations.noAdditionSelectCustom : PCNLAPI_CONFIG.translations.additionSelectCustom.replace('{addition}', custom.escapeHTML())) +'</option>';
765
- }
766
- else if (values.indexOf('') == -1)
767
- {
768
- options += '<option value="__none__">'+ PCNLAPI_CONFIG.translations.noAdditionSelectCustom.escapeHTML() +'</option>';
769
- }
770
-
771
- values.each(function(value)
772
- {
773
- options += '<option value="'+ (value == '' ? '__none__' : value.escapeHTML()) +'">'+ (value == '' ? PCNLAPI_CONFIG.translations.noAdditionSelect : value ).escapeHTML() +'</option>';
774
- });
775
-
776
- if ($(prefix + countryFieldId).parentNode.tagName == 'TD')
777
- {
778
- // We're probably in the admin
779
- $(prefix + 'postcode_housenumber').up('tr').insert({after: '<tr id="' + prefix +'postcode_housenumber_addition:wrapper"><td class="label"><label for="'+ prefix +'postcode_housenumber_addition">'+ PCNLAPI_CONFIG.translations.houseNumberAdditionLabel +' <span class="required">*</span></label></td><td class="value"><select title="'+ PCNLAPI_CONFIG.translations.houseNumberAdditionTitle +'" name="'+ prefix + 'postcode_housenumber_addition" id="' + prefix + 'postcode_housenumber_addition" class="select">'+ options +'</select></td></tr>'});
780
- }
781
- else
782
- {
783
- // We're probably in the frontend
784
- $(prefix + 'postcode_housenumber').insert({after: '<select title="'+ PCNLAPI_CONFIG.translations.houseNumberAdditionTitle +'" name="'+ prefix + 'postcode_housenumber_addition" id="' + prefix + 'postcode_housenumber_addition" class="validate-select pcnl-input-text-half">'+ options +'</select>'});
785
- if ($(prefix + 'postcode_housenumber').up('div.short'))
786
- {
787
- // IWD checkout module
788
- $(prefix + 'postcode_housenumber').up('div.short').addClassName('pcnl-with-addition');
789
- }
790
- else
791
- {
792
- // Other checkout modules
793
- $(prefix + 'postcode_housenumber').up('li').addClassName('pcnl-with-addition');
794
- }
795
- }
796
-
797
- $(prefix +'postcode_housenumber_addition').observe('change', function(e) { pcnlapi.lookupPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, e); });
798
-
799
- return $(prefix +'postcode_housenumber_addition');
800
- },
801
-
802
- /**
803
- * Inspect our current page, see where we are: configure & attach observers to input fields.
804
- */
805
- addAddressCheckObservers: function ()
806
- {
807
- var pcnlapi = this;
808
- // 'Normal' Checkout pages (OneStepCheckout, Magento Default)
809
- if ($('billing:postcode'))
810
- {
811
- if ($('billing:country_id'))
812
- {
813
- $('billing:country_id').observe('change', function () {
814
- pcnlapi.toggleCountryPostcode('billing:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
815
- // Also toggle shipping, because it may be synced 'silently' with billing
816
- if ($('shipping:country_id')) {
817
- pcnlapi.toggleCountryPostcode('shipping:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
818
- }
819
- });
820
- if (!$('billing:country_id') || $('billing:country_id').getValue() == 'NL') {
821
- this.toggleCountryPostcode('billing:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
822
- if ($('shipping:country_id')) {
823
- // Also toggle shipping, because it may be synced 'silently' with billing
824
- this.toggleCountryPostcode('shipping:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
825
- }
826
- }
827
- }
828
- if ($('shipping:country_id'))
829
- {
830
- $('shipping:country_id').observe('change', function () { pcnlapi.toggleCountryPostcode('shipping:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4'); });
831
- if (!$('shipping:country_id') || $('shipping:country_id').getValue() == 'NL')
832
- this.toggleCountryPostcode('shipping:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
833
- }
834
- }
835
- // GoMage LightCheckout
836
- if ($('billing_postcode'))
837
- {
838
- if ($('billing:country_id'))
839
- {
840
- $('billing_country_id').observe('change', function () { pcnlapi.toggleCountryPostcode('billing_', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4'); });
841
- if (!$('billing_country_id') || $('billing_country_id').getValue() == 'NL')
842
- this.toggleCountryPostcode('billing_', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
843
- }
844
- if ($('shipping:country_id'))
845
- {
846
- $('shipping_country_id').observe('change', function () { pcnlapi.toggleCountryPostcode('shipping_', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4'); });
847
- if (!$('shipping_country_id') || $('shipping_country_id').getValue() == 'NL')
848
- this.toggleCountryPostcode('shipping_', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
849
- }
850
- }
851
-
852
- // Misc. account address edits
853
- if ($('zip') && $('street_1'))
854
- {
855
- $('zip').observe('change', function(e)
856
- {
857
- pcnlapi.lookupPostcode('', 'zip', 'country', 'street_1', 'street_2', 'street_3', 'street_4', e);
858
- });
859
-
860
- $('country').observe('change', function () { pcnlapi.toggleCountryPostcode('', 'zip', 'country', 'street_1', 'street_2', 'street_3', 'street_4'); });
861
-
862
- if ($('country').getValue() == 'NL')
863
- this.toggleCountryPostcode('', 'zip', 'country', 'street_1', 'street_2', 'street_3', 'street_4');
864
- }
865
-
866
- // Default admin address edits
867
- if ($('postcode') && $('street0'))
868
- {
869
- $('postcode').observe('change', function(e)
870
- {
871
- pcnlapi.lookupPostcode('', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3', e);
872
- });
873
-
874
- $('country_id').observe('change', function () { pcnlapi.toggleCountryPostcode('', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3'); });
875
-
876
- if ($('country_id').getValue() == 'NL')
877
- this.toggleCountryPostcode('', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
878
- }
879
-
880
- // User admin address edits
881
- if ($('address_form_container'))
882
- {
883
- this.observeAdminCustomerAddress();
884
-
885
- $('address_form_container').observe('DOMNodeInserted', function(e) { pcnlapi.observeAdminCustomerAddress(); });
886
- }
887
-
888
- // Admin 'create order' & 'edit order' address editting
889
- if ($('order-billing_address'))
890
- {
891
- this.observeBillingAddress();
892
- this.observeShippingAddress();
893
-
894
- // Re-observe blocks after they have been changed
895
- if ($('order-billing_address'))
896
- $('order-billing_address').observe('DOMNodeInserted', function(e) { pcnlapi.observeBillingAddress(); });
897
- if ($('order-shipping_address'))
898
- $('order-shipping_address').observe('DOMNodeInserted', function(e) { pcnlapi.observeShippingAddress(); });
899
- }
900
- },
901
- observeAdminCustomerAddress: function ()
902
- {
903
- var pcnlapi = this;
904
- for (nr = 1; nr < 15; nr++)
905
- {
906
- if ($('_item'+ nr +'postcode') && !$('_item'+ nr +'postcode').observed)
907
- {
908
- $('_item'+ nr +'postcode').observe('change', function(e)
909
- {
910
- var localNr = nr;
911
- return function () { pcnlapi.lookupPostcode('_item'+ localNr, 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3', e);}
912
- }());
913
-
914
- $('_item'+ nr +'country_id').observe('change', function(e)
915
- {
916
- var localNr = nr;
917
- return function () { pcnlapi.toggleCountryPostcode('_item'+ localNr, 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');}
918
- }());
919
-
920
- $('_item'+ nr +'postcode').observed = true;
921
-
922
- if ($('_item'+ nr +'country_id').getValue() == 'NL')
923
- this.toggleCountryPostcode('_item'+ nr, 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
924
- }
925
- }
926
- },
927
- observeBillingAddress: function ()
928
- {
929
- var pcnlapi = this;
930
- // Billing
931
- if ($('order-billing_address_postcode'))
932
- {
933
- $('order-billing_address_postcode').observe('change', function(e)
934
- {
935
- pcnlapi.lookupPostcode('order-billing_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3', e);
936
- });
937
- $('order-billing_address_country_id').observe('change', function ()
938
- {
939
- pcnlapi.toggleCountryPostcode('order-billing_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
940
- });
941
- if ($('order-billing_address_country_id').getValue() == 'NL')
942
- this.toggleCountryPostcode('order-billing_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
943
- $('order-billing_address_postcode').observe('postcode:updated', function(e)
944
- {
945
- // Custom poke Magento billing-to-shipping copy order logic.
946
- var event = {
947
- type: e.type,
948
- currentTarget: $('order-billing_address_street0'),
949
- target: $('order-billing_address_street0')
950
- };
951
- order.changeAddressField(event);
952
- });
953
- }
954
- },
955
- observeShippingAddress: function ()
956
- {
957
- var pcnlapi = this;
958
- // Shipping
959
- if (!$('order-shipping_same_as_billing').checked)
960
- {
961
- $('order-shipping_address_postcode').observe('change', function(e)
962
- {
963
- pcnlapi.lookupPostcode('order-shipping_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3', e);
964
- });
965
- $('order-shipping_address_country_id').observe('change', function () { pcnlapi.toggleCountryPostcode('order-shipping_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3'); });
966
- if ($('order-shipping_address_country_id').getValue() == 'NL')
967
- pcnlapi.toggleCountryPostcode('order-shipping_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
968
- }
969
- }
970
- };
971
-
972
- // Add observers to address fields on page
973
- PostcodeNl_Api.addAddressCheckObservers();
974
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PostcodeNl_Api</name>
4
- <version>1.0.6.0</version>
5
  <stability>stable</stability>
6
  <license>Simplified BSD License</license>
7
  <channel>community</channel>
@@ -20,11 +20,12 @@ The postcode Magento plugin from Postcode.nl is free of charge, based on a Fair-
20
  - Fixed bug when switching from non-NL country to non-NL country&#xD;
21
  - Improved Billing to Shipping synchronization&#xD;
22
  - Added support for `Apptha One Page Checkout`&#xD;
23
- - Added support for `Ecommerce Three-Step Checkout`</notes>
 
24
  <authors><author><name>Postcode.nl Technical Support</name><user>auto-converted</user><email>tech@postcode.nl</email></author></authors>
25
  <date>2013-01-09</date>
26
- <time>10:08:04</time>
27
- <contents><target name="magecommunity"><dir name="PostcodeNl"><dir name="Api"><dir name="Block"><file name="Jsinit.php" hash="79bb826a50ce0cf4f87cc2f958bfafa1"/></dir><dir name="Helper"><file name="Data.php" hash="1dc6157d08029c42ed743ca3a2350a14"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PcnlController.php" hash="b86f92da28638dfb619b68106523104e"/></dir><file name="JsonController.php" hash="273cdee0eb176860a68dd1788d9fef08"/></dir><dir name="etc"><file name="config.xml" hash="89dadeae0873e961437bb5e0046754a2"/><file name="system.xml" hash="11a7b7f1d8d7258c90133dfe2581ce00"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="912aa0881de03e5d7bd338a00e783215"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="e08a3ce7a48801bf997dbd4f6743b53f"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="4b209228600162da76d115d7dda2ea31"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="339610e5950a53c3966d80cccf9bede4"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="PostcodeNl_Api.csv" hash="d8f9ff15eb17aa09a7a40a72aa890095"/></dir><dir name="nl_NL"><file name="PostcodeNl_Api.csv" hash="d196b00bf35dec9fc858b5fc4f9dac9f"/></dir></target><target name="mageweb"><dir name="js"><dir name="postcodenl"><dir name="api"><file name="lookup.js" hash="16f59f70003c8f7abd69d52ea963b149"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c58103b505f8bcdf55cea1159ca21e27"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="4fca81fe07d2e343340025e7f6d462ce"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PostcodeNl_Api.xml" hash="feeaf95128ffe4ad109ed8b0b8bc85ab"/></dir></target></contents>
28
  <compatible/>
29
  <dependencies/>
30
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PostcodeNl_Api</name>
4
+ <version>1.0.6.1</version>
5
  <stability>stable</stability>
6
  <license>Simplified BSD License</license>
7
  <channel>community</channel>
20
  - Fixed bug when switching from non-NL country to non-NL country&#xD;
21
  - Improved Billing to Shipping synchronization&#xD;
22
  - Added support for `Apptha One Page Checkout`&#xD;
23
+ - Added support for `Ecommerce Three-Step Checkout`&#xD;
24
+ - Fixed issue where not all templates were added in 1.0.6.0 release</notes>
25
  <authors><author><name>Postcode.nl Technical Support</name><user>auto-converted</user><email>tech@postcode.nl</email></author></authors>
26
  <date>2013-01-09</date>
27
+ <time>13:31:14</time>
28
+ <contents><target name="magecommunity"><dir name="PostcodeNl"><dir name="Api"><dir name="Block"><file name="Jsinit.php" hash="79bb826a50ce0cf4f87cc2f958bfafa1"/></dir><dir name="Helper"><file name="Data.php" hash="1dc6157d08029c42ed743ca3a2350a14"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PcnlController.php" hash="b86f92da28638dfb619b68106523104e"/></dir><file name="JsonController.php" hash="273cdee0eb176860a68dd1788d9fef08"/></dir><dir name="etc"><file name="config.xml" hash="836664540a2e609aa62f54184c0a8f43"/><file name="system.xml" hash="11a7b7f1d8d7258c90133dfe2581ce00"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="912aa0881de03e5d7bd338a00e783215"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="e08a3ce7a48801bf997dbd4f6743b53f"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="4b209228600162da76d115d7dda2ea31"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="339610e5950a53c3966d80cccf9bede4"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="4b209228600162da76d115d7dda2ea31"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="postcodenl"><file name="api" hash=""/></dir></dir></dir></dir></dir><dir name="en_US"><file name="PostcodeNl_Api.csv" hash="d8f9ff15eb17aa09a7a40a72aa890095"/></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c58103b505f8bcdf55cea1159ca21e27"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="4fca81fe07d2e343340025e7f6d462ce"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="4fca81fe07d2e343340025e7f6d462ce"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PostcodeNl_Api.xml" hash="feeaf95128ffe4ad109ed8b0b8bc85ab"/></dir></target></contents>
29
  <compatible/>
30
  <dependencies/>
31
  </package>
skin/frontend/base/default/postcodenl/api/css/lookup.css ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Frontend styles */
2
+
3
+ input.pcnl-readonly {
4
+ background-color: #EEE;
5
+ }
6
+
7
+ .form-list input.pcnl-input-text-half {
8
+ width: 45%;
9
+ margin-right:5px;
10
+ }
11
+ .form-list select.pcnl-input-text-half {
12
+ width: 45%;
13
+ }
14
+
15
+ input.pcnl-readonly,
16
+ select.pcnl-readonly {
17
+ color: grey;
18
+ font-style: italic;
19
+ }
20
+
21
+ .pcnl-info-text {
22
+ font-size: 90%;
23
+ }
24
+
25
+ .pcnl-info-label {
26
+ float: none !important;
27
+ }
28
+
29
+ .pcnl-address-text {
30
+ font-style: italic;
31
+ clear: both;
32
+ padding-left: 4px;
33
+ padding-right: 4px;
34
+ width: 90%;
35
+ }
36
+
37
+ /* excessive hidey-stuff? yes. blame IE (6, 7 & 9) */
38
+ .pcnl-hidden-field {
39
+ visibility: hidden;
40
+ display: block;
41
+ height: 0px !important;
42
+ width: 0px !important;
43
+ margin: 0 !important;
44
+ padding: 0 !important;
45
+ position: absolute;
46
+ }
47
+
48
+ /* Showcase styles */
49
+
50
+ h4.pcnl-showcase, h4.pcnl-debug {
51
+ background: url(../images/postcode-logo.png) left center no-repeat;
52
+ padding-left: 146px;
53
+ height: 22px;
54
+ line-height: 25px;
55
+ margin-bottom: 0px;
56
+ }
57
+
58
+ dl.pcnl-showcase, dl.pcnl-debug {
59
+ padding: 4px;
60
+ border: 1px solid grey;
61
+ border-radius: 4px;
62
+ -moz-border-radius: 4px;
63
+ background: white;
64
+ position: relative;
65
+ }
66
+
67
+ dl.pcnl-showcase iframe {
68
+ position: absolute;
69
+ top: 5px;
70
+ right: 5px;
71
+ width: 300px;
72
+ height: 300px;
73
+ border: 1px solid grey;
74
+ }
75
+
76
+ dl.pcnl-showcase dt, dl.pcnl-debug dt {
77
+ font-weight: bold;
78
+ }
79
+ dl.pcnl-showcase dd, dl.pcnl-debug dd {
80
+ margin-left: 20px;
81
+ }
82
+
83
+ /* OneStepCheckout styling */
84
+ div.checkoutcontainer div.pcnl-input-housenumber {
85
+ width: 60%;
86
+ }
87
+ div.checkoutcontainer div.pcnl-input-housenumber .input-text {
88
+ width: 74%;
89
+ }
90
+ div.checkoutcontainer .pcnl-with-addition div.pcnl-input-housenumber .input-text {
91
+ width: 22%;
92
+ }
93
+ div.checkoutcontainer div.pcnl-input-housenumber select.pcnl-input-text-half {
94
+ margin-left: 4px;
95
+ width: 50%;
96
+ }
97
+ div.checkoutcontainer .pcnl-info-text {
98
+ width: 85%;
99
+ }
100
+ div.checkoutcontainer dl.pcnl-showcase iframe {
101
+ position: relative;
102
+ float: right;
103
+ width: 260px;
104
+ height: 260px;
105
+ margin-bottom: 15px;
106
+ border: 1px solid grey;
107
+ }
108
+
109
+ /* GoMage LightCheckout */
110
+ body.gomage-checkout-onepage-index dl.pcnl-debug {
111
+ width: 260px;
112
+ overflow: hidden;
113
+ }
114
+
115
+ body.gomage-checkout-onepage-index dl.pcnl-debug:hover {
116
+ width: auto;
117
+ overflow: normal;
118
+ }
119
+
120
+ body.gomage-checkout-onepage-index .pcnl-manual-checkbox label,
121
+ body.gomage-checkout-onepage-index .pcnl-info label {
122
+ float: none;
123
+ }
124
+ body.gomage-checkout-onepage-index .pcnl-info-text {
125
+ width: 90%;
126
+ }
127
+
128
+ /* MageStore One Step Checkout */
129
+ body.onestepcheckout-index-index #one-step-checkout-form .pcnl-info-text {
130
+ width: 78%;
131
+ }
132
+
133
+ /* Apptha One Step Checkout */
134
+ body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-fields .field {
135
+ margin-right: 14px;
136
+ }
137
+ body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-checkbox .field {
138
+ width: 250px !important
139
+ }
140
+ body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-checkbox input {
141
+ float: left;
142
+ margin-top: 2px;
143
+ margin-right: 0;
144
+ }
145
+ body.onestepcheckout-index-index .onepage .form-list .pcnl-apptha-checkbox label {
146
+ padding-left: 6px;
147
+ }
148
+
skin/frontend/base/default/postcodenl/api/images/postcode-logo.png ADDED
Binary file