UK_Postcode_Address_Finder - Version 2.3.0

Version Notes

Release History :
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.3.0
Comparing to
See all releases


Code changes from version 2.2.0 to 2.3.0

app/code/local/CraftyClicks/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <config>
13
  <modules>
14
  <CraftyClicks>
15
- <version>2.2.0</version>
16
  </CraftyClicks>
17
  </modules>
18
 
@@ -38,7 +38,6 @@
38
  <general>
39
  <craftyclicks>
40
  <active>0</active>
41
- <active_admin>0</active_admin>
42
  <model>craftyclicks</model>
43
  <access_token>xxxxx-xxxxx-xxxxx-xxxxx</access_token>
44
  <button_image></button_image>
12
  <config>
13
  <modules>
14
  <CraftyClicks>
15
+ <version>2.3.0</version>
16
  </CraftyClicks>
17
  </modules>
18
 
38
  <general>
39
  <craftyclicks>
40
  <active>0</active>
 
41
  <model>craftyclicks</model>
42
  <access_token>xxxxx-xxxxx-xxxxx-xxxxx</access_token>
43
  <button_image></button_image>
app/code/local/CraftyClicks/etc/system.xml CHANGED
@@ -30,16 +30,6 @@
30
  <show_in_store>0</show_in_store>
31
  </active>
32
 
33
- <active_admin translate="label">
34
- <label>Enabled - Admin Panel</label>
35
- <frontend_type>select</frontend_type>
36
- <source_model>adminhtml/system_config_source_yesno</source_model>
37
- <sort_order>2</sort_order>
38
- <show_in_default>1</show_in_default>
39
- <show_in_website>1</show_in_website>
40
- <show_in_store>0</show_in_store>
41
- </active_admin>
42
-
43
  <access_token translate="label">
44
  <label>Access Token</label>
45
  <frontend_type>text</frontend_type>
30
  <show_in_store>0</show_in_store>
31
  </active>
32
 
 
 
 
 
 
 
 
 
 
 
33
  <access_token translate="label">
34
  <label>Access Token</label>
35
  <frontend_type>text</frontend_type>
app/design/adminhtml/default/default/template/customer/tab/addresses.phtml DELETED
@@ -1,614 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- ?>
27
- <!-- Addresses list -->
28
- <table cellspacing="0" class="form-edit">
29
- <tr>
30
- <td class="address-list">
31
- <div class="entry-edit-head">
32
- <h4 class="icon-head head-customer-address-list"><?php echo Mage::helper('customer')->__('Customer Addresses') ?></h4>
33
- </div>
34
- <div class="sub-btn-set"><?php echo $this->getAddNewButtonHtml() ?></div>
35
- <ul id="address_list">
36
- <?php $_iterator = 0; ?>
37
- <?php if(count($addressCollection)): ?>
38
- <?php foreach ($addressCollection as $_address): ?>
39
- <li id="address_item_<?php echo $_address->getId() ?>">
40
- <?php if (!$this->isReadonly()): ?>
41
- <a href="#" class="btn-remove-address">
42
- <img src="<?php echo $this->getSkinUrl('images/cancel_icon.gif') ?>" alt="Remove address" id="delete_button<?php echo ++$_iterator ?>" />
43
- </a>
44
- <a href="#" id="select_button_<?php echo $_address->getId() ?>" class="select_button btn-edit-address">
45
- <img src="<?php echo $this->getSkinUrl('images/edit_icon.gif') ?>" alt="Edit address"/>
46
- </a>
47
- <?php endif;?>
48
- <address>
49
- <?php echo $_address->format('html') ?>
50
- </address>
51
- <div class="address-type">
52
- <span class="address-type-line">
53
- <input type="radio" <?php if ($this->isReadonly()):?> disabled="disabled"<?php endif;?> value="<?php echo $_address->getId() ?>" id="address_item_billing<?php echo $_address->getId() ?>" name="account[default_billing]" title="<?php echo Mage::helper('customer')->__('Set as Default Billing Address') ?>"<?php if($_address->getId()==$customer->getDefaultBilling()): ?> checked="checked"<?php endif; ?>/>
54
- &nbsp;<label for="address_item_billing<?php echo $_address->getId() ?>"><?php echo Mage::helper('customer')->__('Default Billing Address') ?></label>
55
- </span>
56
- <span class="address-type-line">
57
- <input type="radio" <?php if ($this->isReadonly()):?> disabled="disabled"<?php endif;?> value="<?php echo $_address->getId() ?>" id="address_item_shipping<?php echo $_address->getId() ?>" name="account[default_shipping]" title="<?php echo Mage::helper('customer')->__('Set as Default Shipping Address') ?>"<?php if($_address->getId()==$customer->getDefaultShipping()): ?> checked="checked"<?php endif; ?>/>
58
- &nbsp;<label for="address_item_shipping<?php echo $_address->getId() ?>"><?php echo Mage::helper('customer')->__('Default Shipping Address') ?></label>
59
- </span>
60
- </div>
61
- </li>
62
- <?php endforeach; ?>
63
- <?php endif; ?>
64
- </ul>
65
- </td>
66
- <td>
67
- <!-- Addresses forms -->
68
- <div class="entry-edit" id="address_form_container">
69
- <?php if(count($addressCollection)): ?>
70
- <?php foreach ($addressCollection as $_address): ?>
71
- <div id="form_address_item_<?php echo $_address->getId() ?>" style="display:none">
72
- <?php
73
- $this->getFormObject()->setValues($_address->getData())
74
- ->setHtmlIdPrefix("id{$_address->getId()}")
75
- ->setFieldNameSuffix('address['.$_address->getId().']')
76
- ?>
77
- <?php echo $this->getFormObject()->getHtml() ?>
78
- <input type="hidden" name="address[<?php echo $_address->getId() ?>][_deleted]" id="deleted_address_item_<?php echo $_address->getId() ?>" />
79
- </div>
80
- <?php endforeach; ?>
81
- <?php else: ?>
82
- <div id="no_address_message"><?php echo Mage::helper('customer')->__('This customer has no saved addresses.') ?></div>
83
- <?php endif; ?>
84
- </div>
85
-
86
- <!-- Template for adding address item to list -->
87
- <?php $_templatePrefix = $this->getTemplatePrefix() ?>
88
- <div id="address_item_template" class="no-display template">
89
- <?php if (!$this->isReadonly()): ?>
90
- <a href="#" class="btn-remove-address">
91
- <img src="<?php echo $this->getSkinUrl('images/cancel_icon.gif') ?>" alt="Remove address" id="delete_button<?php echo ++$_iterator ?>" />
92
- </a>
93
- <a href="#" id="select_button_" class="select_button btn-edit-address">
94
- <img src="<?php echo $this->getSkinUrl('images/edit_icon.gif') ?>" alt="Edit address"/>
95
- </a>
96
- <?php endif;?>
97
- <address><?php echo Mage::helper('customer')->__('New Customer Address') ?></address>
98
- <div class="address-type">
99
- <span class="address-type-line">
100
- <input <?php if ($this->isReadonly()):?> disabled="disabled"<?php endif;?> type="radio" value="<?php echo $_templatePrefix ?>" id="address_item_billing<?php echo $_templatePrefix ?>" name="account[default_billing]" title="<?php echo Mage::helper('customer')->__('Set as Default Billing Address') ?>"/>
101
- &nbsp;<label for="address_item_billing<?php echo $_templatePrefix ?>"><?php echo Mage::helper('customer')->__('Default Billing Address') ?></label>
102
- </span>
103
- <span class="address-type-line">
104
- <input <?php if ($this->isReadonly()):?> disabled="disabled"<?php endif;?> type="radio" value="<?php echo $_templatePrefix ?>" id="address_item_shipping<?php echo $_templatePrefix ?>" name="account[default_shipping]" title="<?php echo Mage::helper('customer')->__('Set as Default Shipping Address') ?>"/>
105
- &nbsp;<label for="address_item_shipping<?php echo $_templatePrefix ?>"><?php echo Mage::helper('customer')->__('Default Shipping Address') ?></label>
106
- </span>
107
- </div>
108
- </div>
109
-
110
- <!-- Address form template -->
111
- <div id="address_form_template" class="no-display template">
112
- <?php
113
- // Set form template elements prefix
114
- $this->getFormObject()->setHtmlIdPrefix($_templatePrefix)
115
- ->setValues(array())
116
- ->setFieldNameSuffix('address['.$_templatePrefix.']');
117
- ?>
118
- <?php echo $this->getFormObject()->getHtml() ?>
119
- <?php echo $this->getCancelButtonHtml() ?>
120
- </div>
121
-
122
-
123
- <?php // CraftyClicks - Start
124
- $conf = Mage::getStoreConfig('general');
125
- if ($conf['craftyclicks']['active_admin']) : ?>
126
- <script type="text/javascript" charset="ISO-8859-1" src="<?php echo $this->getJsUrl('craftyclicks/crafty_postcode.class.js'); ?>"></script>
127
- <script type="text/javascript">
128
- //<![CDATA[
129
- var cp_obj = new Array();
130
- //]]>
131
- </script>
132
- <?php endif // CraftyClicks - End ?>
133
- <!-- -->
134
- <script type="text/javascript">
135
- //<![CDATA[
136
- var deleteButtonId = <?php echo $_iterator ?>;
137
-
138
- var addressesModel = Class.create();
139
- addressesModel.prototype = {
140
- initialize : function() {
141
- this.activeItem = null;
142
- this.itemTemplate = $('address_item_template');
143
- this.formTemplate = $('address_form_template');
144
- this.itemContainer= $('address_list');
145
- this.formContainer= $('address_form_container');
146
- this.baseItemId = 'new_item';
147
-
148
- this.itemContentTemplate = new Template('<?php echo $this->helper('customer/address')->getFormat('js_template')?>');
149
-
150
- this.onNewAddressClick = this.addNewAddress.bindAsEventListener(this);
151
- this.onItemMouseOver = this.itemMouseOver.bindAsEventListener(this);
152
- this.onItemMouseOut = this.itemMouseOut.bindAsEventListener(this);
153
- this.onItemMouseClick = this.itemMouseClick.bindAsEventListener(this);
154
- this.onItemFormFieldChange = this.syncFormData.bindAsEventListener(this);
155
-
156
- this.loader = new varienLoader(true);
157
- this.regionsUrl = '<?php echo $this->getRegionsUrl() ?>';
158
-
159
- this.reloadItemList(1);
160
-
161
- for(var i=0,n=this.itemList.length; i<n; i++){
162
- if(this.itemList[i].id){
163
- this.addItemObservers(this.itemList[i]);
164
- this.initItem(this.itemList[i]);
165
- }
166
- }
167
- if($('add_new_address_button')){
168
- Event.observe('add_new_address_button', 'click', this.onNewAddressClick)
169
- }
170
-
171
- this.setActiveItem(this.itemList[0]);
172
- this.setAddressAsDefault();
173
- this.bindCountryRegionRelation();
174
- },
175
-
176
- reloadItemList : function(initial){
177
- this.itemList = $$('#address_list li');
178
- if( initial ) {
179
- this.itemCount = this.itemList.length;
180
- }
181
- if(!this.itemList.length){
182
- if($('no_address_message')){
183
- $('no_address_message').show();
184
- }
185
- else {
186
- this.formContainer.innerHTML+= '<div id="no_address_message"><?php echo addslashes(Mage::helper('customer')->__('This customer has no saved addresses.')) ?></div>'
187
- }
188
- }
189
- },
190
-
191
- initItem : function(item){
192
- if(item && $('form_'+item.id)){
193
- item.formBlock = $('form_'+item.id);
194
- Element.hide($('form_'+item.id));
195
- $('form_'+item.id).statusBar = item;
196
- $('form_'+item.id).addressItem = item;
197
-
198
- // set Zip optional/required
199
- var countryElement = $('id' + item.id.replace(/address_item_/, '') + 'country_id');
200
- varienGlobalEvents.fireEvent("address_country_changed", countryElement);
201
- }
202
- },
203
-
204
- addItemObservers : function(item){
205
- if(item.id){
206
- Event.observe(item, 'mouseover', this.onItemMouseOver);
207
- Event.observe(item, 'mouseout', this.onItemMouseOut);
208
- Event.observe(item, 'click', this.onItemMouseClick);
209
- }
210
- },
211
-
212
- addNewAddress : function(event){
213
- if(this.canCreateNewAddress){
214
- this.itemCount++;
215
- if($('no_address_message')){
216
- $('no_address_message').hide();
217
- }
218
-
219
- // create new form elements
220
- Element.insert(this.formContainer, {bottom:
221
- '<div id="' + 'form_' + this.baseItemId + this.itemCount + '">'
222
- + this.prepareTemplate(this.formTemplate.innerHTML)
223
- + '</div>'
224
- });
225
-
226
- var newForm = $('form_' + this.baseItemId + this.itemCount);
227
-
228
- $('_item'+this.itemCount+'firstname').value = $('_accountfirstname').value;
229
- $('_item'+this.itemCount+'lastname').value = $('_accountlastname').value;
230
-
231
- Element.hide(newForm);
232
- var template = '<li id="' + this.baseItemId+this.itemCount + '">';
233
- deleteButtonId ++;
234
- template += this.prepareTemplate(this.itemTemplate.innerHTML).replace('delete_button', 'delete_button'+ deleteButtonId);
235
- template += '</li>';
236
- Element.insert(this.itemContainer, {bottom: template});
237
- var newItem = $(this.baseItemId+this.itemCount);
238
- newItem.isNewAddress = true;
239
- newItem.formBlock = newForm;
240
-
241
-
242
- newForm.statusBar = newItem;
243
- newForm.addressItem = newItem;
244
-
245
- this.addItemObservers(newItem);
246
- this.setActiveItem(newItem);
247
- this.bindCountryRegionRelation(newForm.id);
248
-
249
- if( $('_item'+this.itemCount+'firstname').value ) this.syncFormData($('_item'+this.itemCount+'firstname'));
250
- if( $('_item'+this.itemCount+'lastname').value ) this.syncFormData($('_item'+this.itemCount+'lastname'));
251
- }
252
- this.reloadItemList();
253
- //Event.stop(event);
254
- },
255
-
256
- prepareTemplate : function(template){
257
- return template
258
- .replace(/<?php echo $_templatePrefix ?>/g, '_item'+this.itemCount)
259
- .replace(/_counted="undefined"/g, '')
260
- .replace(/"select_button_"/g, 'select_button_' + this.itemCount)
261
- ;
262
- },
263
-
264
- canCreateNewAddress : function(){
265
- return true;
266
- },
267
-
268
- itemMouseOver : function(event){
269
- var element = Event.findElement(event, 'li');
270
- Element.addClassName(element, 'over');
271
- },
272
-
273
- itemMouseOut : function(event){
274
- var element = Event.findElement(event, 'li');
275
- Element.removeClassName(element, 'over');
276
- },
277
-
278
- itemMouseClick : function(event){
279
- if (!Event) {
280
- return;
281
- }
282
- var element = Event.findElement(event, 'li'); // find top item
283
- var elem = Event.element(event); // exact element clicked
284
-
285
- if ( ((elem.tagName.toUpperCase() == 'A') && elem.id.match(/^delete_button([0-9]*?)$/)) || ((elem.tagName.toUpperCase() == 'IMG') && elem.id.match(/^delete_button([0-9]*?)$/)) ) {
286
- this.deleteAddress(element);
287
- Event.stop(event);
288
- }
289
- else if(elem.tagName.toUpperCase() == 'INPUT') {
290
- this.setAddressAsDefault(element);
291
- }
292
- else {
293
- this.setActiveItem(element);
294
- }
295
- },
296
-
297
- setAddressAsDefault : function(){
298
- for(var i=0; i<this.itemList.length;i++){
299
- if(this.itemList[i].id){
300
- var inputs = $(this.itemList[i].id).getElementsBySelector('input');
301
- var isActive = false;
302
- for(var j in inputs){
303
- if(inputs[j].type=='radio' && inputs[j].checked && this.itemList.length > 1){
304
- isActive = true;
305
- }
306
- }
307
- this.toggleDeleteButton(this.itemList[i], !isActive);
308
- }
309
- }
310
- },
311
-
312
- toggleDeleteButton : function(item, flag){
313
- if(flag){
314
- $(item).select('.btn-remove-address').each(Element.show);
315
- $(item.formBlock).getElementsBySelector('.delete-address').each(Element.show);
316
- } else {
317
- $(item).select('.btn-remove-address').each(Element.hide);
318
- $(item.formBlock).getElementsBySelector('.delete-address').each(Element.hide);
319
- }
320
- },
321
-
322
- setActiveItem : function(item){
323
- if(this.activeItem){
324
- Element.removeClassName(this.activeItem, 'on');
325
- if($('form_'+this.activeItem.id)){
326
- Element.hide($('form_'+this.activeItem.id));
327
- }
328
- }
329
- Element.addClassName(item, 'on');
330
-
331
- if(item && $('form_'+item.id)){
332
- $('form_'+item.id).changeRelation = item;
333
- $('form_'+item.id).addressItem = item;
334
- Element.show($('form_'+item.id));
335
- //new Effect.Appear($('form_'+item.id), {duration : 0.3 });
336
- //$('form_'+item.id).focus();
337
- this.addFieldChangeObserver($('form_'+item.id));
338
- }
339
-
340
- this.activeItem = item;
341
- <?php // CraftyClicks - Start
342
- echo '
343
- var default_country="'.Mage::getStoreConfig('general/country/default').'";
344
- ';
345
- ?>
346
- if (item) {
347
- var item_html_id = '';
348
- if ('address_item_' == item.id.substr(0,13)) {
349
- item_html_id = 'id'+item.id.substr(13);
350
- } else if ('new_item' == item.id.substr(0,8)) {
351
- item_html_id = '_item'+item.id.substr(8);
352
- }
353
- if ('' == $(item_html_id+'country_id').value) {
354
- $(item_html_id+'country_id').value = default_country;
355
- }
356
- }
357
- <?php
358
- if ($conf['craftyclicks']['active_admin']) : ?>
359
- this.add_crafty_clicks(item);
360
- <?php endif // CraftyClicks - End ?>
361
- },
362
-
363
- <?php // CraftyClicks - Start
364
- if ($conf['craftyclicks']['active_admin']) :
365
- $cp_access_token = $conf['craftyclicks']['access_token'];
366
- ?>
367
- ch_country : function(){
368
- if (this.value!='GB')
369
- $(this.alt+'findAddrBtn').style.display = 'none';
370
- else
371
- $(this.alt+'findAddrBtn').style.display = 'inline';
372
- },
373
-
374
- do_look : function(){
375
- cp_obj[this.alt].doLookup();
376
- },
377
-
378
- add_crafty_clicks : function(item) {
379
- // figure out the html elements id for this item
380
- var item_html_id = '';
381
- if (!item) {
382
- return;
383
- } else if ('address_item_' == item.id.substr(0,13)) {
384
- item_html_id = 'id'+item.id.substr(13);
385
- } else if ('new_item' == item.id.substr(0,8)) {
386
- item_html_id = '_item'+item.id.substr(8);
387
- }
388
-
389
- if (!cp_obj[item_html_id]) {
390
- // create a crafty clicks object
391
- cp_obj[item_html_id] = CraftyPostcodeCreate();
392
- cp_obj[item_html_id].set("max_width", '100%');
393
- cp_obj[item_html_id].set("access_token", '<?php echo $cp_access_token; ?>');
394
- cp_obj[item_html_id].set("result_elem_id", item_html_id+'crafty');
395
- cp_obj[item_html_id].set("form", "");
396
- cp_obj[item_html_id].set("elements", item_html_id+"company,"+item_html_id+"street0,"+item_html_id+"street1,,"+item_html_id+"city,"+item_html_id+"region,"+item_html_id+"postcode");
397
- cp_obj[item_html_id].set("first_res_line", "----- please select your address ----");
398
- cp_obj[item_html_id].set("res_autoselect", "0");
399
- cp_obj[item_html_id].set("busy_img_url", "<?php echo $this->getJsUrl('crafty/crafty_postcode_busy.gif'); ?>");
400
-
401
- // create the 'find address' button
402
- var fndBtn;
403
- fndBtn = document.createElement('input');
404
- fndBtn.type='button';
405
- fndBtn.alt = item_html_id;
406
- fndBtn.id = item_html_id+'findAddrBtn';
407
- fndBtn.value = '<?php echo $this->__('Find Address') ?>';
408
-
409
- $(item_html_id+'postcode').style.width = '100px';
410
- $(item_html_id+'postcode').parentNode.appendChild(fndBtn);
411
- Event.observe(fndBtn.id, 'click', this.do_look);
412
-
413
- var resTr = document.createElement('tr');
414
- var resTd = document.createElement('td');
415
- resTd.colSpan = '3';
416
- resTd.id = item_html_id+'crafty'
417
- resTr.appendChild(resTd);
418
- var pcTr = $(item_html_id+'postcode').parentNode.parentNode;
419
- pcTr.parentNode.insertBefore(resTr, pcTr.nextSibling);
420
-
421
- $(item_html_id+'country_id').alt = item_html_id;
422
- Event.observe(item_html_id+'country_id', 'change', this.ch_country);
423
- }
424
- // make button visible if country is UK
425
- if ($(item_html_id+'country_id').value!='GB')
426
- $(item_html_id+'findAddrBtn').style.display = 'none';
427
- else
428
- $(item_html_id+'findAddrBtn').style.display = 'inline';
429
- },
430
- <?php endif // CraftyClicks - End ?>
431
-
432
- getFormContainerFields : function(container){
433
- var fields = $$( '#' + container.id + ' input','#' + container.id + ' select','#' + container.id + ' textarea');
434
- return fields;
435
- },
436
-
437
- addFieldChangeObserver : function(container){
438
- var fields = this.getFormContainerFields(container);
439
- for (var i = 0; i < fields.length; i++) {
440
- Event.observe(fields[i], 'change', this.onItemFormFieldChange);
441
- }
442
-
443
- },
444
-
445
- syncFormData : function(evt){
446
- var container = false;
447
-
448
- if(!evt.addClassName) {
449
- var elm = Event.element(evt);
450
- } else {
451
- var elm = evt;
452
- }
453
-
454
- elm = $(elm);
455
- while(elm.tagName.toUpperCase() != 'BODY') {
456
- if(elm.addressItem){
457
- container = elm;
458
- }
459
- elm = $(elm.parentNode);
460
- }
461
-
462
- if(container){
463
- var data = {};
464
- var fields = this.getFormContainerFields(container);
465
- for(var i=0; i < fields.size(); i++){
466
- if(fields[i].id){
467
- var id = fields[i].id.replace(/^(_item)?[0-9]+/, '');
468
- var value = fields[i].getValue();
469
- if(fields[i].tagName.toLowerCase()=='select'){
470
- data[id] = fields[i].options[fields[i].selectedIndex].text.escapeHTML();
471
- }
472
- else{
473
- data[id] = value.escapeHTML();
474
- }
475
- }
476
- }
477
- var itemContainer = container.addressItem.getElementsBySelector('address');
478
- if(itemContainer[0]){
479
-
480
- var html = this.itemContentTemplate.evaluate(data);
481
- html = html.replace(new RegExp('(<br\\s*/?>\\s*){2,}','img'),'<br/>');
482
- html = html.replace(new RegExp('<br\\s*/?>(\\s*,){1,}\\s*<br\\s*/?>','ig'),'<br/>');
483
- html = html.replace(new RegExp('t:\\s*<br\\s*/?>','ig'),'');
484
- html = html.replace(new RegExp('f:\\s*$','ig'),'');
485
- itemContainer[0].innerHTML = html;
486
- }
487
- }
488
- },
489
-
490
- deleteAddress : function(item){
491
- if(confirm('<?php echo Mage::helper('customer')->__('Are you sure you want to delete this address?') ?>')){
492
- if( item.isNewAddress || 1 == this.itemList.length){
493
- if ( this.activeItem == item ) this.formContainer.removeChild(item.formBlock);
494
- } else {
495
- if($('deleted_'+item.id)){
496
- $('deleted_'+item.id).value = 1;
497
- if(item.formBlock){
498
- item.formBlock.addClassName('ignore-validation');
499
- }
500
- }
501
- }
502
-
503
- if ( this.activeItem == item && item != this.itemList[0] ) this.setActiveItem(this.itemList[0]);
504
- if ( item == this.itemList[0] && (this.itemList[1]) ) this.setActiveItem(this.itemList[1]);
505
-
506
- this.itemContainer.removeChild(item);
507
- this.reloadItemList();
508
- this.setAddressAsDefault();
509
- }
510
- },
511
-
512
- cancelAdd : function(button){
513
- if(confirm('<?php echo addslashes(Mage::helper('customer')->__('Are you sure you want to cancel adding of this address?')) ?>')){
514
- var item = $(this.baseItemId + button.id.replace(new RegExp('[a-z_]*',''), ''));
515
-
516
- if( item.isNewAddress){
517
- if ( this.activeItem == item ) this.formContainer.removeChild(item.formBlock);
518
- }
519
- if ( this.activeItem == item && item != this.itemList[0] ) this.setActiveItem(this.itemList[0]);
520
- if ( item == this.itemList[0] && (this.itemList[1]) ) this.setActiveItem(this.itemList[1]);
521
-
522
- this.itemContainer.removeChild(item);
523
-
524
- this.reloadItemList();
525
- this.setAddressAsDefault();
526
- }
527
- },
528
-
529
- bindCountryRegionRelation : function(parentId){
530
- //alert('OK');
531
- if(parentId){
532
- var countryElements = $(parentId).getElementsByClassName('countries');
533
- }
534
- else{
535
- var countryElements = $$('.countries');
536
- }
537
-
538
- for(var i=0;i<=countryElements.length;i++){
539
- if(countryElements[i]){
540
- if(!countryElements[i].bindRegions || !countryElements[i].parentBindId || countryElements[i].parentBindId!=parentId){
541
- //if(!countryElements[i].bindRegions || !countryElements[i].parentBindId){
542
- Event.observe(countryElements[i], 'change', this.reloadRegionField.bind(this));
543
-
544
- countryElements[i].bindRegions = true;
545
- countryElements[i].parentBindId = parentId;
546
- }
547
- }
548
- }
549
- },
550
-
551
- reloadRegionField : function(event){
552
- var countryElement = Event.element(event);
553
- if(countryElement.id){
554
- var regionElement = $(countryElement.id.replace(/country_id/, 'region'));
555
- if(regionElement){
556
- this.regionElement = regionElement;
557
- var url = this.regionsUrl+'parent/'+countryElement.value;
558
- this.loader.load(url, {}, this.refreshRegionField.bind(this));
559
- }
560
- // set Zip optional/required
561
- varienGlobalEvents.fireEvent("address_country_changed", countryElement);
562
- }
563
- },
564
-
565
- refreshRegionField : function(serverResponse){
566
- if(serverResponse){
567
- var data = eval('(' + serverResponse + ')');
568
- var value = this.regionElement.value;
569
-
570
- var row = Element.previous(this.regionElement.parentNode,0);
571
- var reqLabel = Element.select(row, '.required');
572
- if (data.length) {
573
- var html = '<select name="'+this.regionElement.name+'" id="'+this.regionElement.id+'" class="required-entry select" title="'+this.regionElement.title+'">';
574
- html+= '<option value=""></option>';
575
- for (var i in data){
576
- if(data[i].label) {
577
- html+= '<option value="'+data[i].value+'"';
578
- if(this.regionElement.value && (this.regionElement.value == data[i].value || this.regionElement.value == data[i].label)){
579
- html+= ' selected="selected"';
580
- }
581
- html+='>'+data[i].label+'</option>';
582
- }
583
- }
584
- html+= '</select>';
585
- if(reqLabel){
586
- reqLabel.each(function(item){Element.show(item)});
587
- }
588
-
589
- var parentNode = this.regionElement.parentNode;
590
- var regionElementId = this.regionElement.id;
591
- parentNode.innerHTML = html;
592
- this.regionElement = $(regionElementId);
593
-
594
- //new Insertion.Before(this.regionElement, html);
595
- //Element.remove(this.regionElement);
596
- }
597
- else{
598
- var html = '<input type="text" name="'+this.regionElement.name+'" id="'+this.regionElement.id+'" class="input-text" title="'+this.regionElement.title+'">';
599
- if(reqLabel){
600
- reqLabel.each(function(item){Element.hide(item)});
601
- }
602
- Element.insert(this.regionElement, {before: html});
603
- Element.remove(this.regionElement);
604
- }
605
- }
606
- }
607
- }
608
-
609
- customerAddresses = new addressesModel();
610
- //]]>
611
- </script>
612
- </td>
613
- </tr>
614
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/sales/order/create/form/address.phtml DELETED
@@ -1,194 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package default_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- if($this->getIsShipping()):
27
- $_fieldsContainerId = 'order-shipping_address_fields';
28
- ?>
29
- <script type="text/javascript">
30
- order.shippingAddressContainer = '<?php echo $_fieldsContainerId ?>';
31
- order.setAddresses(<?php echo $this->getAddressCollectionJson() ?>);
32
- </script>
33
- <?php
34
- else:
35
- $_fieldsContainerId = 'order-billing_address_fields';
36
- ?>
37
- <script type="text/javascript">
38
- order.billingAddressContainer = '<?php echo $_fieldsContainerId ?>';
39
- </script>
40
- <?php
41
- endif; ?>
42
- <div class="entry-edit">
43
-
44
- <div class="entry-edit-head">
45
- <h4 class="icon-head fieldset-legend <?php echo $this->getHeaderCssClass() ?>"><?php echo $this->getHeaderText() ?></h4>
46
- </div>
47
-
48
- <fieldset class="np">
49
- <div class="order-choose-address">
50
- <?php echo Mage::helper('sales')->__('Select from existing customer addresses:') ?><br/>
51
- <?php $_id = $this->getForm()->getHtmlIdPrefix() . 'customer_address_id' ?>
52
- <select id="<?php echo $_id ?>" name="<?php echo $this->getForm()->getHtmlNamePrefix()?>[customer_address_id]" style="width:97.5%;" onchange="order.selectAddress(this, '<?php echo $_fieldsContainerId ?>')">
53
- <option value=""><?php echo Mage::helper('sales')->__('Add New Address') ?></option>
54
- <?php foreach ($this->getAddressCollection() as $_address): ?>
55
- <?php //if($this->getAddressAsString($_address)!=$this->getAddressAsString($this->getAddress())): ?>
56
- <option value="<?php echo $_address->getId() ?>"<?php if ($_address->getId()==$this->getAddressId()): ?> selected="selected"<?php endif; ?>>
57
- <?php echo $this->getAddressAsString($_address) ?>
58
- </option>
59
- <?php //endif; ?>
60
- <?php endforeach; ?>
61
-
62
- </select>
63
- <br/>
64
- <?php if($this->getIsShipping()): ?>
65
- <input type="checkbox" id="order-shipping_same_as_billing" name="shipping_same_as_billing" onchange="order.setShippingAsBilling(this.checked)" <?php if($this->getIsAsBilling()): ?>checked<?php endif; ?>/>
66
- <label for="order-shipping_same_as_billing" class="no-float"><?php echo Mage::helper('sales')->__('Same As Billing Address') ?></label>
67
- <?php else: ?>
68
- &nbsp;
69
- <?php endif; ?>
70
- </div>
71
-
72
- <div class="order-address" id="<?php echo $_fieldsContainerId ?>">
73
- <div class="content">
74
- <?php echo $this->getForm()->toHtml() ?>
75
- </div>
76
- <div class="order-save-in-address-book">
77
- <input name="<?php echo $this->getForm()->getHtmlNamePrefix()?>[save_in_address_book]" type="checkbox" id="<?php echo $this->getForm()->getHtmlIdPrefix()?>save_in_address_book" value="1" <?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?>/>
78
- <label for="<?php echo $this->getForm()->getHtmlIdPrefix()?>save_in_address_book"><?php echo Mage::helper('sales')->__('Save in address book') ?></label>
79
- </div>
80
- </div>
81
- <?php $hideElement = 'address-' . ($this->getIsShipping() ? 'shipping' : 'billing') . '-overlay'; ?>
82
- <div style="display:none;" id="<?php echo $hideElement ?>" class="overlay"><span><?php echo $this->__('Shipping address selection is not applicable') ?></span></div>
83
- <script type="text/javascript">
84
- order.bindAddressFields('<?php echo $_fieldsContainerId ?>')
85
- <?php if($this->getIsShipping() && $this->getIsAsBilling()): ?>
86
- order.disableShippingAddress(true);
87
- <?php endif; ?>
88
- </script>
89
- </fieldset>
90
- </div>
91
- <script type="text/javascript">
92
- //<![CDATA[
93
- function _set_default_country() {
94
- <?php
95
- echo '
96
- var default_country="'.Mage::getStoreConfig('general/country/default').'";
97
- ';
98
- ?>
99
- if ('' == $('order-billing_address_country_id').value) {
100
- $('order-billing_address_country_id').value = default_country;
101
- }
102
- if ('' == $('order-shipping_address_country_id').value) {
103
- $('order-shipping_address_country_id').value = default_country;
104
- }
105
- }
106
- setTimeout(_set_default_country,1000);
107
- //]]>
108
- </script>
109
- <?php // CraftyClicks - Start
110
- $conf = Mage::getStoreConfig('general');
111
- if ($conf['craftyclicks']['active_admin'] && $this->getIsShipping()) :
112
- $cp_access_token = $conf['craftyclicks']['access_token'];
113
- ?>
114
- <script type="text/javascript" charset="ISO-8859-1" src="<?php echo $this->getJsUrl('craftyclicks/crafty_postcode.class.js'); ?>"></script>
115
- <script type="text/javascript">
116
- //<![CDATA[
117
- var cp_obj = new Array();
118
- function ch_country () {
119
- if (this.value!='GB') {
120
- $(this.alt+'findAddrBtn').style.display = 'none';
121
- $(this.alt+'postcode').setAttribute('style', '');
122
- } else {
123
- $(this.alt+'findAddrBtn').style.display = 'inline';
124
- $(this.alt+'postcode').setAttribute('style', 'width:80px !important');
125
- }
126
- }
127
-
128
- function do_look() {
129
- cp_obj[this.alt].doLookup();
130
- }
131
-
132
- function add_crafty_clicks(item_html_id) {
133
- if (!cp_obj[item_html_id]) {
134
- // create a crafty clicks object
135
- cp_obj[item_html_id] = CraftyPostcodeCreate();
136
- cp_obj[item_html_id].set("max_width", '100%');
137
- cp_obj[item_html_id].set("access_token", '<?php echo $cp_access_token; ?>');
138
- cp_obj[item_html_id].set("result_elem_id", item_html_id+'crafty');
139
- cp_obj[item_html_id].set("form", "");
140
- cp_obj[item_html_id].set("elements", item_html_id+"company,"+item_html_id+"street0,"+item_html_id+"street1,,"+item_html_id+"city,"+item_html_id+"region,"+item_html_id+"postcode");
141
- cp_obj[item_html_id].set("first_res_line", "----- please select your address ----");
142
- cp_obj[item_html_id].set("res_autoselect", "0");
143
- cp_obj[item_html_id].set("busy_img_url", "<?php echo $this->getJsUrl('crafty/crafty_postcode_busy.gif'); ?>");
144
-
145
- // create the 'find address' button
146
- var fndBtn;
147
- fndBtn = document.createElement('input');
148
- fndBtn.type='button';
149
- fndBtn.alt = item_html_id;
150
- fndBtn.id = item_html_id+'findAddrBtn';
151
- fndBtn.value='<?php echo $this->__('Find Address') ?>';
152
-
153
- $(item_html_id+'postcode').parentNode.appendChild(fndBtn);
154
- Event.observe(fndBtn.id, 'click', do_look);
155
-
156
- var resTr = document.createElement('tr');
157
- var resTd = document.createElement('td');
158
- resTd.colSpan = '3';
159
- resTd.id = item_html_id+'crafty'
160
- resTr.appendChild(resTd);
161
- var pcTr = $(item_html_id+'postcode').parentNode.parentNode;
162
- pcTr.parentNode.insertBefore(resTr, pcTr.nextSibling);
163
-
164
- $(item_html_id+'country_id').alt = item_html_id;
165
- Event.observe(item_html_id+'country_id', 'change', ch_country);
166
- }
167
- // make button visible if country is UK
168
- if ($(item_html_id+'country_id').value!='GB') {
169
- $(item_html_id+'findAddrBtn').style.display = 'none';
170
- $(item_html_id+'postcode').setAttribute('style', '');
171
- } else {
172
- $(item_html_id+'findAddrBtn').style.display = 'inline';
173
- $(item_html_id+'postcode').setAttribute('style', 'width:80px !important');
174
- }
175
- }
176
-
177
- function crafty_add_to_all_forms() {
178
- // alert ('crafty_add_to_all_forms');
179
- if (!$('order-billing_address_findAddrBtn') && !$('order-billing_address_postcode').disabled) {
180
- add_crafty_clicks('order-billing_address_');
181
- }
182
- if (!$('order-shipping_address_findAddrBtn') && !$('order-shipping_address_postcode').disabled) {
183
- add_crafty_clicks('order-shipping_address_');
184
- }
185
- }
186
-
187
- // This is crude, but the way magento does the address forms with javascript is hard to figure out.
188
- // Waiting a second before adding our element seems to guarantee that all the standard form fields
189
- // will already be in DOM ready for us to manipulate
190
- setTimeout(crafty_add_to_all_forms,1000);
191
- //]]>
192
- </script>
193
- <?php
194
- endif; // CraftyClicks - End ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/craftyclicks/checkout/onepage/billing.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  *
26
  *
@@ -42,7 +42,7 @@
42
  <fieldset>
43
  <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
44
  <ul>
45
- <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
46
  <li class="fields">
47
  <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
48
  <div class="field">
@@ -115,7 +115,7 @@
115
  <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
116
  <li class="wide" id="hideOnNewAddress_billing:street<?php echo $_i?>">
117
  <div class="input-box">
118
- <input type="text" title="<?php echo $this->__('Street Address '.$_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" />
119
  </div>
120
  </li>
121
  <?php endfor ?>
@@ -214,7 +214,7 @@
214
  <?php endif; ?>
215
  <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
216
  <li class="control">
217
- <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
218
  </li>
219
  <?php else:?>
220
  <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  *
26
  *
42
  <fieldset>
43
  <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
44
  <ul>
45
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
46
  <li class="fields">
47
  <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
48
  <div class="field">
115
  <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
116
  <li class="wide" id="hideOnNewAddress_billing:street<?php echo $_i?>">
117
  <div class="input-box">
118
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" />
119
  </div>
120
  </li>
121
  <?php endfor ?>
214
  <?php endif; ?>
215
  <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
216
  <li class="control">
217
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
218
  </li>
219
  <?php else:?>
220
  <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
app/design/frontend/base/default/template/craftyclicks/checkout/onepage/shipping.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  *
26
  *
@@ -114,7 +114,7 @@
114
  <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
115
  <li class="wide" id="hideOnNewAddress_shipping:street<?php echo $_i?>">
116
  <div class="input-box">
117
- <input type="text" title="<?php echo $this->__('Street Address '.$_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" onchange="shipping.setSameAsBilling(false);" />
118
  </div>
119
  </li>
120
  <?php endfor ?>
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  *
26
  *
114
  <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
115
  <li class="wide" id="hideOnNewAddress_shipping:street<?php echo $_i?>">
116
  <div class="input-box">
117
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" onchange="shipping.setSameAsBilling(false);" />
118
  </div>
119
  </li>
120
  <?php endfor ?>
app/design/frontend/base/default/template/craftyclicks/customer/address/edit.phtml CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @category design
22
  * @package base_default
23
- * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  *
26
  *
@@ -175,7 +175,7 @@
175
  <?php if($this->isDefaultBilling()): ?>
176
  <strong><?php echo $this->__('Default Billing Address') ?></strong>
177
  <?php elseif($this->canSetAsDefaultBilling()): ?>
178
- <input type="checkbox" id="primary_billing" name="default_billing" value="1" title="<?php echo $this->__('Use as my default billing address') ?>" class="checkbox" /><label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
179
  <?php else: ?>
180
  <input type="hidden" name="default_billing" value="1" />
181
  <?php endif; ?>
@@ -184,7 +184,7 @@
184
  <?php if($this->isDefaultShipping()): ?>
185
  <strong><?php echo $this->__('Default Shipping Address') ?></strong>
186
  <?php elseif($this->canSetAsDefaultShipping()): ?>
187
- <input type="checkbox" id="primary_shipping" name="default_shipping" value="1" title="<?php echo $this->__('Use as my default shipping address') ?>" class="checkbox" /><label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
188
  <?php else: ?>
189
  <input type="hidden" name="default_shipping" value="1" />
190
  <?php endif; ?>
@@ -193,7 +193,7 @@
193
  </div>
194
  <div class="buttons-set">
195
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
196
- <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
197
  <button type="submit" title="<?php echo $this->__('Save Address') ?>" class="button"><span><span><?php echo $this->__('Save Address') ?></span></span></button>
198
  </div>
199
  </form>
20
  *
21
  * @category design
22
  * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
  * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
  *
26
  *
175
  <?php if($this->isDefaultBilling()): ?>
176
  <strong><?php echo $this->__('Default Billing Address') ?></strong>
177
  <?php elseif($this->canSetAsDefaultBilling()): ?>
178
+ <input type="checkbox" id="primary_billing" name="default_billing" value="1" title="<?php echo $this->__('Use as My Default Billing Address') ?>" class="checkbox" /><label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
179
  <?php else: ?>
180
  <input type="hidden" name="default_billing" value="1" />
181
  <?php endif; ?>
184
  <?php if($this->isDefaultShipping()): ?>
185
  <strong><?php echo $this->__('Default Shipping Address') ?></strong>
186
  <?php elseif($this->canSetAsDefaultShipping()): ?>
187
+ <input type="checkbox" id="primary_shipping" name="default_shipping" value="1" title="<?php echo $this->__('Use as My Default Shipping Address') ?>" class="checkbox" /><label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
188
  <?php else: ?>
189
  <input type="hidden" name="default_shipping" value="1" />
190
  <?php endif; ?>
193
  </div>
194
  <div class="buttons-set">
195
  <p class="required"><?php echo $this->__('* Required Fields') ?></p>
196
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
197
  <button type="submit" title="<?php echo $this->__('Save Address') ?>" class="button"><span><span><?php echo $this->__('Save Address') ?></span></span></button>
198
  </div>
199
  </form>
app/etc/modules/CraftyClicks.xml CHANGED
@@ -4,7 +4,7 @@
4
  <CraftyClicks>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
- <version>2.2.0</version>
8
  </CraftyClicks>
9
  </modules>
10
  </config>
4
  <CraftyClicks>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
+ <version>2.3.0</version>
8
  </CraftyClicks>
9
  </modules>
10
  </config>
package.xml CHANGED
@@ -1,96 +1,99 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>UK_Postcode_Address_Finder</name>
4
- <version>2.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">Open Software License ("OSL") v. 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>UK address auto completion functionality. Uses CraftyClicks.co.uk web service to lookup address from a postcode.</summary>
10
- <description>This extension provides auto completion functionality on all postal address forms. Shoppers simply enter their postcode and are given a list of matching addresses to select from. Address entry is greatly speeded up thus improving the user experience.
11
-
12
- The benefits for the merchant are lower drop off rates on checkout/registration and improved quality of address data captured.
13
-
14
- Please note:
15
-
16
- 1. This extension currently only works for UK postcodes. If country selected is not UK, the 'find address' button is not shown.
17
-
18
- 2. The extension is free to try and install, but to go live a paid up account with CraftyClicks.co.uk will be required. For current prices please go to http://www.craftyclicks.co.uk/prices</description>
19
- <notes>Release History :
20
- v 2.2.0
21
- * added support for Gomage Light Checkout
22
-
23
- v 2.1.0
24
- * added support for One Step Checkout
25
-
26
- v 2.0.2
27
- * fix layout problem on in IE8 on onepage checkout
28
-
29
- v 2.0.1
30
- * fix minor typo in default config
31
-
32
- v 2.0
33
- * big re-design for compatibility with Magento 1.4
34
- * added ability to search by house name/number + postcode (previous versions can search by postcode only)
35
- * pressing enter key in the postcode input field does a search
36
-
37
- v 1.6.2
38
- * fix for Internet Explorer in admin panel -&gt; new customer page; the add address button didn't always work
39
- * use default country in admin pannel - Magento doesn't do this by default
40
- * 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
41
-
42
- v 1.6.1
43
- * fix for admin panel -&gt; sales pages; Added a 1s delay before CraftyClicks stuff is added to a form.
44
- In some rare cases the timing was such that the form may not yet exist in DOM when we tried to add
45
- address finder button etc.
46
-
47
- v 1.6.0
48
- * added address lookup to the admin panel, to change order of address fields please see the
49
- documentation tab - http://www.magentocommerce.com/boards/viewchild/17082/
50
-
51
- v 1.5.1
52
- * small modification following tests with the blank theme (changed order of initialisation in JavaScript)
53
-
54
- v 1.5.0
55
- * add config option for 1st result line.
56
- * avoid using JavaScript DOM for modifying address forms - it was conflicting with Magento JavaScript.
57
- We now edit the template .phtml files directly.
58
- * fix problems with re-displaying state select box when country is changed from UK to USA.
59
- * fix problem with postcode error message affecting button position if form was submitted with a blank postcode.
60
-
61
- v 1.4.0
62
- * make error message class configurable - it can now be styled to match other Magento errors
63
- * make error message text configurable
64
- * fix issue with error message not being shown if hiding of address fields was enabled
65
-
66
- v 1.3.0
67
- * populate the company field if company name is available
68
- * unhide all address lines on lookup error to allow customer to enter the address manually
69
- * update to latest CraftyClicks JavaScript (v3.5):
70
- - added the on_error event
71
- - fixed selection of result using keyboard (got broken in latest Firefox v3.5)
72
-
73
- v 1.2.0
74
- * can now hide the region/province (county) field
75
- * update to latest CraftyClicks JavaScript (v3.4)
76
-
77
- v 1.1.2 (bug fix release)
78
- * fix typo in JS code
79
-
80
- v 1.1.1 (bug fix release)
81
- * fix rearranging address fields order; was causing problems on one page checkout
82
- * fix hiding of result box on result select
83
- * hide result box on country change
84
-
85
- v 1.1.0
86
- * added Admin Panel options to configure look and feel of the module
87
- * add address lookup to multiship checkout pages
88
-
 
 
 
89
  v 1.0.0 - Initial Release</notes>
90
  <authors><author><name>Adam Stylo</name><user>auto-converted</user><email>adam@craftyclicks.co.uk</email></author></authors>
91
- <date>2010-11-27</date>
92
- <time>21:53:09</time>
93
- <contents><target name="mage"><dir name="app"><dir name="code"><dir name="local"><dir name="CraftyClicks"><dir name="etc"><file name="config.xml" hash="940f038d79a92d6d336c255f1671c98e"/><file name="system.xml" hash="07ddb428bc1240992d10312e66ace4b9"/></dir><dir name="Helper"><file name="Data.php" hash="e5f75947ad629aabb2e3cbcde412e2cc"/></dir></dir><dir name="GoMage"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><file name="Abstract.php" hash="1a48d38ef8ae8c0e27d0936072363138"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="customer"><dir name="tab"><file name="addresses.phtml" hash="20ca00a61ed999808e3535b53cdd2eba"/></dir></dir><dir name="sales"><dir name="order"><dir name="create"><dir name="form"><file name="address.phtml" hash="d55fddaedd5e9ce0d252356eb9bd648c"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="craftyclicks.xml" hash="24b821373c927e48d8792926d4c08a3e"/></dir><dir name="template"><dir name="craftyclicks"><file name="address_form.phtml" hash="ce78db884ae5a8e07077cb784ec23396"/><file name="checkout_onepage.phtml" hash="ae61a2ddca442037f1ec7c0d27f39e15"/><file name="crafty_template_helper.php" hash="07472c8777556ef6cf3a4f44d3135e8a"/><file name="gomage_lightcheckout.phtml" hash="02ebe07fb572db76d780ae57297458f6"/><file name="single_page_checkout.phtml" hash="f698c197a5817072b9f1f4ddb91dfc29"/><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="71fa1cb11da774ad814fa33802def9fa"/><file name="shipping.phtml" hash="aed3db630e10443fe23382b491ad0163"/></dir></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="d247da450fff8ad34e5e11cf1e85fe94"/></dir></dir></dir><dir name="onestepcheckout"><file name="billing_fields.phtml" hash="de0f72ce17353c66851bf07cc94f1186"/><file name="shipping_fields.phtml" hash="a9925881e75fcbbdca736aca8a7f103b"/><dir name="__orig_files_cc"><file name="billing_fields.phtml" hash="b1d163ad380094550685b81850d44ecf"/><file name="shipping_fields.phtml" hash="472ff7a3eebcd4a4869af1c3291ec720"/></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="CraftyClicks.xml" hash="df706a74bd4fb5125d8dfe07f7ca6dab"/></dir></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><target name="mageweb"><dir name="js"><dir name="craftyclicks"><file name="crafty_postcode.class.js" hash="a6c5e4e15764da8b51ed879e1143883a"/></dir></dir></target></contents>
94
  <compatible/>
95
  <dependencies/>
96
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>UK_Postcode_Address_Finder</name>
4
+ <version>2.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/osl-3.0.php">Open Software License ("OSL") v. 3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>UK address auto completion functionality. Uses CraftyClicks.co.uk web service to lookup address from a postcode.</summary>
10
+ <description>This extension provides auto completion functionality on all postal address forms. Shoppers simply enter their postcode and are given a list of matching addresses to select from. Address entry is greatly speeded up thus improving the user experience.&#xD;
11
+ &#xD;
12
+ The benefits for the merchant are lower drop off rates on checkout/registration and improved quality of address data captured.&#xD;
13
+ &#xD;
14
+ Please note:&#xD;
15
+ &#xD;
16
+ 1. This extension currently only works for UK postcodes. If country selected is not UK, the 'find address' button is not shown.&#xD;
17
+ &#xD;
18
+ 2. The extension is free to try and install, but to go live a paid up account with CraftyClicks will be required. For current prices please go to http://www.craftyclicks.co.uk/prices</description>
19
+ <notes>Release History :&#xD;
20
+ v 2.3.0&#xD;
21
+ * updated to support Magento v 1.5&#xD;
22
+ &#xD;
23
+ v 2.2.0&#xD;
24
+ * added support for Gomage Light Checkout&#xD;
25
+ &#xD;
26
+ v 2.1.0&#xD;
27
+ * added support for One Step Checkout&#xD;
28
+ &#xD;
29
+ v 2.0.2&#xD;
30
+ * fix layout problem on in IE8 on onepage checkout&#xD;
31
+ &#xD;
32
+ v 2.0.1 &#xD;
33
+ * fix minor typo in default config&#xD;
34
+ &#xD;
35
+ v 2.0&#xD;
36
+ * big re-design for compatibility with Magento 1.4&#xD;
37
+ * added ability to search by house name/number + postcode (previous versions can search by postcode only)&#xD;
38
+ * pressing enter key in the postcode input field does a search&#xD;
39
+ &#xD;
40
+ v 1.6.2&#xD;
41
+ * fix for Internet Explorer in admin panel -&gt; new customer page; the add address button didn't always work&#xD;
42
+ * use default country in admin pannel - Magento doesn't do this by default&#xD;
43
+ * 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&#xD;
44
+ &#xD;
45
+ v 1.6.1&#xD;
46
+ * fix for admin panel -&gt; sales pages; Added a 1s delay before CraftyClicks stuff is added to a form.&#xD;
47
+ In some rare cases the timing was such that the form may not yet exist in DOM when we tried to add&#xD;
48
+ address finder button etc.&#xD;
49
+ &#xD;
50
+ v 1.6.0&#xD;
51
+ * added address lookup to the admin panel, to change order of address fields please see the&#xD;
52
+ documentation tab - http://www.magentocommerce.com/boards/viewchild/17082/&#xD;
53
+ &#xD;
54
+ v 1.5.1&#xD;
55
+ * small modification following tests with the blank theme (changed order of initialisation in JavaScript)&#xD;
56
+ &#xD;
57
+ v 1.5.0&#xD;
58
+ * add config option for 1st result line.&#xD;
59
+ * avoid using JavaScript DOM for modifying address forms - it was conflicting with Magento JavaScript. &#xD;
60
+ We now edit the template .phtml files directly.&#xD;
61
+ * fix problems with re-displaying state select box when country is changed from UK to USA.&#xD;
62
+ * fix problem with postcode error message affecting button position if form was submitted with a blank postcode.&#xD;
63
+ &#xD;
64
+ v 1.4.0&#xD;
65
+ * make error message class configurable - it can now be styled to match other Magento errors&#xD;
66
+ * make error message text configurable&#xD;
67
+ * fix issue with error message not being shown if hiding of address fields was enabled&#xD;
68
+ &#xD;
69
+ v 1.3.0&#xD;
70
+ * populate the company field if company name is available&#xD;
71
+ * unhide all address lines on lookup error to allow customer to enter the address manually&#xD;
72
+ * update to latest CraftyClicks JavaScript (v3.5):&#xD;
73
+ - added the on_error event&#xD;
74
+ - fixed selection of result using keyboard (got broken in latest Firefox v3.5)&#xD;
75
+ &#xD;
76
+ v 1.2.0 &#xD;
77
+ * can now hide the region/province (county) field&#xD;
78
+ * update to latest CraftyClicks JavaScript (v3.4)&#xD;
79
+ &#xD;
80
+ v 1.1.2 (bug fix release)&#xD;
81
+ * fix typo in JS code&#xD;
82
+ &#xD;
83
+ v 1.1.1 (bug fix release)&#xD;
84
+ * fix rearranging address fields order; was causing problems on one page checkout&#xD;
85
+ * fix hiding of result box on result select&#xD;
86
+ * hide result box on country change&#xD;
87
+ &#xD;
88
+ v 1.1.0 &#xD;
89
+ * added Admin Panel options to configure look and feel of the module&#xD;
90
+ * add address lookup to multiship checkout pages&#xD;
91
+ &#xD;
92
  v 1.0.0 - Initial Release</notes>
93
  <authors><author><name>Adam Stylo</name><user>auto-converted</user><email>adam@craftyclicks.co.uk</email></author></authors>
94
+ <date>2011-02-16</date>
95
+ <time>21:53:58</time>
96
+ <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="b453c6246ac16f07f9b687dbbdd81980"/><file name="system.xml" hash="e1ce47e185d5e6a272cd0cecaaf84310"/></dir></dir><dir name="GoMage"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><file name="Abstract.php" hash="1a48d38ef8ae8c0e27d0936072363138"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="craftyclicks"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="97a1876612a1b8fe822d10c5e97d36bf"/><file name="shipping.phtml" hash="4c4fa3c1b2c106b9b9de0181cffe436c"/></dir></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="e3ed50dc65b227092ddc93285a4a1fc8"/></dir></dir><file name="address_form.phtml" hash="ce78db884ae5a8e07077cb784ec23396"/><file name="checkout_onepage.phtml" hash="ae61a2ddca442037f1ec7c0d27f39e15"/><file name="crafty_template_helper.php" hash="07472c8777556ef6cf3a4f44d3135e8a"/><file name="gomage_lightcheckout.phtml" hash="02ebe07fb572db76d780ae57297458f6"/><file name="single_page_checkout.phtml" hash="f698c197a5817072b9f1f4ddb91dfc29"/></dir><dir name="onestepcheckout"><dir name="__orig_files_cc"><file name="billing_fields.phtml" hash="b1d163ad380094550685b81850d44ecf"/><file name="shipping_fields.phtml" hash="472ff7a3eebcd4a4869af1c3291ec720"/></dir><file name="billing_fields.phtml" hash="de0f72ce17353c66851bf07cc94f1186"/><file name="shipping_fields.phtml" hash="a9925881e75fcbbdca736aca8a7f103b"/></dir></dir><dir name="layout"><file name="craftyclicks.xml" hash="24b821373c927e48d8792926d4c08a3e"/></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="CraftyClicks.xml" hash="04073ed64a45962da7ba2eb99f1a5829"/></dir></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><target name="mageweb"><dir name="js"><dir name="craftyclicks"><file name="crafty_postcode.class.js" hash="a6c5e4e15764da8b51ed879e1143883a"/></dir></dir></target></contents>
97
  <compatible/>
98
  <dependencies/>
99
  </package>