UK_Postcode_Address_Finder - Version 2.2.0

Version Notes

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


Code changes from version 1.7 to 2.2.0

Files changed (30) hide show
  1. app/code/local/CraftyClicks/Helper/Data.php +15 -0
  2. app/code/local/{Dnc/Craftyclicks → CraftyClicks}/etc/config.xml +12 -12
  3. app/code/local/{Dnc/Craftyclicks → CraftyClicks}/etc/system.xml +6 -6
  4. app/code/local/Dnc/Craftyclicks/Helper/Data.php +0 -15
  5. app/code/local/GoMage/Checkout/Block/Onepage/Abstract.php +233 -0
  6. app/design/adminhtml/default/default/template/customer/tab/addresses.phtml +21 -9
  7. app/design/adminhtml/default/default/template/sales/order/create/form/address.phtml +30 -4
  8. app/design/frontend/base/default/layout/craftyclicks.xml +46 -0
  9. app/design/frontend/{default/default/template/dnc → base/default/template}/craftyclicks/address_form.phtml +1 -1
  10. app/design/frontend/base/default/template/craftyclicks/checkout/onepage/billing.phtml +255 -0
  11. app/design/frontend/base/default/template/craftyclicks/checkout/onepage/shipping.phtml +206 -0
  12. app/design/frontend/base/default/template/craftyclicks/checkout_onepage.phtml +6 -0
  13. app/design/frontend/{default/default/template/dnc → base/default/template}/craftyclicks/crafty_template_helper.php +53 -29
  14. app/design/frontend/base/default/template/craftyclicks/customer/address/edit.phtml +205 -0
  15. app/design/frontend/base/default/template/craftyclicks/gomage_lightcheckout.phtml +6 -0
  16. app/design/frontend/{default/default/template/dnc/craftyclicks/checkout_onepage.phtml → base/default/template/craftyclicks/single_page_checkout.phtml} +2 -2
  17. app/design/frontend/base/default/template/onestepcheckout/__orig_files_cc/billing_fields.phtml +203 -0
  18. app/design/frontend/base/default/template/onestepcheckout/__orig_files_cc/shipping_fields.phtml +119 -0
  19. app/design/frontend/base/default/template/onestepcheckout/billing_fields.phtml +227 -0
  20. app/design/frontend/base/default/template/onestepcheckout/shipping_fields.phtml +142 -0
  21. app/design/frontend/default/default/layout/craftyclicks.xml +0 -42
  22. app/design/frontend/default/default/template/dnc/craftyclicks/checkout/onepage/billing.phtml +0 -175
  23. app/design/frontend/default/default/template/dnc/craftyclicks/checkout/onepage/shipping.phtml +0 -141
  24. app/design/frontend/default/default/template/dnc/craftyclicks/customer/address/edit.phtml +0 -174
  25. app/etc/modules/{Dnc_Craftyclicks.xml → CraftyClicks.xml} +3 -3
  26. js/crafty/crafty_postcode.js +0 -18
  27. js/craftyclicks/crafty_postcode.class.js +16 -0
  28. package.xml +20 -6
  29. skin/frontend/{default/default → base/default/images}/craftyclicks/button_find_address.gif +0 -0
  30. skin/frontend/{default/default → base/default/images}/craftyclicks/crafty_postcode_busy.gif +0 -0
app/code/local/CraftyClicks/Helper/Data.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Crafty Clicks - Address Finder
4
+ *
5
+ * @category CraftyClicks
6
+ * @package CraftyClicks
7
+ * @copyright CraftyClicks.co.uk
8
+ */
9
+
10
+ include_once 'Mage/Core/Helper/Abstract.php';
11
+
12
+ class CraftyClicks_Helper_Data extends Mage_Core_Helper_Abstract
13
+ {
14
+
15
+ }
app/code/local/{Dnc/Craftyclicks → CraftyClicks}/etc/config.xml RENAMED
@@ -1,27 +1,27 @@
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
- * Crafty Clicks
5
  *
6
- * @category DNC
7
- * @package Dnc_Craftyclicks
8
- * @copyright Tomasz Kapusta
9
  */
10
  -->
11
 
12
  <config>
13
  <modules>
14
- <Dnc_Craftyclicks>
15
- <version>1.7</version>
16
- </Dnc_Craftyclicks>
17
  </modules>
18
 
19
  <frontend>
20
  <layout>
21
  <updates>
22
- <dnc_craftyclicks>
23
  <file>craftyclicks.xml</file>
24
- </dnc_craftyclicks>
25
  </updates>
26
  </layout>
27
  </frontend>
@@ -29,7 +29,7 @@
29
  <global>
30
  <helpers>
31
  <craftyclicks>
32
- <class>Dnc_Craftyclicks_Helper</class>
33
  </craftyclicks>
34
  </helpers>
35
  </global>
@@ -39,10 +39,10 @@
39
  <craftyclicks>
40
  <active>0</active>
41
  <active_admin>0</active_admin>
42
- <model>dnc/craftyclicks</model>
43
  <access_token>xxxxx-xxxxx-xxxxx-xxxxx</access_token>
44
  <button_image></button_image>
45
- <button_class>form-button-alt</button_class>
46
  <hide_fields>0</hide_fields>
47
  <hide_county>1</hide_county>
48
  <clear_result>0</clear_result>
1
  <?xml version="1.0"?>
2
  <!--
3
  /**
4
+ * Crafty Clicks - Address Finder
5
  *
6
+ * @category CraftyClicks
7
+ * @package CraftyClicks
8
+ * @copyright CraftyClicks.co.uk
9
  */
10
  -->
11
 
12
  <config>
13
  <modules>
14
+ <CraftyClicks>
15
+ <version>2.2.0</version>
16
+ </CraftyClicks>
17
  </modules>
18
 
19
  <frontend>
20
  <layout>
21
  <updates>
22
+ <craftyclicks>
23
  <file>craftyclicks.xml</file>
24
+ </craftyclicks>
25
  </updates>
26
  </layout>
27
  </frontend>
29
  <global>
30
  <helpers>
31
  <craftyclicks>
32
+ <class>CraftyClicks_Helper</class>
33
  </craftyclicks>
34
  </helpers>
35
  </global>
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>
45
+ <button_class>button</button_class>
46
  <hide_fields>0</hide_fields>
47
  <hide_county>1</hide_county>
48
  <clear_result>0</clear_result>
app/code/local/{Dnc/Craftyclicks → CraftyClicks}/etc/system.xml RENAMED
@@ -3,9 +3,9 @@
3
  /**
4
  * Crafty Clicks
5
  *
6
- * @category DNC
7
- * @package Dnc_Craftyclicks
8
- * @copyright Tomasz Kapusta
9
  */
10
  -->
11
 
@@ -14,7 +14,7 @@
14
  <general>
15
  <groups>
16
  <craftyclicks translate="label" module="craftyclicks">
17
- <label>Crafty Clicks</label>
18
  <sort_order>124</sort_order>
19
  <show_in_default>1</show_in_default>
20
  <show_in_website>1</show_in_website>
@@ -56,7 +56,7 @@
56
  <show_in_default>1</show_in_default>
57
  <show_in_website>1</show_in_website>
58
  <show_in_store>0</show_in_store>
59
- <comment>Here you can enter an image file name to use as the 'Find Address' button. Leave blank for a default Magento button. Images should be placed under /craftclicks in you skin folder.</comment>
60
  </button_image>
61
 
62
  <button_class translate="label">
@@ -66,7 +66,7 @@
66
  <show_in_default>1</show_in_default>
67
  <show_in_website>1</show_in_website>
68
  <show_in_store>0</show_in_store>
69
- <comment>Here you can set the css class to use for the 'Find Address' button. Leave blank for a browser default button. Try 'form-button-alt'.</comment>
70
  </button_class>
71
 
72
  <hide_fields translate="label">
3
  /**
4
  * Crafty Clicks
5
  *
6
+ * @category CraftyClicks
7
+ * @package CraftyClicks_AddressFinder
8
+ * @copyright CraftyClicks.co.uk
9
  */
10
  -->
11
 
14
  <general>
15
  <groups>
16
  <craftyclicks translate="label" module="craftyclicks">
17
+ <label>Crafty Clicks - Address Finder</label>
18
  <sort_order>124</sort_order>
19
  <show_in_default>1</show_in_default>
20
  <show_in_website>1</show_in_website>
56
  <show_in_default>1</show_in_default>
57
  <show_in_website>1</show_in_website>
58
  <show_in_store>0</show_in_store>
59
+ <comment>Here you can enter an image file name to use as the 'Find Address' button. Leave blank for a default Magento button. Images should be placed under images/craftclicks in you skin folder.</comment>
60
  </button_image>
61
 
62
  <button_class translate="label">
66
  <show_in_default>1</show_in_default>
67
  <show_in_website>1</show_in_website>
68
  <show_in_store>0</show_in_store>
69
+ <comment>Here you can set the css class to use for the 'Find Address' button. Leave blank for a browser default button. Try 'button'.</comment>
70
  </button_class>
71
 
72
  <hide_fields translate="label">
app/code/local/Dnc/Craftyclicks/Helper/Data.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- /**
3
- * Crafty Clicks
4
- *
5
- * @category DNC
6
- * @package Dnc_Craftyclicks
7
- * @copyright Tomasz Kapusta
8
- */
9
-
10
- include_once 'Mage/Core/Helper/Abstract.php';
11
-
12
- class Dnc_Craftyclicks_Helper_Data extends Mage_Core_Helper_Abstract
13
- {
14
-
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/GoMage/Checkout/Block/Onepage/Abstract.php ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * GoMage.com
4
+ *
5
+ * GoMage LightCheckout Extension
6
+ *
7
+ * @category Extension
8
+ * @copyright Copyright (c) 2010 GoMage.com (http://www.gomage.com)
9
+ * @author GoMage.com
10
+ * @license http://www.gomage.com/licensing Single domain license
11
+ * @terms of use http://www.gomage.com/terms-of-use
12
+ * @version Release: 1.0
13
+ * @since Class available since Release 1.0
14
+ */
15
+
16
+
17
+ class GoMage_Checkout_Block_Onepage_Abstract extends Mage_Checkout_Block_Onepage_Abstract{
18
+
19
+ protected $mode;
20
+ protected $helper;
21
+ protected $default_address_template = 'gomage/checkout/html/address/field/default.phtml';
22
+ protected $field_code_to_label = array('company'=>'Company', 'street'=>'Street', 'city'=>'City', 'telephone'=>'Telephone', 'fax'=>'Fax', 'postcode'=>'Zip/Postal', 'country_id'=>'Country', 'region'=>'State/Province');
23
+
24
+ public function __construct(){
25
+ $this->helper = Mage::helper('gomage_checkout');
26
+ }
27
+
28
+ public function getCustomerComment(){
29
+ return $this->getQuote()->getGomageCheckoutCustomerComment();
30
+ }
31
+
32
+ public function getCheckoutMode(){
33
+
34
+ if(is_null($this->mode)){
35
+ $this->mode = intval($this->helper->getCheckoutMode());
36
+ }
37
+
38
+ return $this->mode;
39
+
40
+ }
41
+
42
+ public function getConfigData($node){
43
+ return $this->helper->getConfigData($node);
44
+ }
45
+
46
+ public function isEnabled($node){
47
+ return (bool) $this->getConfigData('address_fields/'.$node);
48
+ }
49
+ public function getDefaultCountryId(){
50
+ return $this->helper->getDefaultCountryId();
51
+ }
52
+ public function getDefaultShippingMethod(){
53
+ return $this->helper->getDefaultShippingMethod();
54
+ }
55
+ public function getDefaultPaymentMethod(){
56
+ return $this->helper->getDefaultPaymentMethod();
57
+ }
58
+
59
+ public function getSortedFields(){
60
+
61
+ $address_fields = array('company','street','city','telephone','fax','postcode','country_id','region');
62
+ $rows = array();
63
+
64
+ foreach(Mage::getStoreConfig('gomage_checkout/address_fields') as $field_name=>$status){
65
+
66
+ if($status != false){
67
+ if(in_array($field_name, $address_fields)){
68
+ $order = intval(Mage::getStoreConfig('gomage_checkout/address_sort/'.$field_name.'_order'));
69
+ if(!isset($rows[$order]) || count($rows[$order]) < 2){
70
+
71
+ $rows[$order][] = $field_name;
72
+
73
+ }else{
74
+ $rows[] = array($field_name);
75
+ }
76
+ }
77
+
78
+ }
79
+
80
+
81
+ }
82
+
83
+ ksort($rows);
84
+
85
+ echo $this->_renderFields($rows);
86
+
87
+
88
+ }
89
+
90
+ protected function _renderCraftyClicksButton() {
91
+ $_html = '';
92
+ $doLookupFn = 'onclick="_cp_do_lookup()"';
93
+ $divId = 'id="findAddrBtnDiv"';
94
+ if ('shipping' == $this->prefix) {
95
+ $doLookupFn = 'onclick="_cp_do_lookup2()"';
96
+ $divId = 'id="findAddrBtnDiv2"';
97
+ }
98
+ $_html .= '<div class="field field-last" '.$divId.'><br/><div>&nbsp;';
99
+ if ('' != Mage::getStoreConfig('general/craftyclicks/button_image')){
100
+ $_html .= '<img style="cursor: pointer;" src="'.$this->getSkinUrl('images/craftyclicks/'.Mage::getStoreConfig('general/craftyclicks/button_image')).'" '.$doLookupFn.' title="Find Address" class="'.Mage::getStoreConfig('general/craftyclicks/button_class').'"/>';
101
+ } else {
102
+ $_html .= '<button type="button" '.$doLookupFn.' title="Find Address" class="'.Mage::getStoreConfig('general/craftyclicks/button_class').'"><span><span>Find Address</span></span></button>';
103
+ }
104
+ $_html .= '</div></div>';
105
+
106
+
107
+ return ($_html);
108
+ }
109
+
110
+ protected function _renderFields($fields){
111
+
112
+ $html = '';
113
+
114
+ foreach($fields as $_fields){
115
+ if(is_array($_fields)){
116
+
117
+ $_cc_add_result_box = false;
118
+
119
+ if(count($_fields) > 1){
120
+
121
+ $data = array();
122
+
123
+ $_html = '';
124
+
125
+ $i = 0;
126
+
127
+ $row_class = array();
128
+
129
+ foreach($_fields as $field_code){
130
+
131
+
132
+ $data = array(
133
+
134
+ 'prefix'=>$this->prefix,
135
+ 'value'=>$this->getAddress()->getData($field_code),
136
+ 'label'=>@$this->field_code_to_label[$field_code],
137
+ 'input_name'=>$this->prefix.'['.$field_code.']',
138
+ 'input_id'=>$this->prefix.'_'.$field_code,
139
+
140
+ );
141
+
142
+ if($this->getConfigData('address_fields/'.$field_code) == 'req'){
143
+
144
+ $data['is_required'] = true;
145
+
146
+ }
147
+
148
+ if(!($template = $this->getData($field_code.'_template'))){
149
+ $template = $this->default_address_template;
150
+ }
151
+
152
+ $_html .= '<div class="field field-'.$field_code.' '.($i%2 == 0 ? ' field-first ' : ' field-last ').'" ';
153
+ if ('company' == $field_code || 'city' == $field_code) {
154
+ $_html .= 'id="hideOnNewAddress_'.$this->prefix.'_'.$field_code.'" ';
155
+ } else if ('street' == $field_code) {
156
+ $_html .= 'id="hideOnNewAddress_'.$this->prefix.'_street1" ';
157
+ } else if ('region' == $field_code) {
158
+ $_html .= 'id="countyDiv'.($this->prefix=='billing'?'':'2').'" ';
159
+ }
160
+ $_html .= '>'.$this->getLayout()->createBlock('gomage_checkout/onepage_'.$this->prefix)->setTemplate($template)->addData($data)->toHtml().'</div>';
161
+
162
+ if ('postcode' == $field_code) {
163
+ // add the button
164
+ $_html .= $this->_renderCraftyClicksButton();
165
+ $_cc_add_result_box = true;
166
+ }
167
+
168
+ $row_class[] = $field_code;
169
+
170
+ if(++$i == 2){
171
+ break;
172
+ }
173
+ }
174
+
175
+ $html .= '<li class="fields '.implode('-', $row_class).'">'.$_html.'</li>';
176
+
177
+ }else{
178
+
179
+ $field_code = array_shift($_fields);
180
+
181
+ $data = array(
182
+ 'prefix'=>$this->prefix,
183
+ 'address_prefix'=>$this->prefix,
184
+ 'value'=>$this->getAddress()->getData($field_code),
185
+ 'label'=>@$this->field_code_to_label[$field_code],
186
+ 'input_name'=>$this->prefix.'['.$field_code.']',
187
+ 'input_id'=>$this->prefix.'_'.$field_code,
188
+ );
189
+
190
+ if($this->getConfigData('address_fields/'.$field_code) == 'req'){
191
+
192
+ $data['is_required'] = true;
193
+
194
+ }
195
+
196
+ if(!($template = $this->getData($field_code.'_template'))){
197
+ $template = $this->default_address_template;
198
+ }
199
+
200
+ $_pre_html = '<div ';
201
+ if ('company' == $field_code || 'city' == $field_code) {
202
+ $_pre_html .= 'id="hideOnNewAddress_'.$this->prefix.'_'.$field_code.'" ';
203
+ } else if ('street' == $field_code) {
204
+ $_pre_html .= 'id="hideOnNewAddress_'.$this->prefix.'_street1" ';
205
+ } else if ('region' == $field_code) {
206
+ $_pre_html .= 'id="countyDiv'.($this->prefix=='billing'?'':'2').'" ';
207
+ }
208
+ $_html = $this->getLayout()->createBlock('gomage_checkout/onepage_'.$this->prefix)->setTemplate($template)->addData($data)->toHtml();
209
+ if ('postcode' == $field_code) {
210
+ // add the button
211
+ $html .= '<li class="fields '.$field_code.'">';
212
+ $html .= $_pre_html.'class="field field-'.$field_code.' field-first">'.$_html.'</div>';
213
+ $html .= $this->_renderCraftyClicksButton();
214
+ $html .= '</li>';
215
+ $_cc_add_result_box = true;
216
+ } else {
217
+ $html .= '<li>'.$_pre_html.'>'.$_html.'</li>';
218
+ }
219
+ }
220
+
221
+ if ($_cc_add_result_box) {
222
+ $html .= '
223
+ <li><span style="display:none;" id="crafty_postcode_result_display'.($this->prefix=='billing'?'':'2').'">&nbsp;</span></li>';
224
+ }
225
+ }
226
+ }
227
+
228
+ return $html;
229
+
230
+
231
+ }
232
+
233
+ }
app/design/adminhtml/default/default/template/customer/tab/addresses.phtml CHANGED
@@ -18,10 +18,10 @@
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_default
22
- * @package Mage
23
- * @copyright Copyright (c) 2008 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 -->
@@ -123,7 +123,7 @@
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('crafty/crafty_postcode.js'); ?>"></script>
127
  <script type="text/javascript">
128
  //<![CDATA[
129
  var cp_obj = new Array();
@@ -194,6 +194,10 @@ addressesModel.prototype = {
194
  Element.hide($('form_'+item.id));
195
  $('form_'+item.id).statusBar = item;
196
  $('form_'+item.id).addressItem = item;
 
 
 
 
197
  }
198
  },
199
 
@@ -290,7 +294,7 @@ addressesModel.prototype = {
290
  }
291
  },
292
 
293
- setAddressAsDefault : function(){
294
  for(var i=0; i<this.itemList.length;i++){
295
  if(this.itemList[i].id){
296
  var inputs = $(this.itemList[i].id).getElementsBySelector('input');
@@ -422,7 +426,7 @@ if ($conf['craftyclicks']['active_admin']) : ?>
422
  $(item_html_id+'findAddrBtn').style.display = 'none';
423
  else
424
  $(item_html_id+'findAddrBtn').style.display = 'inline';
425
- },
426
  <?php endif // CraftyClicks - End ?>
427
 
428
  getFormContainerFields : function(container){
@@ -485,7 +489,7 @@ if ($conf['craftyclicks']['active_admin']) : ?>
485
 
486
  deleteAddress : function(item){
487
  if(confirm('<?php echo Mage::helper('customer')->__('Are you sure you want to delete this address?') ?>')){
488
- if( item.isNewAddress){
489
  if ( this.activeItem == item ) this.formContainer.removeChild(item.formBlock);
490
  } else {
491
  if($('deleted_'+item.id)){
@@ -524,7 +528,13 @@ if ($conf['craftyclicks']['active_admin']) : ?>
524
 
525
  bindCountryRegionRelation : function(parentId){
526
  //alert('OK');
527
- var countryElements = $$('.countries');
 
 
 
 
 
 
528
  for(var i=0;i<=countryElements.length;i++){
529
  if(countryElements[i]){
530
  if(!countryElements[i].bindRegions || !countryElements[i].parentBindId || countryElements[i].parentBindId!=parentId){
@@ -547,6 +557,8 @@ if ($conf['craftyclicks']['active_admin']) : ?>
547
  var url = this.regionsUrl+'parent/'+countryElement.value;
548
  this.loader.load(url, {}, this.refreshRegionField.bind(this));
549
  }
 
 
550
  }
551
  },
552
 
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 -->
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();
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
 
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');
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){
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)){
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){
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
 
app/design/adminhtml/default/default/template/sales/order/create/form/address.phtml CHANGED
@@ -1,4 +1,29 @@
1
- <?php if($this->getIsShipping()):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  $_fieldsContainerId = 'order-shipping_address_fields';
3
  ?>
4
  <script type="text/javascript">
@@ -15,13 +40,14 @@ else:
15
  <?php
16
  endif; ?>
17
  <div class="entry-edit">
 
18
  <div class="entry-edit-head">
19
  <h4 class="icon-head fieldset-legend <?php echo $this->getHeaderCssClass() ?>"><?php echo $this->getHeaderText() ?></h4>
20
  </div>
21
 
22
  <fieldset class="np">
23
  <div class="order-choose-address">
24
- <?php echo Mage::helper('sales')->__('Select from existing customer addresses:') ?><br />
25
  <?php $_id = $this->getForm()->getHtmlIdPrefix() . 'customer_address_id' ?>
26
  <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 ?>')">
27
  <option value=""><?php echo Mage::helper('sales')->__('Add New Address') ?></option>
@@ -34,7 +60,7 @@ endif; ?>
34
  <?php endforeach; ?>
35
 
36
  </select>
37
- <br />
38
  <?php if($this->getIsShipping()): ?>
39
  <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; ?>/>
40
  <label for="order-shipping_same_as_billing" class="no-float"><?php echo Mage::helper('sales')->__('Same As Billing Address') ?></label>
@@ -85,7 +111,7 @@ $conf = Mage::getStoreConfig('general');
85
  if ($conf['craftyclicks']['active_admin'] && $this->getIsShipping()) :
86
  $cp_access_token = $conf['craftyclicks']['access_token'];
87
  ?>
88
- <script type="text/javascript" charset="ISO-8859-1" src="<?php echo $this->getJsUrl('crafty/crafty_postcode.js'); ?>"></script>
89
  <script type="text/javascript">
90
  //<![CDATA[
91
  var cp_obj = new Array();
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">
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>
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>
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();
app/design/frontend/base/default/layout/craftyclicks.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout>
4
+
5
+ <checkout_onepage_index>
6
+ <reference name="checkout.onepage.billing">
7
+ <action method="setTemplate"><template>craftyclicks/checkout/onepage/billing.phtml</template></action>
8
+ </reference>
9
+ <reference name="checkout.onepage.shipping">
10
+ <action method="setTemplate"><template>craftyclicks/checkout/onepage/shipping.phtml</template></action>
11
+ </reference>
12
+ <reference name="before_body_end">
13
+ <block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="craftyclicks/checkout_onepage.phtml"/>
14
+ </reference>
15
+ </checkout_onepage_index>
16
+
17
+ <checkout_multishipping_customer_address>
18
+ <reference name="customer_address_edit">
19
+ <action method="setTemplate"><template>craftyclicks/customer/address/edit.phtml</template></action>
20
+ </reference>
21
+ <reference name="before_body_end">
22
+ <block type="customer/address_edit" name="customer.address.edit" as="shipping" template="craftyclicks/address_form.phtml"/>
23
+ </reference>
24
+ </checkout_multishipping_customer_address>
25
+
26
+ <customer_address_form>
27
+ <reference name="customer_address_edit">
28
+ <action method="setTemplate"><template>craftyclicks/customer/address/edit.phtml</template></action>
29
+ </reference>
30
+ <reference name="before_body_end">
31
+ <block type="customer/address_edit" name="customer.address.edit" template="craftyclicks/address_form.phtml"/>
32
+ </reference>
33
+ </customer_address_form>
34
+
35
+ <onestepcheckout_index_index>
36
+ <reference name="before_body_end">
37
+ <block type="onestepcheckout/checkout" name="onestepcheckout.craftyclicks" as="craftyclicks" template="craftyclicks/single_page_checkout.phtml"/>
38
+ </reference>
39
+ </onestepcheckout_index_index>
40
+
41
+ <gomage_checkout_onepage_index>
42
+ <reference name="before_body_end">
43
+ <block type="gomage_checkout/onepage" name="gomage_checkout.craftyclicks" as="craftyclicks" template="craftyclicks/gomage_lightcheckout.phtml"/>
44
+ </reference>
45
+ </gomage_checkout_onepage_index>
46
+ </layout>
app/design/frontend/{default/default/template/dnc → base/default/template}/craftyclicks/address_form.phtml RENAMED
@@ -1,5 +1,5 @@
1
  <?php
2
  require ('crafty_template_helper.php');
3
 
4
- crafty_add_address_finder($this, '', 'company', 'street_', 'city', 'region', 'zip', 'country');
5
  ?>
1
  <?php
2
  require ('crafty_template_helper.php');
3
 
4
+ crafty_add_address_finder($this, '', 'company', 'street_', 'city', 'region', 'zip', 'country', '530px');
5
  ?>
app/design/frontend/base/default/template/craftyclicks/checkout/onepage/billing.phtml ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 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
+ *
27
+ * NOTE - this file is modified to include the CraftyClicks Address Finder Extension
28
+ */
29
+ ?>
30
+ <form id="co-billing-form" action="">
31
+ <fieldset>
32
+ <ul class="form-list">
33
+ <?php if ($this->customerHasAddresses()): ?>
34
+ <li class="wide">
35
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
36
+ <div class="input-box">
37
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
38
+ </div>
39
+ </li>
40
+ <?php endif; ?>
41
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
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">
49
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
50
+ <div class="input-box">
51
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
52
+ </div>
53
+ </div>
54
+ <?php endif ?>
55
+ <?php if(!$this->isCustomerLoggedIn()): ?>
56
+ <div class="field">
57
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
58
+ <div class="input-box">
59
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
60
+ </div>
61
+ </div>
62
+ <?php endif ?>
63
+ </li>
64
+ <?php if (1 == Mage::getStoreConfig('general/craftyclicks/active')) : // for CraftyClicks we put country & postcode above other address fields ?>
65
+ <li class="fields">
66
+ <div class="field">
67
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
68
+ <div class="input-box">
69
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
70
+ </div>
71
+ </div>
72
+ <?php if (1 == Mage::getStoreConfig('general/craftyclicks/house_search')) : ?>
73
+ </li>
74
+ <li class="fields">
75
+ <div class="field" id="houseSearchDiv">
76
+ <label for="crafty_in_search_string"><?php echo $this->__('House Name or Number') ?></label>
77
+ <div class="input-box">
78
+ <input type="text" title="<?php echo $this->__('House Name or Number') ?>" name="crafty_in_search_string" id="crafty_in_search_string" class="input-text" />
79
+ </div>
80
+ </div>
81
+ <?php endif ?>
82
+ <div class="field" id="zipDiv">
83
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
84
+ <div class="input-box">
85
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry"/>
86
+ </div>
87
+ </div>
88
+ <div class="field" id="findAddrBtnDiv" style="display:none;"><br />
89
+ &nbsp;
90
+ <?php if ('' != Mage::getStoreConfig('general/craftyclicks/button_image')) : ?>
91
+ <img style="cursor: pointer;" src="<?php echo $this->getSkinUrl('images/craftyclicks/'.Mage::getStoreConfig('general/craftyclicks/button_image')); ?>" onclick="_cp_do_lookup()" title="Find Address" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>"/>
92
+ <?php else : ?>
93
+ <button type="button" onclick="_cp_do_lookup()" title="Find Address" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>"><span><span>Find Address</span></span></button>
94
+ <?php endif ?>
95
+ </div>
96
+ </li>
97
+ <li class="fields">
98
+ <span style="display:none;" id="crafty_postcode_result_display">&nbsp;</span>
99
+ </li>
100
+ <li class="fields" id="hideOnNewAddress_billing:company">
101
+ <div class="field">
102
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
103
+ <div class="input-box">
104
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
105
+ </div>
106
+ </div>
107
+ </li>
108
+ <?php endif ?>
109
+ <li class="wide" id="hideOnNewAddress_billing:street1">
110
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
111
+ <div class="input-box">
112
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" />
113
+ </div>
114
+ </li>
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 ?>
122
+ <li class="fields" id="hideOnNewAddress_billing:city">
123
+ <div class="field">
124
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
125
+ <div class="input-box">
126
+ <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="input-text required-entry" id="billing:city" />
127
+ </div>
128
+ </div>
129
+ <div class="field" id="countyDiv">
130
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
131
+ <div class="input-box">
132
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
133
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
134
+ </select>
135
+ <script type="text/javascript">
136
+ //<![CDATA[
137
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
138
+ //]]>
139
+ </script>
140
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
141
+ </div>
142
+ </div>
143
+ </li>
144
+ <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : // for CraftyClicks we put country & postcode above other address fields ?>
145
+ <li class="fields">
146
+ <div class="field">
147
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
148
+ <div class="input-box">
149
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" />
150
+ </div>
151
+ </div>
152
+ <div class="field">
153
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
154
+ <div class="input-box">
155
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
156
+ </div>
157
+ </div>
158
+ </li>
159
+ <?php endif ?>
160
+ <li lang="fields">
161
+ <div class="field">
162
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
163
+ <div class="input-box">
164
+ <input type="text" name="billing[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="billing:telephone" />
165
+ </div>
166
+ </div>
167
+ <div class="field">
168
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
169
+ <div class="input-box">
170
+ <input type="text" name="billing[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="billing:fax" />
171
+ </div>
172
+ </div>
173
+ </li>
174
+ <?php if(!$this->isCustomerLoggedIn()): ?>
175
+
176
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
177
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
178
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
179
+ <li class="fields">
180
+ <?php if ($_dob->isEnabled()): ?>
181
+ <div class="field">
182
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
183
+ </div>
184
+ <?php endif; ?>
185
+ <?php if ($_gender->isEnabled()): ?>
186
+ <div class="field">
187
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
188
+ </div>
189
+ <?php endif ?>
190
+ </li>
191
+ <?php endif ?>
192
+
193
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
194
+ <?php if ($_taxvat->isEnabled()): ?>
195
+ <li>
196
+ <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
197
+ </li>
198
+ <?php endif ?>
199
+
200
+ <li class="fields" id="register-customer-password">
201
+ <div class="field">
202
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
203
+ <div class="input-box">
204
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
205
+ </div>
206
+ </div>
207
+ <div class="field">
208
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
209
+ <div class="input-box">
210
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
211
+ </div>
212
+ </div>
213
+ </li>
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>
221
+ <?php endif; ?>
222
+ </ul>
223
+ </fieldset>
224
+ </li>
225
+ <?php if ($this->canShip()): ?>
226
+ <li class="control">
227
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
228
+ <li class="control">
229
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
230
+ </li>
231
+ <?php endif; ?>
232
+ </ul>
233
+ <?php if (!$this->canShip()): ?>
234
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
235
+ <?php endif; ?>
236
+ <div class="buttons-set" id="billing-buttons-container">
237
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
238
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
239
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
240
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
241
+ </span>
242
+ </div>
243
+ </fieldset>
244
+ </form>
245
+ <script type="text/javascript">
246
+ //<![CDATA[
247
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
248
+ var billingForm = new VarienForm('co-billing-form');
249
+
250
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
251
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
252
+
253
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions, undefined, 'billing:postcode');
254
+ //]]>
255
+ </script>
app/design/frontend/base/default/template/craftyclicks/checkout/onepage/shipping.phtml ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 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
+ *
27
+ * NOTE - this file is modified to include the CraftyClicks Address Finder Extension
28
+ */
29
+ ?>
30
+ <form action="" id="co-shipping-form">
31
+ <ul class="form-list">
32
+ <?php if ($this->customerHasAddresses()): ?>
33
+ <li class="wide">
34
+ <label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
35
+ <div class="input-box">
36
+ <?php echo $this->getAddressesHtmlSelect('shipping') ?>
37
+ </div>
38
+ </li>
39
+ <?php endif ?>
40
+ <li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
41
+ <fieldset>
42
+ <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
43
+ <ul>
44
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
45
+ <li class="fields">
46
+ <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
47
+ <div class="fields">
48
+ <label for="shipping:company"><?php echo $this->__('Company') ?></label>
49
+ <div class="input-box">
50
+ <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" onchange="shipping.setSameAsBilling(false);" />
51
+ </div>
52
+ </div>
53
+ <?php endif ?>
54
+ <?php if(false): ?>
55
+ <div class="fields">
56
+ <label for="shipping:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
57
+ <div class="input-box">
58
+ <input type="text" name="shipping[email]" id="shipping:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
59
+ </div>
60
+ </div>
61
+ <?php endif ?>
62
+ </li>
63
+ <?php if (1 == Mage::getStoreConfig('general/craftyclicks/active')) : // for CraftyClicks we put country & postcode above other address fields ?>
64
+ <li class="fields">
65
+ <div class="field">
66
+ <label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
67
+ <div class="input-box">
68
+ <?php echo $this->getCountryHtmlSelect('shipping') ?>
69
+ </div>
70
+ </div>
71
+ <?php if (1 == Mage::getStoreConfig('general/craftyclicks/house_search')) : ?>
72
+ </li>
73
+ <li class="fields">
74
+ <div class="field" id="houseSearchDiv2">
75
+ <label for="crafty_in_search_string2"><?php echo $this->__('House Name or Number') ?></label>
76
+ <div class="input-box">
77
+ <input type="text" title="<?php echo $this->__('House Name or Number') ?>" name="crafty_in_search_string2" id="crafty_in_search_string2" class="input-text" />
78
+ </div>
79
+ </div>
80
+ <?php endif ?>
81
+ <div class="field" id="zipDiv2">
82
+ <label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
83
+ <div class="input-box">
84
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" onchange="shipping.setSameAsBilling(false);" />
85
+ </div>
86
+ </div>
87
+ <div class="field" id="findAddrBtnDiv2" style="display:none;"><br />
88
+ &nbsp;
89
+ <?php if ('' != Mage::getStoreConfig('general/craftyclicks/button_image')) : ?>
90
+ <img style="cursor: pointer;" src="<?php echo $this->getSkinUrl('images/craftyclicks/'.Mage::getStoreConfig('general/craftyclicks/button_image')); ?>" onclick="_cp_do_lookup2()" title="Find Address" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>"/>
91
+ <?php else : ?>
92
+ <button type="button" onclick="_cp_do_lookup2()" title="Find Address" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>"><span><span>Find Address</span></span></button>
93
+ <?php endif ?>
94
+ </div>
95
+ </li>
96
+ <li class="fields">
97
+ <span style="display:none;" id="crafty_postcode_result_display2">&nbsp;</span>
98
+ </li>
99
+ <li class="fields" id="hideOnNewAddress_shipping:company">
100
+ <div class="fields">
101
+ <label for="shipping:company"><?php echo $this->__('Company') ?></label>
102
+ <div class="input-box">
103
+ <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" onchange="shipping.setSameAsBilling(false);" />
104
+ </div>
105
+ </div>
106
+ </li>
107
+ <?php endif ?>
108
+ <li class="wide" id="hideOnNewAddress_shipping:street1">
109
+ <label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
110
+ <div class="input-box">
111
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" onchange="shipping.setSameAsBilling(false);" />
112
+ </div>
113
+ </li>
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 ?>
121
+ <li class="fields" id="hideOnNewAddress_shipping:city">
122
+ <div class="field">
123
+ <label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
124
+ <div class="input-box">
125
+ <input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="input-text required-entry" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
126
+ </div>
127
+ </div>
128
+ <div class="field" id="countyDiv2">
129
+ <label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
130
+ <div class="input-box">
131
+ <select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
132
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
133
+ </select>
134
+ <script type="text/javascript">
135
+ //<![CDATA[
136
+ $('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
137
+ //]]>
138
+ </script>
139
+ <input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
140
+ </div>
141
+ </div>
142
+ </li>
143
+ <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : // for CraftyClicks we put country & postcode above other address fields ?>
144
+ <li class="fields">
145
+ <div class="field">
146
+ <label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
147
+ <div class="input-box">
148
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" onchange="shipping.setSameAsBilling(false);" />
149
+ </div>
150
+ </div>
151
+ <div class="field">
152
+ <label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
153
+ <div class="input-box">
154
+ <?php echo $this->getCountryHtmlSelect('shipping') ?>
155
+ </div>
156
+ </div>
157
+ </li>
158
+ <?php endif ?>
159
+ <li class="fields">
160
+ <div class="field">
161
+ <label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
162
+ <div class="input-box">
163
+ <input type="text" name="shipping[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
164
+ </div>
165
+ </div>
166
+ <div class="field">
167
+ <label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
168
+ <div class="input-box">
169
+ <input type="text" name="shipping[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
170
+ </div>
171
+ </div>
172
+ </li>
173
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
174
+ <li class="control">
175
+ <input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
176
+ <?php else:?>
177
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
178
+ <?php endif;?>
179
+ </ul>
180
+ </fieldset>
181
+ </li>
182
+ <li class="control">
183
+ <input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
184
+ </li>
185
+ </ul>
186
+ <div class="buttons-set" id="shipping-buttons-container">
187
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
188
+ <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
189
+ <button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
190
+ <span id="shipping-please-wait" class="please-wait" style="display:none;">
191
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
192
+ </span>
193
+ </div>
194
+ </form>
195
+ <script type="text/javascript">
196
+ //<![CDATA[
197
+ var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
198
+ '<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
199
+ var shippingForm = new VarienForm('co-shipping-form');
200
+ shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
201
+ //shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
202
+ $('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
203
+
204
+ var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', countryRegions, undefined, 'shipping:postcode');
205
+ //]]>
206
+ </script>
app/design/frontend/base/default/template/craftyclicks/checkout_onepage.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ require ('crafty_template_helper.php');
3
+
4
+ crafty_add_address_finder($this, '', 'billing:company', 'billing:street', 'billing:city', 'billing:region', 'billing:postcode', 'billing:country_id', '530px');
5
+ crafty_add_address_finder($this, '2', 'shipping:company', 'shipping:street', 'shipping:city', 'shipping:region', 'shipping:postcode', 'shipping:country_id', '530px');
6
+ ?>
app/design/frontend/{default/default/template/dnc → base/default/template}/craftyclicks/crafty_template_helper.php RENAMED
@@ -1,20 +1,20 @@
1
  <?php
2
  $crafty_script_added = false;
3
- function crafty_add_address_finder($obj, $suffix = '', $company_id = 'company', $street_id = 'street_', $town_id='city', $county_id='region', $postcode_id = 'zip', $country_id = '_cp_country') {
4
  global $crafty_script_added;
5
  $conf = Mage::getStoreConfig('general');
6
 
7
  if (1 == $conf['craftyclicks']['active']) {
8
 
9
  if (false == $crafty_script_added) {
10
- echo "<script type=\"text/javascript\" charset=\"ISO-8859-1\" src=\"".$obj->getJsUrl('crafty/crafty_postcode.js')."\"></script>\n";
11
  $crafty_script_added = true;
12
  }
13
 
14
  echo "<script type=\"text/javascript\">
15
 
16
  var cp_obj".$suffix." = CraftyPostcodeCreate();
17
- cp_obj".$suffix.".set('max_width', '530px');
18
  cp_obj".$suffix.".set('access_token', '".$conf['craftyclicks']['access_token']."');
19
  cp_obj".$suffix.".set('result_elem_id', 'crafty_postcode_result_display".$suffix."');
20
  cp_obj".$suffix.".set('form', '');";
@@ -56,26 +56,33 @@ function crafty_add_address_finder($obj, $suffix = '', $company_id = 'company',
56
  echo " cp_obj".$suffix.".set('err_msg4', '".$conf['craftyclicks']['error_msg_4']."');";
57
  }
58
  echo "
59
-
 
 
 
 
 
60
  ";
61
 
62
- if (1 == $conf['craftyclicks']['hide_fields'] && '' == $obj->getAddress()->getPostcode()) {
63
  // hide address fields if they are blank, only show them once an address is selected
64
  echo "
65
  function _cp_set_addr_fields_display".$suffix."(new_display) {
66
- document.getElementById('".$town_id."').parentNode.parentNode.style.display = new_display;
67
- if (document.getElementById('".$company_id."')) {
68
- document.getElementById('".$company_id."').parentNode.style.display = new_display;
69
- }";
70
  // do all street lines
71
  for ($street_num = 1; $street_num<=$obj->helper('customer/address')->getStreetLines(); $street_num++) {
72
  echo "
73
- document.getElementById('".$street_id.$street_num."').parentNode.style.display = new_display;";
74
  }
 
75
  echo "
76
  }
77
  // hide all address lines
78
- _cp_set_addr_fields_display".$suffix."('none');
 
 
79
 
80
  function _cp_addr_fields_show".$suffix."() {
81
  _cp_set_addr_fields_display".$suffix."('block');
@@ -92,7 +99,7 @@ function crafty_add_address_finder($obj, $suffix = '', $company_id = 'company',
92
  echo "
93
  function _cp_addr_result_hide".$suffix."() {
94
  cp_obj".$suffix.".update_res(null);
95
- document.getElementById('crafty_postcode_result_display".$suffix."').style.display = 'none';
96
  }
97
  ";
98
  } else {
@@ -106,10 +113,7 @@ function crafty_add_address_finder($obj, $suffix = '', $company_id = 'company',
106
  if (1 == $conf['craftyclicks']['hide_county']) {
107
  echo "
108
  function _cp_county_display".$suffix."(new_display) {
109
- var county_filed = document.getElementById('".$county_id."').parentNode;
110
- if (county_filed) {
111
- county_filed.style.display = new_display;
112
- }
113
  }
114
  ";
115
  } else {
@@ -137,28 +141,32 @@ function crafty_add_address_finder($obj, $suffix = '', $company_id = 'company',
137
  echo " }
138
  function _cp_country_handler".$suffix."() {
139
  if ('GB' != document.getElementById('".$country_id."').value) {
140
- document.getElementById('".$postcode_id."').style.width = _cp_oldZipWidth".$suffix.";
141
- document.getElementById('zipDiv').style.width = _cp_oldZipDivWidth".$suffix.";
142
- document.getElementById('findAddrBtnDiv".$suffix."').style.display = 'none';";
 
 
 
143
  if (1 == $conf['craftyclicks']['house_search']) {
144
  echo "
145
- document.getElementById('houseSearchDiv".$suffix."').style.display = 'none';";
146
  }
147
  echo "
148
- document.getElementById('crafty_postcode_result_display".$suffix."').style.display = 'none';
149
  _cp_addr_fields_show".$suffix."();
150
  cp_obj".$suffix.".update_res(null);
151
  _cp_county_display".$suffix."('inline');
152
  } else {
153
- document.getElementById('".$postcode_id."').style.width = '135px';
154
- document.getElementById('zipDiv".$suffix."').style.width = '150px';
155
- document.getElementById('findAddrBtnDiv".$suffix."').style.width = '125px';
156
- document.getElementById('findAddrBtnDiv".$suffix."').style.display = 'inline';";
 
 
157
  if (1 == $conf['craftyclicks']['house_search']) {
158
  echo "
159
- document.getElementById('houseSearchDiv".$suffix."').style.display = 'inline';";
160
  }
161
- echo "
162
  _cp_county_display".$suffix."('none');
163
  }
164
  }
@@ -176,8 +184,11 @@ function crafty_add_address_finder($obj, $suffix = '', $company_id = 'company',
176
  echo "
177
  }
178
 
179
- var _cp_oldZipWidth".$suffix." = document.getElementById('". $postcode_id."').style.width;
180
- var _cp_oldZipDivWidth".$suffix." = document.getElementById('zipDiv').style.width;
 
 
 
181
  var _cp_countryElem".$suffix." = document.getElementById('".$country_id."');
182
 
183
  Event.observe(_cp_countryElem".$suffix.", 'change', _cp_country_handler".$suffix.");
@@ -186,6 +197,19 @@ function crafty_add_address_finder($obj, $suffix = '', $company_id = 'company',
186
 
187
  _cp_country_handler".$suffix."();
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  </script>";
190
  }
191
  }
1
  <?php
2
  $crafty_script_added = false;
3
+ function crafty_add_address_finder($obj, $suffix = '', $company_id = 'company', $street_id = 'street_', $town_id='city', $county_id='region', $postcode_id = 'zip', $country_id = '_cp_country', $res_width='') {
4
  global $crafty_script_added;
5
  $conf = Mage::getStoreConfig('general');
6
 
7
  if (1 == $conf['craftyclicks']['active']) {
8
 
9
  if (false == $crafty_script_added) {
10
+ echo "<script type=\"text/javascript\" charset=\"ISO-8859-1\" src=\"".$obj->getJsUrl('craftyclicks/crafty_postcode.class.js')."\"></script>\n";
11
  $crafty_script_added = true;
12
  }
13
 
14
  echo "<script type=\"text/javascript\">
15
 
16
  var cp_obj".$suffix." = CraftyPostcodeCreate();
17
+ cp_obj".$suffix.".set('max_width', '".$res_width."');
18
  cp_obj".$suffix.".set('access_token', '".$conf['craftyclicks']['access_token']."');
19
  cp_obj".$suffix.".set('result_elem_id', 'crafty_postcode_result_display".$suffix."');
20
  cp_obj".$suffix.".set('form', '');";
56
  echo " cp_obj".$suffix.".set('err_msg4', '".$conf['craftyclicks']['error_msg_4']."');";
57
  }
58
  echo "
59
+ function _cp_set_elem_disp(elemId, new_display) {
60
+ var elem = document.getElementById(elemId);
61
+ if (elem) {
62
+ elem.style.display = new_display;
63
+ }
64
+ }
65
  ";
66
 
67
+ if (1 == $conf['craftyclicks']['hide_fields']) { // && '' == $obj->getAddress()->getPostcode()) {
68
  // hide address fields if they are blank, only show them once an address is selected
69
  echo "
70
  function _cp_set_addr_fields_display".$suffix."(new_display) {
71
+ _cp_set_elem_disp('hideOnNewAddress_".$town_id."', new_display);
72
+ _cp_set_elem_disp('hideOnNewAddress_".$company_id."', new_display);
73
+ ";
 
74
  // do all street lines
75
  for ($street_num = 1; $street_num<=$obj->helper('customer/address')->getStreetLines(); $street_num++) {
76
  echo "
77
+ _cp_set_elem_disp('hideOnNewAddress_".$street_id.$street_num."', new_display);";
78
  }
79
+
80
  echo "
81
  }
82
  // hide all address lines
83
+ if ('' == document.getElementById('".$postcode_id."').value) {
84
+ _cp_set_addr_fields_display".$suffix."('none');
85
+ }
86
 
87
  function _cp_addr_fields_show".$suffix."() {
88
  _cp_set_addr_fields_display".$suffix."('block');
99
  echo "
100
  function _cp_addr_result_hide".$suffix."() {
101
  cp_obj".$suffix.".update_res(null);
102
+ _cp_set_elem_disp('crafty_postcode_result_display".$suffix."', 'none');
103
  }
104
  ";
105
  } else {
113
  if (1 == $conf['craftyclicks']['hide_county']) {
114
  echo "
115
  function _cp_county_display".$suffix."(new_display) {
116
+ _cp_set_elem_disp('countyDiv".$suffix."', new_display);
 
 
 
117
  }
118
  ";
119
  } else {
141
  echo " }
142
  function _cp_country_handler".$suffix."() {
143
  if ('GB' != document.getElementById('".$country_id."').value) {
144
+ if (document.getElementById('zipDiv')) {
145
+ document.getElementById('".$postcode_id."').style.width = _cp_oldZipWidth".$suffix.";
146
+ document.getElementById('zipDiv').style.width = _cp_oldZipDivWidth".$suffix.";
147
+ }
148
+ _cp_set_elem_disp('findAddrBtnDiv".$suffix."', 'none');
149
+ _cp_set_elem_disp('crafty_postcode_result_display".$suffix."', 'none');";
150
  if (1 == $conf['craftyclicks']['house_search']) {
151
  echo "
152
+ _cp_set_elem_disp('houseSearchDiv".$suffix."', 'none');";
153
  }
154
  echo "
 
155
  _cp_addr_fields_show".$suffix."();
156
  cp_obj".$suffix.".update_res(null);
157
  _cp_county_display".$suffix."('inline');
158
  } else {
159
+ if (document.getElementById('zipDiv')) {
160
+ document.getElementById('".$postcode_id."').style.width = '135px';
161
+ document.getElementById('zipDiv".$suffix."').style.width = '150px';
162
+ document.getElementById('findAddrBtnDiv".$suffix."').style.width = '125px';
163
+ }
164
+ _cp_set_elem_disp('findAddrBtnDiv".$suffix."', 'inline');";
165
  if (1 == $conf['craftyclicks']['house_search']) {
166
  echo "
167
+ _cp_set_elem_disp('houseSearchDiv".$suffix."', 'inline');";
168
  }
169
+ echo "
170
  _cp_county_display".$suffix."('none');
171
  }
172
  }
184
  echo "
185
  }
186
 
187
+ var _cp_oldZipWidth".$suffix.", _cp_oldZipDivWidth".$suffix.";
188
+ if (document.getElementById('zipDiv')) {
189
+ _cp_oldZipWidth".$suffix." = document.getElementById('". $postcode_id."').style.width;
190
+ _cp_oldZipDivWidth".$suffix." = document.getElementById('zipDiv').style.width;
191
+ }
192
  var _cp_countryElem".$suffix." = document.getElementById('".$country_id."');
193
 
194
  Event.observe(_cp_countryElem".$suffix.", 'change', _cp_country_handler".$suffix.");
197
 
198
  _cp_country_handler".$suffix."();
199
 
200
+ // make the search button default on Enter key - optional!
201
+ function _cp_key_pressed_on_postcode".$suffix."(e) {
202
+ var cc = 0;
203
+ if (!e) e = window.event;
204
+ if(e.keyCode) {cc = e.keyCode;}
205
+ else if(e.which) {cc = e.which;}
206
+ if(cc == 13){
207
+ _cp_do_lookup".$suffix."()
208
+ return false;
209
+ }
210
+ }
211
+ var _cp_postcodeElem".$suffix." = document.getElementById('".$postcode_id."');
212
+ Event.observe(_cp_postcodeElem".$suffix.", 'keypress', _cp_key_pressed_on_postcode".$suffix.");
213
  </script>";
214
  }
215
  }
app/design/frontend/base/default/template/craftyclicks/customer/address/edit.phtml ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 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
+ *
27
+ * NOTE - this file is modified to include the CraftyClicks Address Finder Extension
28
+ */
29
+ ?>
30
+ <?php
31
+ /**
32
+ * Edit customer address template
33
+ *
34
+ * @see Mage_Customer_Block_Address_Edit
35
+ */
36
+ ?>
37
+ <?php if($this->getTitle()): ?>
38
+ <div class="page-title">
39
+ <h1><?php echo $this->getTitle() ?></h1>
40
+ </div>
41
+ <?php endif; ?>
42
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
43
+ <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate">
44
+ <div class="fieldset">
45
+ <?php echo $this->getBlockHtml('formkey')?>
46
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
47
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
48
+ <h2 class="legend"><?php echo $this->__('Contact Information') ?></h2>
49
+ <ul class="form-list">
50
+ <li class="fields">
51
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getCustomer())->toHtml() ?>
52
+ </li>
53
+ <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
54
+ <li class="wide">
55
+ <label for="company"><?php echo $this->__('Company') ?></label>
56
+ <div class="input-box">
57
+ <input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" class="input-text" />
58
+ </div>
59
+ </li>
60
+ <?php endif ?>
61
+ <li class="fields">
62
+ <div class="field">
63
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
64
+ <div class="input-box">
65
+ <input type="text" name="telephone" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="telephone" />
66
+ </div>
67
+ </div>
68
+ <div class="field">
69
+ <label for="fax"><?php echo $this->__('Fax') ?></label>
70
+ <div class="input-box">
71
+ <input type="text" name="fax" id="fax" title="<?php echo $this->__('Fax') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" class="input-text" />
72
+ </div>
73
+ </div>
74
+ </li>
75
+ </ul>
76
+ </div>
77
+ <div class="fieldset">
78
+ <h2 class="legend"><?php echo $this->__('Address') ?></h2>
79
+ <ul class="form-list">
80
+ <?php if (1 == Mage::getStoreConfig('general/craftyclicks/active')) : // for CraftyClicks we put country & postcode above other address fields ?>
81
+ <li class="fields">
82
+ <div class="field">
83
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
84
+ <div class="input-box">
85
+ <?php echo $this->getCountryHtmlSelect() ?>
86
+ </div>
87
+ </div>
88
+ <?php if (1 == Mage::getStoreConfig('general/craftyclicks/house_search')) : ?>
89
+ </li>
90
+ <li class="fields">
91
+ <div class="field" id="houseSearchDiv">
92
+ <label for="crafty_in_search_string"><?php echo $this->__('House Name or Number') ?></label>
93
+ <div class="input-box">
94
+ <input type="text" title="<?php echo $this->__('House Name or Number') ?>" name="crafty_in_search_string" id="crafty_in_search_string" class="input-text" />
95
+ </div>
96
+ </div>
97
+ <?php endif ?>
98
+ <div class="field" id="zipDiv">
99
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
100
+ <div class="input-box">
101
+ <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
102
+ </div>
103
+ </div>
104
+ <div class="field" id="findAddrBtnDiv" style="display:none;"><br />
105
+ &nbsp;
106
+ <?php if ('' != Mage::getStoreConfig('general/craftyclicks/button_image')) : ?>
107
+ <img style="cursor: pointer;" src="<?php echo $this->getSkinUrl('images/craftyclicks/'.Mage::getStoreConfig('general/craftyclicks/button_image')); ?>" onclick="_cp_do_lookup()" title="Find Address" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>"/>
108
+ <?php else : ?>
109
+ <button type="button" title="Find Address" onclick="_cp_do_lookup()" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>"><span><span>Find Address</span></span></button>
110
+ <?php endif ?>
111
+ </div>
112
+ </li>
113
+ <li class="wide">
114
+ <span style="display:none;" id="crafty_postcode_result_display">&nbsp;</span>
115
+ </li>
116
+ <li class="wide" id="hideOnNewAddress_company">
117
+ <label for="company"><?php echo $this->__('Company') ?></label>
118
+ <div class="input-box">
119
+ <input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" class="input-text" />
120
+ </div>
121
+ </li>
122
+ <?php endif ?>
123
+ <li class="wide" id="hideOnNewAddress_street_1">
124
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
125
+ <div class="input-box">
126
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
127
+ </div>
128
+ </li>
129
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
130
+ <li class="wide" id="hideOnNewAddress_street_<?php echo $_i?>">
131
+ <div class="input-box">
132
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address '.$_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
133
+ </div>
134
+ </li>
135
+ <?php endfor ?>
136
+ <li class="fields" id="hideOnNewAddress_city">
137
+ <div class="field">
138
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
139
+ <div class="input-box">
140
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
141
+ </div>
142
+ </div>
143
+ <div class="field" id="countyDiv">
144
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
145
+ <div class="input-box">
146
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
147
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
148
+ </select>
149
+ <script type="text/javascript">
150
+ //<![CDATA[
151
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
152
+ //]]>
153
+ </script>
154
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
155
+ </div>
156
+ </div>
157
+ </li>
158
+ <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : // for CraftyClicks we put country & postcode above other address fields ?>
159
+ <li class="fields">
160
+ <div class="field">
161
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
162
+ <div class="input-box">
163
+ <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
164
+ </div>
165
+ </div>
166
+ <div class="field">
167
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
168
+ <div class="input-box">
169
+ <?php echo $this->getCountryHtmlSelect() ?>
170
+ </div>
171
+ </div>
172
+ </li>
173
+ <?php endif ?>
174
+ <li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
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; ?>
182
+ </li>
183
+ <li<?php if($this->canSetAsDefaultShipping()) echo ' class="control"' ?>>
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; ?>
191
+ </li>
192
+ </ul>
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>
200
+ <script type="text/javascript">
201
+ //<![CDATA[
202
+ var dataForm = new VarienForm('form-validate', true);
203
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
204
+ //]]>
205
+ </script>
app/design/frontend/base/default/template/craftyclicks/gomage_lightcheckout.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ require ('crafty_template_helper.php');
3
+
4
+ crafty_add_address_finder($this, '', 'billing_company', 'billing_street', 'billing_city', 'billing_region', 'billing_postcode', 'billing_country_id', '');
5
+ crafty_add_address_finder($this, '2', 'shipping_company', 'shipping_street', 'shipping_city', 'shipping_region', 'shipping_postcode', 'shipping_country_id', '');
6
+ ?>
app/design/frontend/{default/default/template/dnc/craftyclicks/checkout_onepage.phtml → base/default/template/craftyclicks/single_page_checkout.phtml} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  require ('crafty_template_helper.php');
3
 
4
- crafty_add_address_finder($this, '', 'billing:company', 'billing:street', 'billing:city', 'billing:region', 'billing:postcode', 'billing:country_id');
5
- crafty_add_address_finder($this, '2', 'shipping:company', 'shipping:street', 'shipping:city', 'shipping:region', 'shipping:postcode', 'shipping:country_id');
6
  ?>
1
  <?php
2
  require ('crafty_template_helper.php');
3
 
4
+ crafty_add_address_finder($this, '', 'billing:company', 'billing:street', 'billing:city', 'billing:region', 'billing:postcode', 'billing:country_id', '');
5
+ crafty_add_address_finder($this, '2', 'shipping:company', 'shipping:street', 'shipping:city', 'shipping:region', 'shipping:postcode', 'shipping:country_id', '');
6
  ?>
app/design/frontend/base/default/template/onestepcheckout/__orig_files_cc/billing_fields.phtml ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper('onestepcheckout/checkout');
3
+ $billingFields['firstname'] = '
4
+ <div class="input-box input-firstname'.((in_array('firstname', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
5
+ <label for="billing:firstname">'.$this->__('First Name').'<span class="required">*</span></label><br />
6
+ <input class="required-entry input-text" type="text" name="billing[firstname]" id="billing:firstname" value="'.$this->getFirstname().'" />
7
+ </div>';
8
+ $billingFields['lastname'] = '
9
+ <div class="input-box input-lastname'.((in_array('lastname', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
10
+ <label for="billing:lastname">'.$this->__('Last Name').' <span class="required">*</span></label><br />
11
+ <input class="required-entry input-text" type="text" name="billing[lastname]" id="billing:lastname" value="'.$this->getLastname().'" />
12
+ </div>';
13
+ ?>
14
+ <?php if(!$this->isCustomerLoggedIn()): ?>
15
+ <?php $billingFields['email'] = '
16
+ <div class="input-box input-email'.((in_array('email', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
17
+ <label for="billing:email">'.$this->__('Email Address').' <span class="required">*</span></label><br />
18
+ <input type="text" name="billing[email]" id="billing:email" value="'.$this->htmlEscape($this->getAddress()->getEmail()).'" title="'.$this->__('Email Address') .'" class="validate-email required-entry input-text" />
19
+ </div>';
20
+ ?>
21
+ <?php endif; ?>
22
+ <?php if(!$this->isCustomerLoggedIn() || in_array('email_registered', $this->formErrors['billing_errors'])): ?>
23
+ <?php $billingFields['email_error'] = '
24
+ <div class="clearfix" id="onestepcheckout-email-error" '.((!in_array('email_registered', $this->formErrors['billing_errors'])) ? 'style="display: none"' : '').'>
25
+ <div id="onestepcheckout-email-error-message" class="onestepcheckout-error">'.
26
+ ((in_array('email_registered', $this->formErrors['billing_errors'])) ? $this->__('Email address already registered. Please <a href="#" onclick="login_popup.show(); return false;">login now</a> or use a different email address.') : $this->__('Invalid email address.'))
27
+ .'</div>
28
+ </div>';
29
+ ?>
30
+ <?php endif; ?>
31
+
32
+ <?php if(!$this->settings['exclude_telephone']):?>
33
+ <?php $billingFields['telephone'] = '
34
+ <div class="input-box input-telephone'.((in_array('telephone', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
35
+ <label for="billing:telephone">'.$this->__('Telephone').' <span class="required">*</span></label><br/>
36
+ <input type="text" name="billing[telephone]" value="'.$this->htmlEscape($this->getTelephone()).'" title="'.$this->__('Telephone').'" class="required-entry input-text" id="billing:telephone" />
37
+ </div>';
38
+ ?>
39
+ <?php endif; ?>
40
+
41
+ <?php if(!$this->settings['exclude_address']):?>
42
+ <?php
43
+ $addressFields = '';
44
+ for ($_i=1, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++){
45
+
46
+ $addressFields .= '<input type="text" title="'.$this->__('Street Address '.$_i).'" name="billing[street][]" id="billing:street'.$_i.'" value="'.$this->htmlEscape($this->getStreet($_i)).'" class="'.(($_i == 1)? 'required-entry ' : '').'input-text onestepcheckout-address-line" />';
47
+ $addressFields .= (($_i != $this->helper('customer/address')->getStreetLines()) ? '<br/>': '');
48
+ }
49
+ $billingFields['street'] = '
50
+ <div class="input-box input-address'.((in_array('telephone', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
51
+ <label for="billing:street1">'.$this->__('Address').'<span class="required">*</span></label><br />
52
+ '.$addressFields.'
53
+ </div>';
54
+ ?>
55
+ <?php endif; ?>
56
+
57
+ <?php if(!$this->settings['exclude_country_id']):?>
58
+ <?php
59
+ $billingFields['country_id'] = '
60
+ <div class="input-box input-country'.((in_array('country', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
61
+ <label for="billing:country_id">'.$this->__('Country').' <span class="required">*</span></label><br />
62
+ '.$this->getCountryHtmlSelect('billing').'
63
+ </div>';
64
+ ?>
65
+ <?php else: ?>
66
+ <?php $billingFields['country_id'] = '
67
+ <input type="hidden" name="billing[country_id]" id="billing:country_id" value="'.$this->settings['default_country'].'" />';
68
+ ?>
69
+ <?php endif; ?>
70
+ <?php if(!$this->settings['exclude_region']): ?>
71
+ <?php $billingFields['region_id'] = '
72
+ <div class="input-box input-region'.((in_array('region', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
73
+ <label for="billing:region">'.$this->__('State/Province').' <span class="required">*</span></label><br/>
74
+ <select id="billing:region_id" name="billing[region_id]" title="'.$this->__('State/Province').'" class="validate-select" style="display:none">
75
+ <option value="">'.$this->__('Please select region, state or province').'</option>
76
+ </select>
77
+ <script type="text/javascript">
78
+ $("billing:region_id").setAttribute("defaultValue", "'.$this->getRegionId().'");
79
+ </script>
80
+ <input type="text" id="billing:region" name="billing[region]" value="'.$this->htmlEscape($this->getRegion()).'" title="'.$this->__('State/Province').'" class="required-entry input-text" style="display:none" />
81
+ </div>';
82
+ ?>
83
+ <?php endif; ?>
84
+ <?php if(!$this->settings['exclude_city']):?>
85
+ <?php $billingFields['city'] = '
86
+ <div class="input-box input-city'.((in_array('city', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
87
+ <label for="billing:city">'.$this->__('City').' <span class="required">*</span></label><br/>
88
+ <input type="text" name="billing[city]" value="'.$this->htmlEscape($this->getCity()).'" title="'.$this->__('City').'" class="required-entry input-text" id="billing:city" />
89
+ </div>';
90
+ ?>
91
+ <?php endif; ?>
92
+
93
+ <?php if(!$this->settings['exclude_zip']): ?>
94
+ <?php $billingFields['postcode'] = '
95
+ <div class="input-box input-postcode'.((in_array('postcode', $this->formErrors['billing_errors'])) ? ' input-error' : '').'" >
96
+ <label for="billing:postcode">'.$this->__('Zip/Postal Code').' <span class="required">*</span></label><br />
97
+ <input type="text" title="'.$this->__('Zip/Postal Code').'" name="billing[postcode]" id="billing:postcode" value="'.$this->htmlEscape($this->getPostcode()).'" class="validate-zip-international required-entry input-text" />
98
+ </div>';
99
+ ?>
100
+ <?php endif; ?>
101
+
102
+ <?php if(!$this->settings['exclude_company']): ?>
103
+ <?php $billingFields['company'] = '
104
+ <div class="input-box input-company'.((in_array('company', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
105
+ <label for="billing:company">'.$this->__('Company').'</label><br/>
106
+ <input type="text" name="billing[company]" value="'.$this->htmlEscape($this->getCompany()).'" title="'.$this->__('Company').'" class="input-text" id="billing:company" />
107
+ </div>';
108
+ ?>
109
+ <?php endif; ?>
110
+
111
+ <?php if(!$this->settings['exclude_fax']): ?>
112
+ <?php $billingFields['fax'] = '
113
+ <div class="input-box input-fax'.((in_array('fax', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
114
+ <label for="billing:fax">'.$this->__('Fax').'</label><br/>
115
+ <input type="text" name="billing[fax]" value="'.$this->htmlEscape($this->getFax()).'" title="'.$this->__('Fax').'" class="input-text" id="billing:fax" />
116
+ </div>';
117
+ ?>
118
+ <?php endif; ?>
119
+
120
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat'); ?>
121
+ <?php if($_taxvat->isEnabled()): ?>
122
+ <?php $billingFields['taxvat'] =
123
+ $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())
124
+ ->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml();
125
+ ?>
126
+ <?php endif; ?>
127
+
128
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
129
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
130
+
131
+ <?php if ($_dob && $_dob->isEnabled()): ?>
132
+ <?php $billingFields['dob'] = '
133
+ <div class="field">
134
+ '.$_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml().'
135
+ </div>.';
136
+ ?>
137
+ <?php endif; ?>
138
+ <?php if ($_gender && $_gender->isEnabled()): ?>
139
+ <?php $billingFields['gender'] = '
140
+ <div class="field">
141
+ '.$_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml().'
142
+ </div>';
143
+ ?>
144
+ <?php endif ?>
145
+ <?php if(!$this->isCustomerLoggedIn() && $helper->showCreateAccount()): ?>
146
+ <?php $billingFields['create_account'] = '
147
+ <div class="input-box">
148
+ <input id="id_create_account" type="checkbox" name="create_account" value="1" '.((isset($_POST['create_account']) && $_POST['create_account'] == '1') ? ' checked="checked"' : '').' />
149
+ <label for="id_create_account">'.$this->__('Create an account for later use').'</label>
150
+ </div>
151
+
152
+ <script>
153
+ document.observe("dom:loaded", function() {
154
+ $("id_create_account").observe("click", function(e) {
155
+ var element = e.element();
156
+ if(element.checked) {
157
+ $("onestepcheckout-li-password").show();
158
+ }
159
+ else {
160
+ $("onestepcheckout-li-password").hide();
161
+ }
162
+ });
163
+ });
164
+ </script>';
165
+ ?>
166
+ <?php endif; ?>
167
+ <?php if($helper->showPasswords() && !$this->isCustomerLoggedIn()): ?>
168
+ <?php
169
+ //id="onestepcheckout-li-password"
170
+ $billingFields['password'] = '
171
+ <li id="onestepcheckout-li-password" '.(($helper->hidePasswords()) ? 'style="display: none;"':'').'>
172
+ <div class="input-box input-password'.((in_array('password', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
173
+ <label for="billing:customer_password">'.$this->__('Password').'</label><br/>
174
+ <input type="password" class="required-entry validate-password input-text" value="'.((isset($_POST['billing']['customer_password'])) ? $_POST['billing']['customer_password'] : '').'" title="Password" id="billing:customer_password" name="billing[customer_password]"/>
175
+ </div>
176
+ <div class="input-box input-password'.((in_array('confirm_password', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
177
+ <label for="billing:confirm_password">'.$this->__('Confirm password').'</label><br/>
178
+ <input type="password" class="required-entry validate-password input-text" value="'.((isset($_POST['billing']['confirm_password'])) ? $_POST['billing']['confirm_password'] : '').'" id="billing:confirm_password" title="Confirm Password" name="billing[confirm_password]"/>
179
+ </div>
180
+ </li>';
181
+ ?>
182
+ <?php endif; ?>
183
+
184
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
185
+ <?php $billingFields['save_in_address_book'] = '
186
+ <li class="control">
187
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="'.$this->__('Save in address book').'" id="billing:save_in_address_book" onchange="shipping.setSameAsBilling(false);"'.(($this->getAddress()->getSaveInAddressBook()) ? 'checked="checked"':'').' class="checkbox" /><label for="billing:save_in_address_book">'.$this->__('Save in address book').'</label>
188
+ </li>';
189
+ ?>
190
+ <?php else:?>
191
+ <?php $billingFields['save_in_address_book'] = '
192
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>';
193
+ ?>
194
+ <?php endif; ?>
195
+
196
+ <?php $billingFields = $this->getBillingFieldsOrder($billingFields);?>
197
+ <?php foreach($billingFields as $key => $value):?>
198
+ <?php if(!empty($value['has_li'])):?>
199
+ <?php echo implode('',$value['fields']);?>
200
+ <?php else:?>
201
+ <li class="clearfix"><?php echo implode('',$value['fields']);?></li>
202
+ <?php endif;?>
203
+ <?php endforeach;?>
app/design/frontend/base/default/template/onestepcheckout/__orig_files_cc/shipping_fields.phtml ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper('onestepcheckout/checkout');
3
+ $shippingFields['firstname'] = '
4
+ <div class="input-box input-firstname'.((in_array('firstname', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
5
+ <label for="shipping:firstname">'.$this->__('First Name').'<span class="required">*</span></label><br />
6
+ <input class="required-entry input-text" type="text" name="shipping[firstname]" id="shipping:firstname" value="'.$this->getFirstname().'" />
7
+ </div>';
8
+ $shippingFields['lastname'] = '
9
+ <div class="input-box input-lastname'.((in_array('lastname', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
10
+ <label for="shipping:lastname">'.$this->__('Last Name').' <span class="required">*</span></label><br />
11
+ <input class="required-entry input-text" type="text" name="shipping[lastname]" id="shipping:lastname" value="'.$this->getLastname().'" />
12
+ </div>';
13
+ ?>
14
+
15
+ <?php if(!$this->settings['exclude_address']):?>
16
+ <?php
17
+ $addressFields = '';
18
+ for ($_i=1, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++){
19
+
20
+ $addressFields .= '<input type="text" title="'.$this->__('Street Address '.$_i).'" name="shipping[street][]" id="shipping:street'.$_i.'" value="'.$this->htmlEscape($this->getStreet($_i)).'" class="'.(($_i == 1)? 'required-entry ' : '').'input-text onestepcheckout-address-line" />';
21
+ $addressFields .= (($_i != $this->helper('customer/address')->getStreetLines()) ? '<br/>': '');
22
+ }
23
+ $shippingFields['street'] = '
24
+ <div class="input-box input-address'.((in_array('telephone', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
25
+ <label for="shipping:street1">'.$this->__('Address').'<span class="required">*</span></label><br />
26
+ '.$addressFields.'
27
+ </div>';
28
+ ?>
29
+ <?php endif; ?>
30
+
31
+ <?php if(!$this->settings['exclude_country_id']):?>
32
+ <?php
33
+ $shippingFields['country_id'] = '
34
+ <div class="input-box input-country'.((in_array('country', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
35
+ <label for="shipping:country_id">'.$this->__('Country').' <span class="required">*</span></label><br />
36
+ '.$this->getCountryHtmlSelect('shipping').'
37
+ </div>';
38
+ ?>
39
+ <?php else: ?>
40
+ <?php $shippingFields['country_id'] = '
41
+ <input type="hidden" name="shipping[country_id]" id="shipping:country_id" value="'.$this->settings['default_country'].'" />';
42
+ ?>
43
+ <?php endif; ?>
44
+ <?php if(!$this->settings['exclude_region'] || !$this->settings['exclude_country_id']): ?>
45
+ <?php $shippingFields['region_id'] = '
46
+ <div class="input-box input-region'.((in_array('region', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
47
+ <label for="shipping:region">'.$this->__('State/Province').' <span class="required">*</span></label><br/>
48
+ <select id="shipping:region_id" name="shipping[region_id]" title="'.$this->__('State/Province').'" class="validate-select" style="display:none">
49
+ <option value="">'.$this->__('Please select region, state or province').'</option>
50
+ </select>
51
+ <script type="text/javascript">
52
+ $("shipping:region_id").setAttribute("defaultValue", "'.$this->getRegionId().'");
53
+ </script>
54
+ <input type="text" id="shipping:region" name="shipping[region]" value="'.$this->htmlEscape($this->getRegion()).'" title="'.$this->__('State/Province').'" class="required-entry input-text" style="display:none" />
55
+ </div>';
56
+ ?>
57
+ <?php endif; ?>
58
+ <?php if(!$this->settings['exclude_city']):?>
59
+ <?php $shippingFields['city'] = '
60
+ <div class="input-box input-city'.((in_array('city', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
61
+ <label for="shipping:city">'.$this->__('City').' <span class="required">*</span></label><br/>
62
+ <input type="text" name="shipping[city]" value="'.$this->htmlEscape($this->getCity()).'" title="'.$this->__('City').'" class="required-entry input-text" id="shipping:city" />
63
+ </div>';
64
+ ?>
65
+ <?php endif; ?>
66
+ <?php if(!$this->settings['exclude_zip']): ?>
67
+ <?php $shippingFields['postcode'] = '
68
+ <div class="input-box input-postcode'.((in_array('postcode', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'" >
69
+ <label for="shipping:postcode">'.$this->__('Zip/Postal Code').' <span class="required">*</span></label><br />
70
+ <input type="text" title="'.$this->__('Zip/Postal Code').'" name="shipping[postcode]" id="shipping:postcode" value="'.$this->htmlEscape($this->getPostcode()).'" class="validate-zip-international required-entry input-text" />
71
+ </div>';
72
+ ?>
73
+ <?php endif; ?>
74
+ <?php if(!$this->settings['exclude_telephone']):?>
75
+ <?php $shippingFields['telephone'] = '
76
+ <div class="input-box input-telephone'.((in_array('telephone', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
77
+ <label for="shipping:telephone">'.$this->__('Telephone').' <span class="required">*</span></label><br/>
78
+ <input type="text" name="shipping[telephone]" value="'.$this->htmlEscape($this->getTelephone()).'" title="'.$this->__('Telephone').'" class="required-entry input-text" id="shipping:telephone" />
79
+ </div>';
80
+ ?>
81
+ <?php endif; ?>
82
+ <?php if(!$this->settings['exclude_company']): ?>
83
+ <?php $shippingFields['company'] = '
84
+ <div class="input-box input-company'.((in_array('company', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
85
+ <label for="shipping:company">'.$this->__('Company').'</label><br/>
86
+ <input type="text" name="shipping[company]" value="'.$this->htmlEscape($this->getCompany()).'" title="'.$this->__('Company').'" class="input-text" id="shipping:company" />
87
+ </div>';
88
+ ?>
89
+ <?php endif; ?>
90
+
91
+ <?php if(!$this->settings['exclude_fax']): ?>
92
+ <?php $shippingFields['fax'] = '
93
+ <div class="input-box input-fax'.((in_array('fax', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
94
+ <label for="shipping:fax">'.$this->__('Fax').'</label><br/>
95
+ <input type="text" name="shipping[fax]" value="'.$this->htmlEscape($this->getFax()).'" title="'.$this->__('Fax').'" class="input-text" id="shipping:fax" />
96
+ </div>';
97
+ ?>
98
+ <?php endif; ?>
99
+
100
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
101
+ <?php $shippingFields['save_in_address_book'] = '
102
+ <li class="control">
103
+ <input type="checkbox" name="shipping[save_in_address_book]" value="1" title="'.$this->__('Save in address book').'" id="shipping:save_in_address_book" '.(($this->getAddress()->getSaveInAddressBook()) ? 'checked="checked"':'').' class="checkbox" /><label for="shipping:save_in_address_book">'.$this->__('Save in address book').'</label>
104
+ </li>';
105
+ ?>
106
+ <?php else:?>
107
+ <?php $shippingFields['save_in_address_book'] = '
108
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>';
109
+ ?>
110
+ <?php endif; ?>
111
+
112
+ <?php $shippingFields = $this->getshippingFieldsOrder($shippingFields);?>
113
+ <?php foreach($shippingFields as $key => $value):?>
114
+ <?php if(!empty($value['has_li'])):?>
115
+ <?php echo implode('',$value['fields']);?>
116
+ <?php else:?>
117
+ <li class="clearfix"><?php echo implode('',$value['fields']);?></li>
118
+ <?php endif;?>
119
+ <?php endforeach;?>
app/design/frontend/base/default/template/onestepcheckout/billing_fields.phtml ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper('onestepcheckout/checkout');
3
+ $billingFields['firstname'] = '
4
+ <div class="input-box input-firstname'.((in_array('firstname', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
5
+ <label for="billing:firstname">'.$this->__('First Name').'<span class="required">*</span></label><br />
6
+ <input class="required-entry input-text" type="text" name="billing[firstname]" id="billing:firstname" value="'.$this->getFirstname().'" />
7
+ </div>';
8
+ $billingFields['lastname'] = '
9
+ <div class="input-box input-lastname'.((in_array('lastname', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
10
+ <label for="billing:lastname">'.$this->__('Last Name').' <span class="required">*</span></label><br />
11
+ <input class="required-entry input-text" type="text" name="billing[lastname]" id="billing:lastname" value="'.$this->getLastname().'" />
12
+ </div>';
13
+ ?>
14
+ <?php if(!$this->isCustomerLoggedIn()): ?>
15
+ <?php $billingFields['email'] = '
16
+ <div class="input-box input-email'.((in_array('email', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
17
+ <label for="billing:email">'.$this->__('Email Address').' <span class="required">*</span></label><br />
18
+ <input type="text" name="billing[email]" id="billing:email" value="'.$this->htmlEscape($this->getAddress()->getEmail()).'" title="'.$this->__('Email Address') .'" class="validate-email required-entry input-text" />
19
+ </div>';
20
+ ?>
21
+ <?php endif; ?>
22
+ <?php if(!$this->isCustomerLoggedIn() || in_array('email_registered', $this->formErrors['billing_errors'])): ?>
23
+ <?php $billingFields['email_error'] = '
24
+ <div class="clearfix" id="onestepcheckout-email-error" '.((!in_array('email_registered', $this->formErrors['billing_errors'])) ? 'style="display: none"' : '').'>
25
+ <div id="onestepcheckout-email-error-message" class="onestepcheckout-error">'.
26
+ ((in_array('email_registered', $this->formErrors['billing_errors'])) ? $this->__('Email address already registered. Please <a href="#" onclick="login_popup.show(); return false;">login now</a> or use a different email address.') : $this->__('Invalid email address.'))
27
+ .'</div>
28
+ </div>';
29
+ ?>
30
+ <?php endif; ?>
31
+
32
+ <?php if(!$this->settings['exclude_telephone']):?>
33
+ <?php $billingFields['telephone'] = '
34
+ <div class="input-box input-telephone'.((in_array('telephone', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
35
+ <label for="billing:telephone">'.$this->__('Telephone').' <span class="required">*</span></label><br/>
36
+ <input type="text" name="billing[telephone]" value="'.$this->htmlEscape($this->getTelephone()).'" title="'.$this->__('Telephone').'" class="required-entry input-text" id="billing:telephone" />
37
+ </div>';
38
+ ?>
39
+ <?php endif; ?>
40
+
41
+ <?php if(!$this->settings['exclude_address']):?>
42
+ <?php
43
+ $addressFields = '';
44
+ for ($_i=1, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++){
45
+
46
+ $addressFields .= '<input type="text" title="'.$this->__('Street Address '.$_i).'" name="billing[street][]" id="billing:street'.$_i.'" value="'.$this->htmlEscape($this->getStreet($_i)).'" class="'.(($_i == 1)? 'required-entry ' : '').'input-text onestepcheckout-address-line" />';
47
+ $addressFields .= (($_i != $this->helper('customer/address')->getStreetLines()) ? '<br/>': '');
48
+ }
49
+ $billingFields['street'] = '
50
+ <div id="hideOnNewAddress_billing:street1" class="input-box input-address'.((in_array('telephone', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
51
+ <label for="billing:street1">'.$this->__('Address').'<span class="required">*</span></label><br />
52
+ '.$addressFields.'
53
+ </div>';
54
+ ?>
55
+ <?php endif; ?>
56
+
57
+ <?php if(!$this->settings['exclude_country_id']):?>
58
+ <?php
59
+ $billingFields['country_id'] = '
60
+ <div class="input-box input-country'.((in_array('country', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
61
+ <label for="billing:country_id">'.$this->__('Country').' <span class="required">*</span></label><br />
62
+ '.$this->getCountryHtmlSelect('billing').'
63
+ </div>';
64
+ ?>
65
+ <?php else: ?>
66
+ <?php $billingFields['country_id'] = '
67
+ <input type="hidden" name="billing[country_id]" id="billing:country_id" value="'.$this->settings['default_country'].'" />';
68
+ ?>
69
+ <?php endif; ?>
70
+ <?php if(!$this->settings['exclude_region']): ?>
71
+ <?php $billingFields['region_id'] = '
72
+ <div id="countyDiv" class="input-box input-region'.((in_array('region', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
73
+ <label for="billing:region">'.$this->__('State/Province').' <span class="required">*</span></label><br/>
74
+ <select id="billing:region_id" name="billing[region_id]" title="'.$this->__('State/Province').'" class="validate-select" style="display:none">
75
+ <option value="">'.$this->__('Please select region, state or province').'</option>
76
+ </select>
77
+ <script type="text/javascript">
78
+ $("billing:region_id").setAttribute("defaultValue", "'.$this->getRegionId().'");
79
+ </script>
80
+ <input type="text" id="billing:region" name="billing[region]" value="'.$this->htmlEscape($this->getRegion()).'" title="'.$this->__('State/Province').'" class="required-entry input-text" style="display:none" />
81
+ </div>';
82
+ ?>
83
+ <?php endif; ?>
84
+ <?php if(!$this->settings['exclude_city']):?>
85
+ <?php $billingFields['city'] = '
86
+ <div id="hideOnNewAddress_billing:city" class="input-box input-city'.((in_array('city', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
87
+ <label for="billing:city">'.$this->__('City').' <span class="required">*</span></label><br/>
88
+ <input type="text" name="billing[city]" value="'.$this->htmlEscape($this->getCity()).'" title="'.$this->__('City').'" class="required-entry input-text" id="billing:city" />
89
+ </div>';
90
+ ?>
91
+ <?php endif; ?>
92
+
93
+ <?php if(!$this->settings['exclude_zip']): ?>
94
+ <?php $billingFields['postcode'] = '
95
+ <div class="input-box input-postcode'.((in_array('postcode', $this->formErrors['billing_errors'])) ? ' input-error' : '').'" >
96
+ <label for="billing:postcode">'.$this->__('Zip/Postal Code').' <span class="required">*</span></label><br />
97
+ <input type="text" title="'.$this->__('Zip/Postal Code').'" name="billing[postcode]" id="billing:postcode" value="'.$this->htmlEscape($this->getPostcode()).'" class="validate-zip-international required-entry input-text" />
98
+ </div>';
99
+ /* CraftyClicks - START */
100
+ if (1 == Mage::getStoreConfig('general/craftyclicks/active')) {
101
+ $billingFields['postcode'] .= '<div id="findAddrBtnDiv" style="display:none;"><br />&nbsp;';
102
+ // $billingFields['postcode'] .= '<div id="findAddrBtnDiv"><br />&nbsp;';
103
+ if ('' != Mage::getStoreConfig('general/craftyclicks/button_image')){
104
+ $billingFields['postcode'] .= '<img style="cursor: pointer;" src="'.$this->getSkinUrl('images/craftyclicks/'.Mage::getStoreConfig('general/craftyclicks/button_image')).'" onclick="_cp_do_lookup()" title="Find Address" class="'.Mage::getStoreConfig('general/craftyclicks/button_class').'"/>';
105
+ } else {
106
+ $billingFields['postcode'] .= '<button type="button" onclick="_cp_do_lookup()" title="Find Address" class="'.Mage::getStoreConfig('general/craftyclicks/button_class').'"><span><span>Find Address</span></span></button>';
107
+ }
108
+ $billingFields['postcode'] .= '</div>';
109
+ }
110
+ /* CraftyClicks - END */
111
+ ?>
112
+ <?php endif; ?>
113
+
114
+ <?php if(!$this->settings['exclude_company']): ?>
115
+ <?php $billingFields['company'] = '
116
+ <div id="hideOnNewAddress_billing:company" class="input-box input-company'.((in_array('company', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
117
+ <label for="billing:company">'.$this->__('Company').'</label><br/>
118
+ <input type="text" name="billing[company]" value="'.$this->htmlEscape($this->getCompany()).'" title="'.$this->__('Company').'" class="input-text" id="billing:company" />
119
+ </div>';
120
+ ?>
121
+ <?php endif; ?>
122
+
123
+ <?php if(!$this->settings['exclude_fax']): ?>
124
+ <?php $billingFields['fax'] = '
125
+ <div class="input-box input-fax'.((in_array('fax', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
126
+ <label for="billing:fax">'.$this->__('Fax').'</label><br/>
127
+ <input type="text" name="billing[fax]" value="'.$this->htmlEscape($this->getFax()).'" title="'.$this->__('Fax').'" class="input-text" id="billing:fax" />
128
+ </div>';
129
+ ?>
130
+ <?php endif; ?>
131
+
132
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat'); ?>
133
+ <?php if($_taxvat->isEnabled()): ?>
134
+ <?php $billingFields['taxvat'] =
135
+ $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())
136
+ ->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml();
137
+ ?>
138
+ <?php endif; ?>
139
+
140
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
141
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
142
+
143
+ <?php if ($_dob && $_dob->isEnabled()): ?>
144
+ <?php $billingFields['dob'] = '
145
+ <div class="field">
146
+ '.$_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml().'
147
+ </div>.';
148
+ ?>
149
+ <?php endif; ?>
150
+ <?php if ($_gender && $_gender->isEnabled()): ?>
151
+ <?php $billingFields['gender'] = '
152
+ <div class="field">
153
+ '.$_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml().'
154
+ </div>';
155
+ ?>
156
+ <?php endif ?>
157
+ <?php if(!$this->isCustomerLoggedIn() && $helper->showCreateAccount()): ?>
158
+ <?php $billingFields['create_account'] = '
159
+ <div class="input-box">
160
+ <input id="id_create_account" type="checkbox" name="create_account" value="1" '.((isset($_POST['create_account']) && $_POST['create_account'] == '1') ? ' checked="checked"' : '').' />
161
+ <label for="id_create_account">'.$this->__('Create an account for later use').'</label>
162
+ </div>
163
+
164
+ <script>
165
+ document.observe("dom:loaded", function() {
166
+ $("id_create_account").observe("click", function(e) {
167
+ var element = e.element();
168
+ if(element.checked) {
169
+ $("onestepcheckout-li-password").show();
170
+ }
171
+ else {
172
+ $("onestepcheckout-li-password").hide();
173
+ }
174
+ });
175
+ });
176
+ </script>';
177
+ ?>
178
+ <?php endif; ?>
179
+ <?php if($helper->showPasswords() && !$this->isCustomerLoggedIn()): ?>
180
+ <?php
181
+ //id="onestepcheckout-li-password"
182
+ $billingFields['password'] = '
183
+ <li id="onestepcheckout-li-password" '.(($helper->hidePasswords()) ? 'style="display: none;"':'').'>
184
+ <div class="input-box input-password'.((in_array('password', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
185
+ <label for="billing:customer_password">'.$this->__('Password').'</label><br/>
186
+ <input type="password" class="required-entry validate-password input-text" value="'.((isset($_POST['billing']['customer_password'])) ? $_POST['billing']['customer_password'] : '').'" title="Password" id="billing:customer_password" name="billing[customer_password]"/>
187
+ </div>
188
+ <div class="input-box input-password'.((in_array('confirm_password', $this->formErrors['billing_errors'])) ? ' input-error' : '').'">
189
+ <label for="billing:confirm_password">'.$this->__('Confirm password').'</label><br/>
190
+ <input type="password" class="required-entry validate-password input-text" value="'.((isset($_POST['billing']['confirm_password'])) ? $_POST['billing']['confirm_password'] : '').'" id="billing:confirm_password" title="Confirm Password" name="billing[confirm_password]"/>
191
+ </div>
192
+ </li>';
193
+ ?>
194
+ <?php endif; ?>
195
+
196
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
197
+ <?php $billingFields['save_in_address_book'] = '
198
+ <li class="control">
199
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="'.$this->__('Save in address book').'" id="billing:save_in_address_book" onchange="shipping.setSameAsBilling(false);"'.(($this->getAddress()->getSaveInAddressBook()) ? 'checked="checked"':'').' class="checkbox" /><label for="billing:save_in_address_book">'.$this->__('Save in address book').'</label>
200
+ </li>';
201
+ ?>
202
+ <?php else:?>
203
+ <?php $billingFields['save_in_address_book'] = '
204
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>';
205
+ ?>
206
+ <?php endif; ?>
207
+
208
+ <?php $billingFields = $this->getBillingFieldsOrder($billingFields);?>
209
+ <?php foreach($billingFields as $key => $value):?>
210
+ <?php if(!empty($value['has_li'])):?>
211
+ <?php echo implode('',$value['fields']);?>
212
+ <?php else:?>
213
+ <li class="clearfix"><?php echo implode('',$value['fields']);?></li>
214
+ <?php endif;?>
215
+ <?php /* CraftyClicks - START */
216
+ if (1 == Mage::getStoreConfig('general/craftyclicks/active')) {
217
+ // we look out for the postcode field, if found we add a result box under it
218
+ foreach ($value['fields'] as $val_key => $one_val) {
219
+ if(strpos($one_val, 'postcode') ) {
220
+ echo '<li class="fields">
221
+ <span style="display:none;" id="crafty_postcode_result_display">&nbsp;</span>
222
+ </li>';
223
+ }
224
+ }
225
+ }
226
+ /* CraftyClicks - END */ ?>
227
+ <?php endforeach;?>
app/design/frontend/base/default/template/onestepcheckout/shipping_fields.phtml ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::helper('onestepcheckout/checkout');
3
+ $shippingFields['firstname'] = '
4
+ <div class="input-box input-firstname'.((in_array('firstname', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
5
+ <label for="shipping:firstname">'.$this->__('First Name').'<span class="required">*</span></label><br />
6
+ <input class="required-entry input-text" type="text" name="shipping[firstname]" id="shipping:firstname" value="'.$this->getFirstname().'" />
7
+ </div>';
8
+ $shippingFields['lastname'] = '
9
+ <div class="input-box input-lastname'.((in_array('lastname', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
10
+ <label for="shipping:lastname">'.$this->__('Last Name').' <span class="required">*</span></label><br />
11
+ <input class="required-entry input-text" type="text" name="shipping[lastname]" id="shipping:lastname" value="'.$this->getLastname().'" />
12
+ </div>';
13
+ ?>
14
+
15
+ <?php if(!$this->settings['exclude_address']):?>
16
+ <?php
17
+ $addressFields = '';
18
+ for ($_i=1, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++){
19
+
20
+ $addressFields .= '<input type="text" title="'.$this->__('Street Address '.$_i).'" name="shipping[street][]" id="shipping:street'.$_i.'" value="'.$this->htmlEscape($this->getStreet($_i)).'" class="'.(($_i == 1)? 'required-entry ' : '').'input-text onestepcheckout-address-line" />';
21
+ $addressFields .= (($_i != $this->helper('customer/address')->getStreetLines()) ? '<br/>': '');
22
+ }
23
+ $shippingFields['street'] = '
24
+ <div id="hideOnNewAddress_shipping:street1" class="input-box input-address'.((in_array('telephone', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
25
+ <label for="shipping:street1">'.$this->__('Address').'<span class="required">*</span></label><br />
26
+ '.$addressFields.'
27
+ </div>';
28
+ ?>
29
+ <?php endif; ?>
30
+
31
+ <?php if(!$this->settings['exclude_country_id']):?>
32
+ <?php
33
+ $shippingFields['country_id'] = '
34
+ <div class="input-box input-country'.((in_array('country', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
35
+ <label for="shipping:country_id">'.$this->__('Country').' <span class="required">*</span></label><br />
36
+ '.$this->getCountryHtmlSelect('shipping').'
37
+ </div>';
38
+ ?>
39
+ <?php else: ?>
40
+ <?php $shippingFields['country_id'] = '
41
+ <input type="hidden" name="shipping[country_id]" id="shipping:country_id" value="'.$this->settings['default_country'].'" />';
42
+ ?>
43
+ <?php endif; ?>
44
+ <?php if(!$this->settings['exclude_region'] || !$this->settings['exclude_country_id']): ?>
45
+ <?php $shippingFields['region_id'] = '
46
+ <div id="countyDiv2" class="input-box input-region'.((in_array('region', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
47
+ <label for="shipping:region">'.$this->__('State/Province').' <span class="required">*</span></label><br/>
48
+ <select id="shipping:region_id" name="shipping[region_id]" title="'.$this->__('State/Province').'" class="validate-select" style="display:none">
49
+ <option value="">'.$this->__('Please select region, state or province').'</option>
50
+ </select>
51
+ <script type="text/javascript">
52
+ $("shipping:region_id").setAttribute("defaultValue", "'.$this->getRegionId().'");
53
+ </script>
54
+ <input type="text" id="shipping:region" name="shipping[region]" value="'.$this->htmlEscape($this->getRegion()).'" title="'.$this->__('State/Province').'" class="required-entry input-text" style="display:none" />
55
+ </div>';
56
+ ?>
57
+ <?php endif; ?>
58
+ <?php if(!$this->settings['exclude_city']):?>
59
+ <?php $shippingFields['city'] = '
60
+ <div id="hideOnNewAddress_shipping:city" class="input-box input-city'.((in_array('city', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
61
+ <label for="shipping:city">'.$this->__('City').' <span class="required">*</span></label><br/>
62
+ <input type="text" name="shipping[city]" value="'.$this->htmlEscape($this->getCity()).'" title="'.$this->__('City').'" class="required-entry input-text" id="shipping:city" />
63
+ </div>';
64
+ ?>
65
+ <?php endif; ?>
66
+ <?php if(!$this->settings['exclude_zip']): ?>
67
+ <?php $shippingFields['postcode'] = '
68
+ <div class="input-box input-postcode'.((in_array('postcode', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'" >
69
+ <label for="shipping:postcode">'.$this->__('Zip/Postal Code').' <span class="required">*</span></label><br />
70
+ <input type="text" title="'.$this->__('Zip/Postal Code').'" name="shipping[postcode]" id="shipping:postcode" value="'.$this->htmlEscape($this->getPostcode()).'" class="validate-zip-international required-entry input-text" />
71
+ </div>';
72
+ /* CraftyClicks - START */
73
+ if (1 == Mage::getStoreConfig('general/craftyclicks/active')) {
74
+ $shippingFields['postcode'] .= '<div id="findAddrBtnDiv2" style="display:none;"><br />&nbsp;';
75
+ // $shippingFields['postcode'] .= '<div id="findAddrBtnDiv2"><br />&nbsp;';
76
+ if ('' != Mage::getStoreConfig('general/craftyclicks/button_image')){
77
+ $shippingFields['postcode'] .= '<img style="cursor: pointer;" src="'.$this->getSkinUrl('images/craftyclicks/'.Mage::getStoreConfig('general/craftyclicks/button_image')).'" onclick="_cp_do_lookup2()" title="Find Address" class="'.Mage::getStoreConfig('general/craftyclicks/button_class').'"/>';
78
+ } else {
79
+ $shippingFields['postcode'] .= '<button type="button" onclick="_cp_do_lookup2()" title="Find Address" class="'.Mage::getStoreConfig('general/craftyclicks/button_class').'"><span><span>Find Address</span></span></button>';
80
+ }
81
+ $shippingFields['postcode'] .= '</div>';
82
+ }
83
+ /* CraftyClicks - END */
84
+ ?>
85
+ <?php endif; ?>
86
+ <?php if(!$this->settings['exclude_telephone']):?>
87
+ <?php $shippingFields['telephone'] = '
88
+ <div class="input-box input-telephone'.((in_array('telephone', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
89
+ <label for="shipping:telephone">'.$this->__('Telephone').' <span class="required">*</span></label><br/>
90
+ <input type="text" name="shipping[telephone]" value="'.$this->htmlEscape($this->getTelephone()).'" title="'.$this->__('Telephone').'" class="required-entry input-text" id="shipping:telephone" />
91
+ </div>';
92
+ ?>
93
+ <?php endif; ?>
94
+ <?php if(!$this->settings['exclude_company']): ?>
95
+ <?php $shippingFields['company'] = '
96
+ <div id="hideOnNewAddress_shipping:company" class="input-box input-company'.((in_array('company', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
97
+ <label for="shipping:company">'.$this->__('Company').'</label><br/>
98
+ <input type="text" name="shipping[company]" value="'.$this->htmlEscape($this->getCompany()).'" title="'.$this->__('Company').'" class="input-text" id="shipping:company" />
99
+ </div>';
100
+ ?>
101
+ <?php endif; ?>
102
+
103
+ <?php if(!$this->settings['exclude_fax']): ?>
104
+ <?php $shippingFields['fax'] = '
105
+ <div class="input-box input-fax'.((in_array('fax', $this->formErrors['shipping_errors'])) ? ' input-error' : '').'">
106
+ <label for="shipping:fax">'.$this->__('Fax').'</label><br/>
107
+ <input type="text" name="shipping[fax]" value="'.$this->htmlEscape($this->getFax()).'" title="'.$this->__('Fax').'" class="input-text" id="shipping:fax" />
108
+ </div>';
109
+ ?>
110
+ <?php endif; ?>
111
+
112
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
113
+ <?php $shippingFields['save_in_address_book'] = '
114
+ <li class="control">
115
+ <input type="checkbox" name="shipping[save_in_address_book]" value="1" title="'.$this->__('Save in address book').'" id="shipping:save_in_address_book" '.(($this->getAddress()->getSaveInAddressBook()) ? 'checked="checked"':'').' class="checkbox" /><label for="shipping:save_in_address_book">'.$this->__('Save in address book').'</label>
116
+ </li>';
117
+ ?>
118
+ <?php else:?>
119
+ <?php $shippingFields['save_in_address_book'] = '
120
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>';
121
+ ?>
122
+ <?php endif; ?>
123
+
124
+ <?php $shippingFields = $this->getshippingFieldsOrder($shippingFields);?>
125
+ <?php foreach($shippingFields as $key => $value):?>
126
+ <?php if(!empty($value['has_li'])):?>
127
+ <?php echo implode('',$value['fields']);?>
128
+ <?php else:?>
129
+ <li class="clearfix"><?php echo implode('',$value['fields']);?></li>
130
+ <?php endif;?>
131
+ <?php /* CraftyClicks - START */
132
+ if (1 == Mage::getStoreConfig('general/craftyclicks/active')) {
133
+ // we look out for the postcode field, if found we add a result box under it
134
+ foreach ($value['fields'] as $val_key => $one_val) {
135
+ if(strpos($one_val, 'postcode') ) {
136
+ echo '<li class="fields">
137
+ <span style="display:none;" id="crafty_postcode_result_display2">&nbsp;</span>
138
+ </li>';
139
+ }
140
+ }
141
+ }
142
+ /* CraftyClicks - END */ ?><?php endforeach;?>
app/design/frontend/default/default/layout/craftyclicks.xml DELETED
@@ -1,42 +0,0 @@
1
- <?xml version="1.0"?>
2
-
3
- <layout>
4
-
5
- <checkout_onepage_index>
6
- <reference name="checkout.onepage.billing">
7
- <action method="setTemplate"><template>dnc/craftyclicks/checkout/onepage/billing.phtml</template></action>
8
- </reference>
9
- <reference name="checkout.onepage.shipping">
10
- <action method="setTemplate"><template>dnc/craftyclicks/checkout/onepage/shipping.phtml</template></action>
11
- </reference>
12
- <reference name="content">
13
- <block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="dnc/craftyclicks/checkout_onepage.phtml"/>
14
- </reference>
15
- </checkout_onepage_index>
16
-
17
- <checkout_multishipping_customer_address>
18
- <reference name="customer_address_edit">
19
- <action method="setTemplate"><template>dnc/craftyclicks/customer/address/edit.phtml</template></action>
20
- </reference>
21
- <reference name="content">
22
- <block type="customer/address_edit" name="customer.address.edit" as="shipping" template="dnc/craftyclicks/address_form.phtml"/>
23
- </reference>
24
- </checkout_multishipping_customer_address>
25
-
26
- <customer_address_form>
27
- <reference name="customer_address_edit">
28
- <action method="setTemplate"><template>dnc/craftyclicks/customer/address/edit.phtml</template></action>
29
- </reference>
30
- <reference name="content">
31
- <block type="customer/address_edit" name="customer.address.edit" template="dnc/craftyclicks/address_form.phtml"/>
32
- </reference>
33
- </customer_address_form>
34
-
35
- <!-- work in progress - compatibility with one step checkout module
36
- <onestepcheckout_index_index>
37
- <reference name="before_body_end">
38
- <block type="onestepcheckout/checkout" name="onestepcheckout.craftyclicks" as="craftyclicks" template="dnc/craftyclicks/checkout_onepage.phtml"/>
39
- </reference>
40
- </onestepcheckout_index_index>
41
- -->
42
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/dnc/craftyclicks/checkout/onepage/billing.phtml DELETED
@@ -1,175 +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_default
22
- * @package Mage
23
- * @copyright Copyright (c) 2008 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
- <form id="co-billing-form" action="">
28
- <?php if ($this->customerHasAddresses()): ?>
29
- <p><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></p>
30
- <ul><li><p><?php echo $this->getAddressesHtmlSelect('billing') ?></p></li></ul>
31
-
32
- <?php endif ?>
33
- <fieldset class="group-select" id="billing-new-address-form" <?php if ($this->customerHasAddresses()): ?>style="display:none"<?php endif ?>>
34
- <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
35
- <ul>
36
- <li><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())
37
- ->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
38
- <li>
39
- <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
40
- <div class="input-box">
41
- <label for="billing:company"><?php echo $this->__('Company') ?></label><br />
42
- <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" /></div>
43
- <?php endif ?>
44
- <?php if(!$this->isCustomerLoggedIn()): ?>
45
- <div class="input-box">
46
- <label for="billing:email"><?php echo $this->__('Email Address') ?> <span class="required">*</span></label><br />
47
- <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="validate-email required-entry input-text" /></div>
48
- <?php endif ?>
49
- </li>
50
- <?php if (1 == Mage::getStoreConfig('general/craftyclicks/active')) : ?>
51
- <li><div class="input-box">
52
- <label for="billing:country_id"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
53
- <?php echo $this->getCountryHtmlSelect('billing') ?></div>
54
- <?php if (1 == Mage::getStoreConfig('general/craftyclicks/house_search')) : ?>
55
- </li>
56
- <li><div class="input-box" id="houseSearchDiv">
57
- <label for="crafty_in_search_string"><?php echo $this->__('House Name or Number') ?></label><br />
58
- <input type="text" title="<?php echo $this->__('House Name or Number') ?>" name="crafty_in_search_string" id="crafty_in_search_string" class="input-text" /></div>
59
- <?php endif ?>
60
- <div class="input-box" id="zipDiv">
61
- <label for="billing:postcode"><?php echo $this->__('Zip/Postal Code') ?> <span class="required">*</span></label><br />
62
- <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="validate-zip-international required-entry input-text" /></div>
63
- <div class="input-box" id="findAddrBtnDiv" style="display:none;"><br />
64
- &nbsp;
65
- <?php if ('' != Mage::getStoreConfig('general/craftyclicks/button_image')) : ?>
66
- <img style="cursor: pointer;" src="<?php echo $this->getSkinUrl('craftyclicks/'.Mage::getStoreConfig('general/craftyclicks/button_image')); ?>" onclick="_cp_do_lookup()" title="Find Address" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>"/>
67
- <?php else : ?>
68
- <button type="button" onclick="_cp_do_lookup()" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>">Find Address</button>
69
- <?php endif ?>
70
- </div>
71
- </li>
72
- <li><span style="display:none;" id="crafty_postcode_result_display">&nbsp;
73
- </span></li>
74
- <li>
75
- <div class="input-box">
76
- <label for="billing:company"><?php echo $this->__('Company') ?></label><br />
77
- <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" /></div>
78
- </li>
79
- <?php endif ?>
80
- <li><label for="billing:street1"><?php echo $this->__('Address') ?> <span class="required">*</span></label><br />
81
- <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="required-entry input-text" /></li>
82
- <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
83
- <li><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" /></li>
84
- <?php endfor ?>
85
- <li><div class="input-box">
86
- <label for="billing:city"><?php echo $this->__('City') ?> <span class="required">*</span></label><br />
87
- <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="required-entry input-text" id="billing:city" /></div>
88
- <div class="input-box">
89
- <label for="billing:region"><?php echo $this->__('State/Province') ?> <span class="required">*</span></label><br/>
90
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none">
91
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
92
- </select>
93
- <script type="text/javascript">
94
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
95
- </script>
96
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none" />
97
- </div></li>
98
- <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
99
- <li><div class="input-box">
100
- <label for="billing:postcode"><?php echo $this->__('Zip/Postal Code') ?> <span class="required">*</span></label><br />
101
- <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="validate-zip-international required-entry input-text" /></div>
102
- <div class="input-box">
103
- <label for="billing:country_id"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
104
- <?php echo $this->getCountryHtmlSelect('billing') ?></div></li>
105
- <?php endif ?>
106
- <li><div class="input-box">
107
- <label for="billing:telephone"><?php echo $this->__('Telephone') ?> <span class="required">*</span></label><br/>
108
- <input type="text" name="billing[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="required-entry input-text" id="billing:telephone" /></div>
109
- <div class="input-box">
110
- <label for="billing:fax"><?php echo $this->__('Fax') ?></label><br/>
111
- <input type="text" name="billing[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="billing:fax" /></div></li>
112
- <?php if(!$this->isCustomerLoggedIn()): ?>
113
-
114
- <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
115
- <?php if ($_dob->isEnabled()): ?>
116
- <li>
117
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())
118
- ->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
119
- </li>
120
- <?php endif ?>
121
-
122
- <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
123
- <?php if ($_taxvat->isEnabled()): ?>
124
- <li>
125
- <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())
126
- ->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
127
- </li>
128
- <?php endif ?>
129
-
130
- <li id="register-customer-password">
131
- <div class="input-box">
132
- <label for="billing:customer_password"><?php echo $this->__('Password') ?> <span class="required">*</span></label><br/>
133
- <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="required-entry validate-password input-text" /></div>
134
- <div class="input-box">
135
- <label for="billing:confirm_password"><?php echo $this->__('Confirm Password') ?> <span class="required">*</span></label><br/>
136
- <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="required-entry validate-password input-text" /></div></li>
137
- <?php endif ?>
138
- <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
139
- <li><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;?> /> <label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
140
- <?php else:?>
141
- <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
142
- <?php endif;?>
143
- </ul>
144
- </fieldset>
145
- <fieldset>
146
- <?php if ($this->canShip()): ?>
147
- <p>
148
- <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1" <?php if ($this->isUseBillingAddressForShipping()) {?>checked="checked" <?php }?>onclick="$('shipping:same_as_billing').checked = true;" />&nbsp;<label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0" <?php if (!$this->isUseBillingAddressForShipping()) {?>checked="checked" <?php }?>onclick="$('shipping:same_as_billing').checked = false;" />&nbsp;<label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
149
- </p>
150
- <?php else: ?>
151
- <p class="no-display"><input type="hidden" name="billing[use_for_shipping]" value="1" /></p>
152
- <?php endif; ?>
153
- </fieldset>
154
- </form>
155
- <div class="button-set">
156
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
157
- <div id="billing-buttons-container">
158
- <button type="button" class="form-button right" onclick="_cp_addr_fields_show(); billing.save();"><span><?php echo $this->__('Continue') ?></span></button>
159
- <span id="billing-please-wait" style="display:none;" class="opc-please-wait">
160
- <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt="" /> &nbsp; <?php echo $this->__('Loading next step...') ?> &nbsp;
161
- </span>
162
- </div>
163
- </div>
164
-
165
- <script type="text/javascript">
166
- //<![CDATA[
167
- var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
168
- var billingForm = new VarienForm('co-billing-form');
169
-
170
- //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
171
- $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
172
-
173
- var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions);
174
- //]]>
175
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/dnc/craftyclicks/checkout/onepage/shipping.phtml DELETED
@@ -1,141 +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_default
22
- * @package Mage
23
- * @copyright Copyright (c) 2008 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
- <form id="co-shipping-form" action="">
28
- <?php if ($this->customerHasAddresses()): ?>
29
- <p><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></p>
30
- <p><?php echo $this->getAddressesHtmlSelect('shipping') ?></p>
31
- <?php endif ?>
32
-
33
- <fieldset class="group-select" id="shipping-new-address-form" <?php if ($this->customerHasAddresses()): ?>style="display:none"<?php endif ?>>
34
- <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
35
- <ul>
36
- <li><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())
37
- ->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
38
- <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
39
- <li><div class="input-box">
40
- <label for="shipping:company"><?php echo $this->__('Company') ?></label><br/>
41
- <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" onchange="shipping.setSameAsBilling(false);" /></div>
42
- <?php if(false): ?>
43
- <div class="input-box">
44
- <label for="shipping:email"><?php echo $this->__('Email Address') ?> <span class="required">*</span></label><br />
45
- <input type="text" name="shipping[email]" id="shipping:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="validate-email required-entry input-text" /></div>
46
- <?php endif ?>
47
- </li>
48
- <?php endif ?>
49
- <?php if (1 == Mage::getStoreConfig('general/craftyclicks/active')) : ?>
50
- <li><div class="input-box">
51
- <label for="shipping:country_id"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
52
- <?php echo $this->getCountryHtmlSelect('shipping') ?></div>
53
- <?php if (1 == Mage::getStoreConfig('general/craftyclicks/house_search')) : ?>
54
- </li>
55
- <li><div class="input-box" id="houseSearchDiv2">
56
- <label for="crafty_in_search_string2"><?php echo $this->__('House Name or Number') ?></label><br />
57
- <input type="text" title="<?php echo $this->__('House Name or Number') ?>" name="crafty_in_search_string2" id="crafty_in_search_string2" class="input-text" /></div>
58
- <?php endif ?>
59
- <div class="input-box" id="zipDiv2">
60
- <label for="shipping:postcode"><?php echo $this->__('Zip/Postal Code') ?> <span class="required">*</span></label><br />
61
- <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="validate-zip-international required-entry input-text" onchange="shipping.setSameAsBilling(false);"/></div>
62
- <div class="input-box" id="findAddrBtnDiv2" style="display:none;"><br />
63
- &nbsp;
64
- <?php if ('' != Mage::getStoreConfig('general/craftyclicks/button_image')) : ?>
65
- <img style="cursor: pointer;" src="<?php echo $this->getSkinUrl('craftyclicks/'.Mage::getStoreConfig('general/craftyclicks/button_image')); ?>" onclick="_cp_do_lookup2()" title="Find Address" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>"/>
66
- <?php else : ?>
67
- <button type="button" onclick="_cp_do_lookup2()" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>">Find Address</button>
68
- <?php endif ?>
69
- </div>
70
- </li>
71
- <li><span style="display:none;" id="crafty_postcode_result_display2">&nbsp;
72
- </span></li>
73
- <li><div class="input-box">
74
- <label for="shipping:company"><?php echo $this->__('Company') ?></label><br/>
75
- <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" onchange="shipping.setSameAsBilling(false);" /></div>
76
- </li>
77
- <?php endif ?>
78
- <li><label for="shipping:street1"><?php echo $this->__('Address') ?> <span class="required">*</span></label><br />
79
- <input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="required-entry input-text" onchange="shipping.setSameAsBilling(false);" /></li>
80
- <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
81
- <li><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);"/></li>
82
- <?php endfor ?>
83
- <li><div class="input-box">
84
- <label for="shipping:city"><?php echo $this->__('City') ?> <span class="required">*</span></label><br />
85
- <input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="required-entry input-text" id="shipping:city" onchange="shipping.setSameAsBilling(false);" /></div>
86
- <div class="input-box">
87
- <label for="shipping:region_id"><?php echo $this->__('State/Province') ?> <span class="required">*</span></label><br />
88
- <select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none">
89
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
90
- </select>
91
- <script type="text/javascript">
92
- $('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
93
- </script>
94
- <input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none" /></div></li>
95
- <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
96
- <li><div class="input-box">
97
- <label for="shipping:postcode"><?php echo $this->__('Zip/Postal Code') ?> <span class="required">*</span></label><br />
98
- <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="validate-zip-international required-entry input-text" onchange="shipping.setSameAsBilling(false);"/></div>
99
- <div class="input-box">
100
- <label for="shipping:country_id"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
101
- <?php echo $this->getCountryHtmlSelect('shipping') ?>
102
- </div></li>
103
- <?php endif ?>
104
- <li><div class="input-box">
105
- <label for="shipping:telephone"><?php echo $this->__('Telephone') ?> <span class="required">*</span></label><br />
106
- <input type="text" name="shipping[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="required-entry input-text" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" /></div>
107
- <div class="input-box">
108
- <label for="shipping:fax"><?php echo $this->__('Fax') ?></label><br />
109
- <input type="text" name="shipping[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" /></div></li>
110
- <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
111
- <li><input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> /> <label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
112
- <?php else:?>
113
- <li><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
114
- <?php endif;?>
115
- </ul>
116
- </fieldset>
117
- <p><input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1" <?php if($this->getAddress()->getSameAsBilling()): ?>checked="checked"<?php endif ?> onclick="shipping.setSameAsBilling(this.checked)" /> &nbsp;<label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label></p>
118
- </form>
119
- <div class="button-set">
120
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
121
- <div id="shipping-buttons-container">
122
- <a href="#" class="back left" onclick="checkout.back(); return false;"><?php echo $this->__('Back') ?></a>
123
- <button type="button" class="form-button right" onclick="shipping.save()"><span><?php echo $this->__('Continue') ?></span></button>
124
- <span id="shipping-please-wait" style="display:none;" class="opc-please-wait">
125
- <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt="" /> &nbsp; <?php echo $this->__('Loading next step...') ?> &nbsp;
126
- </span>
127
- </div>
128
- </div>
129
-
130
- <script type="text/javascript">
131
- //<![CDATA[
132
- var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
133
- '<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
134
- var shippingForm = new VarienForm('co-shipping-form');
135
- shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
136
- //shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
137
- $('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
138
-
139
- var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', countryRegions);
140
- //]]>
141
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/default/default/template/dnc/craftyclicks/customer/address/edit.phtml DELETED
@@ -1,174 +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_default
22
- * @package Mage
23
- * @copyright Copyright (c) 2008 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
- <?php
28
- /**
29
- * Edit customer address template
30
- *
31
- * @see Mage_Customer_Block_Address_Edit
32
- */
33
- ?>
34
- <?php if($this->getTitle()): ?>
35
- <div class="page-head">
36
- <h3><?php echo $this->getTitle() ?></h3>
37
- </div>
38
- <?php endif; ?>
39
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
40
- <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate">
41
- <fieldset class="group-select">
42
- <?php echo $this->getBlockHtml('formkey')?>
43
- <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
44
- <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
45
- <h4 class="legend"><?php echo $this->__('Contact Information') ?></h4>
46
- <ul>
47
- <li>
48
- <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getCustomer())->toHtml() ?>
49
- </li>
50
- <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
51
- <li>
52
- <label for="company"><?php echo $this->__('Company') ?></label><br />
53
- <input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" class="input-text" />
54
- </li>
55
- <?php endif ?>
56
- <li>
57
- <div class="input-box">
58
- <label for="telephone"><?php echo $this->__('Telephone') ?> <span class="required">*</span></label><br />
59
- <input type="text" name="telephone" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="required-entry input-text" id="telephone" />
60
- </div>
61
- <div class="input-box">
62
- <label for="fax"><?php echo $this->__('Fax') ?></label><br />
63
- <input type="text" name="fax" id="fax" title="<?php echo $this->__('Fax') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" class="input-text" />
64
- </div>
65
- </li>
66
- </ul>
67
- </fieldset>
68
- <fieldset class="group-select">
69
- <h4 class="legend"><?php echo $this->__('Address') ?></h4>
70
- <ul>
71
- <?php if (1 == Mage::getStoreConfig('general/craftyclicks/active')) : ?>
72
- <li>
73
- <div class="input-box">
74
- <label for="country"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
75
- <?php echo $this->getCountryHtmlSelect() ?>
76
- </div>
77
- <?php if (1 == Mage::getStoreConfig('general/craftyclicks/house_search')) : ?>
78
- </li>
79
- <li>
80
- <div class="input-box" id="houseSearchDiv">
81
- <label for="crafty_in_search_string"><?php echo $this->__('House Name or Number') ?></label><br />
82
- <input type="text" title="<?php echo $this->__('House Name or Number') ?>" name="crafty_in_search_string" id="crafty_in_search_string" class="input-text" /></div>
83
- <?php endif ?>
84
- <div class="input-box" id="zipDiv">
85
- <label for="zip"><?php echo $this->__('Zip/Postal Code') ?> <span class="required">*</span></label><br />
86
- <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="validate-zip-international required-entry input-text" />
87
- </div>
88
- <div class="input-box" id="findAddrBtnDiv" style="display:none;">
89
- <br />
90
- &nbsp;
91
- <?php if ('' != Mage::getStoreConfig('general/craftyclicks/button_image')) : ?>
92
- <img style="cursor: pointer;" src="<?php echo $this->getSkinUrl('craftyclicks/'.Mage::getStoreConfig('general/craftyclicks/button_image')); ?>" onclick="_cp_do_lookup()" title="Find Address" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>"/>
93
- <?php else : ?>
94
- <button type="button" onclick="_cp_do_lookup()" class="<?php echo Mage::getStoreConfig('general/craftyclicks/button_class');?>">Find Address</button>
95
- <?php endif ?>
96
- </div>
97
- </li>
98
- <li><span style="display:none;" id="crafty_postcode_result_display">
99
- &nbsp;
100
- </span></li>
101
- <li>
102
- <label for="company"><?php echo $this->__('Company') ?></label><br />
103
- <input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" class="input-text" />
104
- </li>
105
- <?php endif ?>
106
- <li>
107
- <label for="street_1"><?php echo $this->__('Street Address') ?> <span class="required">*</span></label><br />
108
- <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="required-entry input-text" />
109
- </li>
110
- <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
111
- <li>
112
- <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address '.$_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
113
- </li>
114
- <?php endfor ?>
115
- <li>
116
- <div class="input-box">
117
- <label for="city"><?php echo $this->__('City') ?> <span class="required">*</span></label><br />
118
- <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="required-entry input-text" id="city" />
119
- </div>
120
- <div class="input-box">
121
- <label for="region_id"><?php echo $this->__('State/Province') ?> <span class="required">*</span></label><br />
122
- <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none">
123
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
124
- </select>
125
- <script type="text/javascript">
126
- $('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
127
- </script>
128
- <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none" />
129
- </div>
130
- </li>
131
- <?php if (1 != Mage::getStoreConfig('general/craftyclicks/active')) : ?>
132
- <li>
133
- <div class="input-box">
134
- <label for="zip"><?php echo $this->__('Zip/Postal Code') ?> <span class="required">*</span></label><br />
135
- <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="validate-zip-international required-entry input-text" />
136
- </div>
137
- <div class="input-box">
138
- <label for="country"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
139
- <?php echo $this->getCountryHtmlSelect() ?>
140
- </div>
141
- </li>
142
- <?php endif ?>
143
- <li>
144
- <?php if($this->isDefaultBilling()): ?>
145
- <strong><?php echo $this->__('Default Billing Address') ?></strong>
146
- <?php elseif($this->canSetAsDefaultBilling()): ?>
147
- <input type="checkbox" id="primary_billing" name="default_billing" value="1" />&nbsp;
148
- <label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
149
- <?php else: ?>
150
- <input type="hidden" name="default_billing" value="1" />
151
- <?php endif; ?>
152
- </li>
153
- <li>
154
- <?php if($this->isDefaultShipping()): ?>
155
- <strong><?php echo $this->__('Default Shipping Address') ?></strong>
156
- <?php elseif($this->canSetAsDefaultShipping()): ?>
157
- <input type="checkbox" id="primary_shipping" name="default_shipping" value="1" />&nbsp;
158
- <label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
159
- <?php else: ?>
160
- <input type="hidden" name="default_shipping" value="1" />
161
- <?php endif; ?>
162
- </li>
163
- </ul>
164
- </fieldset>
165
- <div class="button-set">
166
- <p class="required"><?php echo $this->__('* Required Fields') ?></p>
167
- <a href="<?php echo $this->getBackUrl() ?>" class="left">&laquo; <?php echo $this->__('Back') ?></a>
168
- <button class="form-button" type="submit"><span><?php echo $this->__('Save Address') ?></span></button>
169
- </div>
170
- </form>
171
- <script type="text/javascript">
172
- var dataForm = new VarienForm('form-validate', true);
173
- new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
174
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/{Dnc_Craftyclicks.xml → CraftyClicks.xml} RENAMED
@@ -1,10 +1,10 @@
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
- <Dnc_Craftyclicks>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
- <version>1.7</version>
8
- </Dnc_Craftyclicks>
9
  </modules>
10
  </config>
1
  <?xml version="1.0"?>
2
  <config>
3
  <modules>
4
+ <CraftyClicks>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
+ <version>2.2.0</version>
8
+ </CraftyClicks>
9
  </modules>
10
  </config>
js/crafty/crafty_postcode.js DELETED
@@ -1,18 +0,0 @@
1
- // Compression by ScriptingMagic.com
2
- /********************************************************************************
3
- // This is a collection of JavaScript code to allow easy integration of
4
- // postcode lookup functionality into any website
5
- //
6
- // Provided by www.CraftyClicks.co.uk
7
- //
8
- // Version - 4.2 (26/02/2010)
9
- //
10
- // Feel free to copy/use/modify this code any way you see fit. Please keep this
11
- // comment header in place when you do.
12
- //
13
- // To integrate UK postcode lookup on your website, please visit www.craftyclicks.co.uk for
14
- // details of how to sign up for an account.
15
- //
16
- // Compacted by ScriptingMagic.com to speed up load time, if you want the full version, please email us.
17
- **********************************************************************************/
18
- eval((function(){var a="s��%��reate(%++;�=new�O��.obj%=%;�}�FLAT�SHOP�UNIT�BLOCK�STALL�SUITE�APARTMENT�MAISONETTE�HOUSE NUMBER��8�ip_prefix�Lc�c<;c++b=[c];b==a�(0,b).toUpp�Ca()�9�(b)�}(��8extract_�_n�J�LK(b=a.s�ft()!isNaN(�b))(�b)�}} �(e!ee=window.ev}�cc=��Hcc=�H}}cc==13on�(�}�O�={�I_url�pcls1.crafty�s.co.uk/js/getAddsListByP.php�access_token��tradit�al_��A�:p_busy.gif��3�Aorg�1,��1,��0,addr�0,�2:� �msg1�P`a wait �K we find the ��#1�5��@2�5 is not valid� try again�@3�Unab` to connect to � �I rv��.�#4�An unexpected �ror occured�.�_auto`ct:1,�:1,�!�A�:10000,form��e`ms����400px���A�_����1���ready:�,��:�,�:�,pre_populate_common_�_parts�Ae`m_�/��/��_num���1��1��2��2��3��3���������p:in_out_p��:in_��#5�The � n�-/n�J�.};xmlhttp����_arr��%�cc�����obj_n�-��_arch�t�,b�[a]=b};��ed�cc++;��(a)�7�3&&((2>=�&&1<cc)||(2<�))�(��cc=0}}};����00==a0a--}}a=�_arr[a][in�x]�(�[a]�����(a�1}���b��c=�2;�i�i<8;i++i]=get_e`m(i�0]0a[org]}d��-2�����-1]d+=c}d+��-1�e��J�7]7d;��=e�=c}�=e;d�e=}f=a[�1�g=a[�2��e�gg=e�g�ff=e�ff=e}}}h=g+(g==?:(f=@)+f;j=� _�p�k=� ��h&&�h)==h�jj�Bjk�Bk}h�f=}l=j+(j=@+k;m=�;�&&3]�||!=d�:�d}�M~f�~g�f��h�~h�l}��h�j�k�4�j�k���M�f�4����g�f;��j��kh<l�h�j�k��l}}}}}���:�m��=h�l�g��h���h�l��h&&!=d�d�l�l�d�h(d+h)<(h+l)��Fh�l�d��}}}}�n;1]n=1]2]n=2]n=3]}}�n�=+c+ln�=�F�}}}4]4� �]}5]5� �]}1};show_busy=(�a=�,img��Esrc�6�z�Etit`�6msg1z�(a�;�_�r�,b�c��a�d�0001�1q0002�2q9001�3�;�fault:�(+a+)�+#4�}�!�e�8000�No Access Token�#1� Format�#2��#3�Out of Credits��}d+=e+ :: DBG ::�+b}c=�d��(c�d�};�_#��b��ab=�a��(b�a�};�lay_��,b�=�(���!=���6c)���,`ct�d.i��;�G���ed���Gkeyps=�;�7��Gchange����d.sty`.width=�;e=�%;�0e++}�N�-==Microsoft Int�net Explor�)&&(parFloat�V�s�)<=4)�0e>=����e}}d6c��(d�};���c`arTimeout(��try{��b=�(�1�b.hasC�ldNo�s()�K�b.removeC�ld��}�==aa=�xa0�b6a�}catch(�}};�&=(s�l�r=s-1;�K(l<s&&s[l�Dl++}�K(r>l&&s[r�Dr-=1}s�ing(l,r+1�;cp_uc�PC�%UK�%EU==a�9�b=ABCDEFGHIJKLMNOPQRSTUVWXYZ;c��1;e��f�f<a;f++-1!=b.in�xOf()d||e�;�0�.toLow�Ca(��;f+2>=a&&'=�C(�)�Nf+3<��;1e=1�)==�;1-�-�N(-1!=�&&f+3>=�)||f+3>=a�;0e��1�f+2<a&&0<=&&9>�C�1}}}}}}}(c�;`ading_caps�,b�7b||2>a�9�c��a.split(���e�e<d;e++�f=�&(d[e]�",b=0,d=0,c=[],f="#%6@`q~��������������������������������������������������������������z�������������������������� �!�#�%�&�,�-�/�0�1��2�3�4�5�6�7�8�9�:�;�=�@�A�B�C�D�E��F�G�H�I�J�K�L�M�N�O",e,g;while(d<f.length){e='';while((g=f.charAt(d++))=="�")e+=g;e+=g;c[b++]=e}for(b=c.length-1;b>=0;)a=a.replace(new RegExp(c[b],"g"),("\\\042\n].value=this.}else{config.if(document.create_cp_instancevar function){res.lengtha.charAt(f)ostcodeentb[crafty_ er your adds manuallyreturn sea[pobox]err_msg_idx.appendChild(=?:c)le;break;ca 2localityupdate_;3lookup_timeoutTextNode(null,e`m_`ctedstreet1 could not be found, p`a try againdocum.getE`mById_line!=ult_==_cp_prefix_liston_errorparInt();=(a_upperca:=0;ion,.value:out_:e= :: =;=a[houn=Funct�(s[+obj%+]._Attribute_p_lookup_�opt�+obj%==clo%=a.indexOf(c=E`m(opt��c6�a)�)};populate_form_fields=new Array(county CraftyPCded=dispclickfirstmax�s_`ct_on_changehi ;~h+(h=@+lpResultstr�j~k�~j�k}(navigator.app:er�Invalid Token�switch(aca�];=�;_cp__key_psd.size=;a.t�No�(b�busy_img_urls[%]arch_�ing, p`a;breakd&&!1]&&2](�In�x�max_width:�#config(b.�C�ld+�+.sub�addsc=c+clo%e.keyCo�for(houon_�town�g�f���(�arr�[�bug_mo��q800==a||�_trimE`m(amecompany��_��e`m_id�limit���_ult���T�s p�b�=0!= _cp_(a��e��7]�+= or�#:0,=�h)�=�0]==�b=�(}d+(�@+d.one.w�chlookupumb�w�`(a�b���l�g�f+1��lass(".split(""))[b--]);var r=a;a="Wf#Wc#�c+ }�c+cp_uc(f��(c`;��aQa�a��a��a%�a�a��a���(a`;�a,b#a�>b��a�<b��`a�>b��a�<b��`c;��a#c�a�,a�)��a`d;��b#d�b�,b�)�d=b`��c&&�d1�Wc&&�d��c>d�c<d��}ePa1�1�ePa2�2�e=a�+a�;f=b�+b�;�a>b�a<b�`�(1`;�#=.sort(��a=���;JarrQ�0��[b];d=c�c���c���c%�%c��? :)+c���c���@+(@G+(G�;eQe�in�x=b;e��r=d;�=e}W�#��,-1`�0�����r,b`p�_popul�e_common_add�ss_parts�f=�(�f�;f���;f���;f%�%;f�;f���;f���;�1�[b]�f#fq��f�#f�q��f�#f�q%�f%#f%q�f#fq��f�#f�q��f�#f�=}}�f�;�a�b���;W��d=�.split(,�b=d[a]�a#c 0company;1�1;2�2;3�3;4�;5~y;6:��;7hBe_num;8search_�ring;�}}Wb#W�m#c��ms[�m].�[b]�#��(b�}�(c`;doHBeSearch�a=�(8�a&&0<�Y#�=1}�(`;�#xmlL=�;a=�(6�b=�;a#show_busy(��=setTimeout(��_�r(),��b=�(�`��b#�(b��0002,in� � �m��;�a�b�do{b=a;a=a.�place(/[^A-Za-z0-9]/,`while(b�a�b=a.toUpp�C(�7>=bY&&5<=bY�c�bY-3,bY�d�0,bY-3�true==/[CIKMOV]/.te�(c)#��}�0<R09>R0A<R1Z>R1A<R2Z>R2)#�dY#c 2���1)b`3�)#��������1A�2Z�2)b�}}4��#�0�39�3)�A�3Z�3)b�}�;�:�}}}��};�a#try{b=�(�sult_e_id�c��Ls:=�loc�ion.protocol#�Ls://�L://}c+=lookup_url+?�=+a+�=���_id=0;W�#c+=&key=+�}cs�c��eEX(��cs.sr�c;cs.type=text/java�;b.appendChild(cs`c�ch(�#�1206,��;�a,b,c#!b�d�r_co�;e��;�7001�d#0�eY#�Demo � �ached, ple use one of: +e��Sorry. Demo usage has a daily �.`�8001�d#�d,In� Token Form�. +e��d,s�v� �ror co���#�filt�_d�a_by_hBe_name(c��==c#���5��turn}}Q�s_GQ��,���G�G@double_�G�#~y���~ypo�al_~y�`=0;�(f=1;f<=c�~;f++�g=��;W�N#g�N}ggh=���;W��N#h��N}hh�(j=1;j<=��liv�y_point_~;j++�k=�(�k�=g;k�=h;l=c[f][j];k=l���;k�l�sub_��k�l���k=l��partmX_�;Wk&&��#k+=���}kk+�,org��k%l�po_box_�[]=k;++}}#�&&1==#upd�e_�s(���[0]��(�0��s_autoselect#W�#�1��0�documen",b=0,d=0,c=[],f="�P#%@GJPQRWXY`q~��N��B��������������������������������������������������������������L��@��������������������";while(d<f.length){e='';while((g=f.charAt(d++))=="�")e+=g;e+=g;c[b++]=e}for(b=c.length-1;b>=0;)a=a.replace(new RegExp(c[b],"g"),("\042this.�P[housenconfig.=d.charAt(res_arr){return ([street=leading_caps(if(]res_locality[asevar ,addr_upperc);ame}else{[orgumber)&&=function(break;c parseInt(thoroughfare_!=?a:)+:b=elem_){[pobox_res_linelocalitydisp_=_cp_strip_prefix(=new Array();=c.charAt(!=ent.length)}=}[b]countlem-1);!isNaN(descriptor<documX.getEXByIdousrec[f][=_cp_extract_hBe_number(Array(>_idxdependX_=;_cp_instances[+obj_idx+.erlookup_timeout12�turn e>f1`e<f�`=[0]namefornullhBe_search�10�29�2)populate_�m_fields();:A�0Z�0_upp�c[;b<;b++#building_handle_js_�sponser_msgdi�ct_xml_fetchl�organisation_�st=documX.de�e))#e=e`fPb!=traditional_~yget_e�s_selected(access_token��c���)+(climittownvalid=b.sub�ring(==fir�@po�co��f))#f=f`�display@(1`#J�r(`}atc=doLookuphttp&callbacknew@G_�p_compa���et0�19�(b=��e_pc+= +�J�s_arrJarr[b]a.valueswitch(scriptb��,~y�=c��roA�1Z�J��(b�akeXsnumb��fault".split(""))[b--]);r+=a;a="t.getElementById(crafty_Kcode_lookup_M_op+obj_idx).focus(P!=c:m/6);m&=c}:(P}else%1205,no M to displayP}};filtR_data_by_house_nameJa:b/8);!b||!b&.length:a}c=b&.toUppRCase()Qd=-1;c)==c:d=cPe=+cQfQg=1QAj=1;j<3F;j++X];Ak=1;k<=a[j;k++:l[k]Qm=S7+S+;-1!=m.indexOf(e)||d==l):h++h]474744#4#D4D}}hX=hVHWHVWVHWHVW;g++}}1<g:fF=g-1@N3N@3@G3G@L3L@K3K;f=a;f}null};_RrJ)%9001,IntRnal Timeout aftR +config.+msP}",b=0,d=0,c=[],f="�#%&/347:@ADFGHJKLMNPQRSVWX";while(d<f.length){e='';while((g=f.charAt(d++))=="�")e+=g;e+=g;c[b++]=e}for(b=c.length-1;b>=0;)a=a.replace(new RegExp(c[b],"g"),("\042thoroughfare_�building_ndependent_ame];f[g][descriptor][this.var locality]postcode]al_county]umber]]delivery_point_count]config.on_result_ready=new Array()tion=a[j]parseInt(h]lookup_timeoutdepartment_nif(return organisa_n{disp_err(.value=get_elem(=a=lsub_){;fh=0;for(po_box_ncount]double_n =func(posttradiresulttown])};er+l:f[g".split(""))[b--]);return r+a})());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/craftyclicks/crafty_postcode.class.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ // This is a collection of JavaScript code to allow easy integration of
3
+ // postcode / address finder functionality into any website
4
+ //
5
+ // Provided by www.CraftyClicks.co.uk
6
+ //
7
+ // Version - 4.9.0 (26/11/2010)
8
+ //
9
+ // Feel free to copy/use/modify this code any way you see fit. Please keep this
10
+ // comment header in place when you do.
11
+ //
12
+ // To integrate UK postcode / address lookup on your website, please visit www.craftyclicks.co.uk for
13
+ // details of how to sign up for an account.
14
+ //
15
+ **********************************************************************************/
16
+ var _cp_instances=[],_cp_instance_idx=0,_cp_pl=["FLAT","SHOP","UNIT","BLOCK","STALL","SUITE","APARTMENT","MAISONETTE","HOUSE NUMBER"];function CraftyPostcodeCreate(){_cp_instance_idx++;_cp_instances[_cp_instance_idx]=new CraftyPostcodeClass();_cp_instances[_cp_instance_idx].obj_idx=_cp_instance_idx;return _cp_instances[_cp_instance_idx]}function _cp_sp(b){var d="",c;for(c=0;c<_cp_pl.length;c++){d=_cp_pl[c];if(d==b.substr(0,d.length).toUpperCase()){return(b.substr(d.length))}}return("")}function _cp_eh(a){var b="";while(b=a.shift()){if(!isNaN(parseInt(b))){return(parseInt(b))}}return""}function _cp_kp(a){var b;if(!a){a=window.event}if(a.keyCode){b=a.keyCode}else{if(a.which){b=a.which}}if(b==13){this.onclick()}}function CraftyPostcodeClass(){this.config={lookup_url:"pcls1.craftyclicks.co.uk/js/",access_token:"",basic_address:0,traditional_county:0,busy_img_url:"crafty_postcode_busy.gif",hide_result:0,org_uppercase:1,town_uppercase:1,county_uppercase:0,addr_uppercase:0,delimiter:", ",msg1:"Please wait while we find the address",err_msg1:"This postcode could not be found, please try again or enter your address manually",err_msg2:"This postcode is not valid, please try again or enter your address manually",err_msg3:"Unable to connect to address lookup server, please enter your address manually.",err_msg4:"An unexpected error occured, please enter your address manually.",res_autoselect:1,res_select_on_change:1,debug_mode:0,lookup_timeout:10000,form:"",elements:"",max_width:"400px",max_lines:0,first_res_line:"---- please select your address ----",result_elem_id:"",on_result_ready:null,on_result_selected:null,on_error:null,pre_populate_common_address_parts:0,elem_company:"crafty_out_company",elem_house_num:"",elem_street1:"crafty_out_street1",elem_street2:"crafty_out_street2",elem_street3:"crafty_out_street3",elem_town:"crafty_out_town",elem_county:"crafty_out_county",elem_postcode:"crafty_in_out_postcode",elem_udprn:"crafty_out_udprn",single_res_autoselect:0,single_res_notice:"---- address found, see below ----",elem_search_house:"crafty_in_search_house",elem_search_street:"crafty_in_search_street",elem_search_town:"crafty_in_search_town",max_results:25,err_msg5:"The house name/number could not be found, please try again.",err_msg6:"No results found, please modify your search and try again.",err_msg7:"Too many results, please modify your search and try again.",err_msg9:"Please provide more data and try again.",err_msg8:"Trial account limit reached, please use AA11AA, AA11AB, AA11AD or AA11AE."};this.xmlhttp=null;this.res_arr=null;this.disp_arr=null;this.res_arr_idx=0;this.dummy_1st_line=0;this.cc=0;this.flexi_search=0;this.lookup_timeout=null;this.obj_name="";this.house_search=0;this.set=function(a,b){this.config[a]=b};this.res_clicked=function(a){this.cc++;if(this.res_selected(a)){if(0!=this.config.hide_result&&((2>=this.config.max_lines&&1<this.cc)||(2<this.config.max_lines))){this.update_res(null);this.cc=0}}};this.res_selected=function(a){if(1==this.dummy_1st_line){if(0==a){return 0}else{a--}}a=this.disp_arr[a]["index"];this.populate_form_fields(this.res_arr[a]);if(this.config.on_result_selected){this.config.on_result_selected(a)}return 1};this.populate_form_fields=function(j){var b=[];var o=this.config.delimiter;for(var e=0;e<8;e++){b[e]=this.get_elem(e)}b[11]=this.get_elem(11);if(b[11]){b[11].value=j.udprn}if(b[0]){if(b[0]==b[1]&&""!=j.org){b[1].value=j.org;b[1]=b[2];b[2]=b[3];b[3]=null}else{b[0].value=j.org}}var n=j.housename2;if(""!=n&&""!=j.housename1){n+=o}n+=j.housename1;var k=j.housenumber;if(b[7]){b[7].value=n;if(""!=n&&""!=k){b[7].value+=o}b[7].value+=k;n="";k=""}var d=j.street1;var c=j.street2;if(""!=k){if(""!=c){c=k+" "+c}else{if(""!=d){d=k+" "+d}else{d=k}}}var g=c+(c==""?"":(d==""?"":o))+d;var m=j.locality_dep;var h=j.locality;if(""!=g&&parseInt(g)==g){if(""!=m){m=parseInt(g)+" "+m}else{h=parseInt(g)+" "+h}g="";d=""}var f=m+(m==""||h==""?"":o)+h;var a=g+(g==""||f==""?"":o)+f;if(b[1]&&b[2]&&b[3]){if(""!=j.pobox||""!=n){if(""!=j.pobox){b[1].value=j.pobox}else{b[1].value=n}if(""==f){if(""==c){b[2].value=d;b[3].value=""}else{b[2].value=c;b[3].value=d}}else{if(""==g){if(""==m){b[2].value=h;b[3].value=""}else{b[2].value=m;b[3].value=h}}else{b[2].value=g;b[3].value=f}}}else{if(""==g){if(""==m){b[1].value=h;b[2].value="";b[3].value=""}else{b[1].value=m;b[2].value=h;b[3].value=""}}else{if(""==f){if(""==c){b[1].value=d;b[2].value="";b[3].value=""}else{b[1].value=c;b[2].value=d;b[3].value=""}}else{if(""==c){b[1].value=d;if(""==m){b[2].value=h;b[3].value=""}else{b[2].value=m;b[3].value=h}}else{if(""==m){b[1].value=c;b[2].value=d;b[3].value=h}else{if(g.length<f.length){b[1].value=g;b[2].value=m;b[3].value=h}else{b[1].value=c;b[2].value=d;b[3].value=f}}}}}}}else{if(b[1]&&b[2]){if(""!=j.pobox){b[1].value=j.pobox;b[2].value=a}else{if(""!=n&&""!=g&&""!=f){if((n.length+g.length)<(g.length+f.length)){b[1].value=n+(n==""?"":o)+g;b[2].value=f}else{b[1].value=n;b[2].value=g+(g==""?"":o)+f}}else{if(""!=n&&""!=g){b[1].value=n;b[2].value=g}else{if(""==n&&""!=g){if(""==f){if(""!=c){b[1].value=c;b[2].value=d}else{b[1].value=g;b[2].value=""}}else{b[1].value=g;b[2].value=f}}else{if(""==g&&""!=n){b[1].value=n;b[2].value=f}else{b[1].value=f;b[2].value=""}}}}}}else{var l;if(b[1]){l=b[1]}else{if(b[2]){l=b[2]}else{l=b[3]}}if(""!=j.pobox){l.value=j.pobox+o+f}else{l.value=n+(n==""||a==""?"":o)+a}}}if(b[4]){b[4].value=j.town}if(b[5]){b[5].value=j.county}if(b[6]){b[6].value=j.postcode}return 1};this.show_busy=function(){var b=document.createElement("img");var a=document.createAttribute("src");a.value=this.config.busy_img_url;b.setAttributeNode(a);a=document.createAttribute("title");a.value=this.config.msg1;b.setAttributeNode(a);this.update_res(b)};this.disp_err=function(d,b){var a=null;var e="";if(""!=d){switch(d){case"0001":e=this.config.err_msg1;break;case"0002":e=this.config.err_msg2;break;case"9001":e=this.config.err_msg3;break;case"0003":e=this.config.err_msg9;break;case"0004":e=this.config.err_msg6;break;case"0005":e=this.config.err_msg7;break;case"7001":e=this.config.err_msg8;break;default:e="("+d+") "+this.config.err_msg4;break}if(this.config.debug_mode){var c="";switch(d){case"8000":c=" :: No Access Token ";break;case"8001":c=" :: Invalid Token Format ";break;case"8002":c=" :: Invalid Token ";break;case"8003":c=" :: Out of Credits ";break;case"8004":c=" :: Restricted by rules ";break;case"8005":c=" :: Token suspended ";break}e+=c+" :: DBG :: "+b}a=document.createTextNode(e)}this.update_res(a);if(this.config.on_error){this.config.on_error(e)}};this.disp_err_msg=function(b){var a=null;if(""!=b){a=document.createTextNode(b)}this.update_res(a);if(this.config.on_error){this.config.on_error(b)}};this.display_res_line=function(d,c){var b=document.getElementById("crafty_postcode_lookup_result_option"+this.obj_idx);var e=document.createElement("option");e.appendChild(document.createTextNode(d));if(null!=b){b.appendChild(e)}else{var a=document.createElement("select");a.id="crafty_postcode_lookup_result_option"+this.obj_idx;a.onclick=Function("_cp_instances["+this.obj_idx+"].res_clicked(this.selectedIndex);");a.onkeypress=_cp_kp;if(0!=this.config.res_select_on_change){a.onchange=Function("_cp_instances["+this.obj_idx+"].res_selected(this.selectedIndex);")}if(this.config.max_width&&""!=this.config.max_width){a.style.width=this.config.max_width}var f=this.res_arr_idx;if(1==this.dummy_1st_line){f++}if((navigator.appName=="Microsoft Internet Explorer")&&(parseFloat(navigator.appVersion)<=4)){a.size=0}else{if(f>=this.config.max_lines){a.size=this.config.max_lines}else{a.size=f}}a.appendChild(e);this.update_res(a)}};this.update_res=function(a){if(this.lookup_timeout){clearTimeout(this.lookup_timeout)}try{if(document.getElementById){var b=document.getElementById(this.config.result_elem_id);if(b.hasChildNodes()){while(b.firstChild){b.removeChild(b.firstChild)}}if(null!=a){b.appendChild(a)}}}catch(c){}};this.str_trim=function(b){var a=0;var c=b.length-1;while(a<b.length&&b[a]==" "){a++}while(c>a&&b[c]==" "){c-=1}return b.substring(a,c+1)};this.cp_uc=function(e){if("PC"==e||"UK"==e||"EU"==e){return(e)}var d="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var c="";var f=1;var b=0;for(var a=0;a<e.length;a++){if(-1!=d.indexOf(e.charAt(a))){if(f||b){c=c+e.charAt(a);f=0}else{c=c+e.charAt(a).toLowerCase()}}else{c=c+e.charAt(a);if(a+2>=e.length&&"'"==e.charAt(a)){f=0}else{if("("==e.charAt(a)){close_idx=e.indexOf(")",a+1);if(a+3<close_idx){b=0;f=1}else{b=1}}else{if(")"==e.charAt(a)){b=0;f=1}else{if("-"==e.charAt(a)){close_idx=e.indexOf("-",a+1);if((-1!=close_idx&&a+3>=close_idx)||a+3>=e.length){b=0;f=0}else{b=0;f=1}}else{if(a+2<e.length&&"0"<=e.charAt(a)&&"9">=e.charAt(a)){f=0}else{f=1}}}}}}}return(c)};this.leading_caps=function(a,b){if(0!=b||2>a.length){return(a)}var d="";var f=a.split(" ");for(var c=0;c<f.length;c++){var e=this.str_trim(f[c]);if(""!=e){if(""!=d){d=d+" "}d=d+this.cp_uc(e)}}return(d)};this.new_res_line=function(){var a=[];a.org="";a.housename1="";a.housename2="";a.pobox="";a.housenumber="";a.street1="";a.street2="";a.locality_dep="";a.locality="";a.town="";a.county="";a.postcode="";a.udprn="";return(a)};this.res_arr_compare=function(e,c){if(e.match_quality>c.match_quality){return(1)}if(e.match_quality<c.match_quality){return(-1)}if(e.street1>c.street1){return(1)}if(e.street1<c.street1){return(-1)}if(e.street2>c.street2){return(1)}if(e.street2<c.street2){return(-1)}var h;if(""==e.housenumber){h=_cp_eh(Array(e.housename1,e.housename2))}else{h=parseInt(e.housenumber)}var g;if(""==c.housenumber){g=_cp_eh(Array(c.housename1,c.housename2))}else{g=parseInt(c.housenumber)}if(""==h&&""!=g){return(1)}else{if(""!=h&&""==g){return(-1)}else{if(h>g){return(1)}if(h<g){return(-1)}}}var f=_cp_sp(e.housename1);if(!isNaN(parseInt(f))){f=parseInt(f)}var d=_cp_sp(c.housename1);if(!isNaN(parseInt(d))){d=parseInt(d)}if(f>d){return(1)}if(f<d){return(-1)}var f=_cp_sp(e.housename2);if(!isNaN(parseInt(f))){f=parseInt(f)}var d=_cp_sp(c.housename2);if(!isNaN(parseInt(d))){d=parseInt(d)}if(f>d){return(1)}if(f<d){return(-1)}f=e.housename2+e.housename1;d=c.housename2+c.housename1;if(f>d){return(1)}if(f<d){return(-1)}if(e.org>c.org){return(1)}if(e.org<c.org){return(-1)}return(1)};this.disp_res_arr=function(){this.res_arr=this.res_arr.sort(this.res_arr_compare);if(0!=this.config.res_autoselect){this.populate_form_fields(this.res_arr[0])}var a=this.config.delimiter;this.disp_arr=[];for(var c=0;c<this.res_arr_idx;c++){var e=this.res_arr[c];var b=e.org+(e.org!=""?a:"")+e.housename2+(e.housename2!=""?a:"")+e.housename1+(e.housename1!=""?a:"")+e.pobox+(e.pobox!=""?a:"")+e.housenumber+(e.housenumber!=""?" ":"")+e.street2+(e.street2!=""?a:"")+e.street1+(e.street1!=""?a:"")+e.locality_dep+(e.locality_dep!=""?a:"")+e.locality+(e.locality!=""?a:"")+e.town;if(this.flexi_search){b+=a+e.postcode}var d=[];d.index=c;d.str=b;this.disp_arr[c]=d}this.dummy_1st_line=0;if(""!=this.config.first_res_line){this.dummy_1st_line=1;this.display_res_line(this.config.first_res_line,-1)}for(var c=0;c<this.res_arr_idx;c++){this.display_res_line(this.disp_arr[c]["str"],c)}if(this.config.pre_populate_common_address_parts){var f=this.new_res_line();f.org=this.res_arr[0]["org"];f.housename1=this.res_arr[0]["housename1"];f.housename2=this.res_arr[0]["housename2"];f.pobox=this.res_arr[0]["pobox"];f.housenumber=this.res_arr[0]["housenumber"];f.street1=this.res_arr[0]["street1"];f.street2=this.res_arr[0]["street2"];f.locality_dep=this.res_arr[0]["locality_dep"];f.locality=this.res_arr[0]["locality"];f.town=this.res_arr[0]["town"];f.county=this.res_arr[0]["county"];f.postcode=this.res_arr[0]["postcode"];f.udprn=this.res_arr[0]["udprn"];for(var c=1;c<this.res_arr_idx;c++){if(this.res_arr[c]["org"]!=f.org){f.org=""}if(this.res_arr[c]["housename2"]!=f.housename2){f.housename2=""}if(this.res_arr[c]["housename1"]!=f.housename1){f.housename1=""}if(this.res_arr[c]["pobox"]!=f.pobox){f.pobox=""}if(this.res_arr[c]["housenumber"]!=f.housenumber){f.housenumber=""}if(this.res_arr[c]["street1"]!=f.street1){f.street1=""}if(this.res_arr[c]["street2"]!=f.street2){f.street2=""}if(this.res_arr[c]["locality_dep"]!=f.locality_dep){f.locality_dep=""}if(this.res_arr[c]["locality"]!=f.locality){f.locality=""}if(this.res_arr[c]["town"]!=f.town){f.town=""}if(this.res_arr[c]["county"]!=f.county){f.county=""}if(this.res_arr[c]["postcode"]!=f.postcode){f.postcode=""}if(this.res_arr[c]["udprn"]!=f.udprn){f.udprn=""}}this.populate_form_fields(f)}};this.get_elem=function(a){var d="";var c=null;if(""!=this.config.elements){var b=this.config.elements.split(",");d=b[a]}else{switch(a){case 0:d=this.config.elem_company;break;case 1:d=this.config.elem_street1;break;case 2:d=this.config.elem_street2;break;case 3:d=this.config.elem_street3;break;case 4:d=this.config.elem_town;break;case 5:d=this.config.elem_county;break;case 6:default:d=this.config.elem_postcode;break;case 7:d=this.config.elem_house_num;break;case 8:d=this.config.elem_search_house;break;case 9:d=this.config.elem_search_street;break;case 10:d=this.config.elem_search_town;break;case 11:d=this.config.elem_udprn;break}}if(""!=d){if(""!=this.config.form){c=document.forms[this.config.form].elements[d]}else{if(document.getElementById){c=document.getElementById(d)}}}return(c)};this.doHouseSearch=function(){var a=this.get_elem(8);if(a&&0<a.value.length){this.house_search=1}this.doLookup()};this.doLookup=function(){this.xmlhttp=null;var a=this.get_elem(6);var b=null;if(a){this.show_busy();this.lookup_timeout=setTimeout("_cp_instances["+this.obj_idx+"].lookup_timeout_err()",this.config.lookup_timeout);b=this.validate_pc(a.value)}if(null!=b){this.direct_xml_fetch(0,b)}else{this.disp_err("0002","invalid postcode format")}};this.flexiSearch=function(){this.xmlhttp=null;var a="";if(this.get_elem(8)&&""!=this.get_elem(8).value){a+="&search_house="+this.get_elem(8).value}if(this.get_elem(9)&&""!=this.get_elem(9).value){a+="&search_street="+this.get_elem(9).value}if(this.get_elem(10)&&""!=this.get_elem(10).value){a+="&search_town="+this.get_elem(10).value}if(""!=a){this.show_busy();this.lookup_timeout=setTimeout("_cp_instances["+this.obj_idx+"].lookup_timeout_err()",this.config.lookup_timeout);this.direct_xml_fetch(1,a)}else{this.disp_err("0003","search string too short")}};this.validate_pc=function(c){var b="";do{b=c;c=c.replace(/[^A-Za-z0-9]/,"")}while(b!=c);b=c.toUpperCase();if(7>=b.length&&5<=b.length){var d=b.substring(b.length-3,b.length);var a=b.substring(0,b.length-3);if(true==/[CIKMOV]/.test(d)){return null}if("0"<=d.charAt(0)&&"9">=d.charAt(0)&&"A"<=d.charAt(1)&&"Z">=d.charAt(1)&&"A"<=d.charAt(2)&&"Z">=d.charAt(2)){switch(a.length){case 2:if("A"<=a.charAt(0)&&"Z">=a.charAt(0)&&"0"<=a.charAt(1)&&"9">=a.charAt(1)){return(b)}break;case 3:if("A"<=a.charAt(0)&&"Z">=a.charAt(0)){if("0"<=a.charAt(1)&&"9">=a.charAt(1)&&"0"<=a.charAt(2)&&"9">=a.charAt(2)){return(b)}else{if("A"<=a.charAt(1)&&"Z">=a.charAt(1)&&"0"<=a.charAt(2)&&"9">=a.charAt(2)){return(b)}else{if("0"<=a.charAt(1)&&"9">=a.charAt(1)&&"A"<=a.charAt(2)&&"Z">=a.charAt(2)){return(b)}}}}break;case 4:if("A"<=a.charAt(0)&&"Z">=a.charAt(0)&&"A"<=a.charAt(1)&&"Z">=a.charAt(1)&&"0"<=a.charAt(2)&&"9">=a.charAt(2)){if("0"<=a.charAt(3)&&"9">=a.charAt(3)){return(b)}else{if("A"<=a.charAt(3)&&"Z">=a.charAt(3)){return(b)}}}break;default:break}}}return null};this.direct_xml_fetch=function(d,a){try{var e=document.getElementById(this.config.result_elem_id);var b="";if("https:"==document.location.protocol){b="https://"}else{b="http://"}if(0==d){b+=this.config.lookup_url;if(this.config.basic_address){b+="basicaddress"}else{b+="rapidaddress"}b+="?postcode="+a+"&callback=_cp_instances["+this.obj_idx+"].handle_js_response&callback_id=0"}else{if(this.config.basic_address){this.disp_err("1207","BasicAddress can't be used for Flexi Search!");return}else{b+=this.config.lookup_url+"flexiaddress?callback=_cp_instances["+this.obj_idx+"].handle_js_response&callback_id=1";b+="&max_results="+this.config.max_results;b+=a}}if(""!=this.config.access_token){b+="&key="+this.config.access_token}var c=document.createElement("script");c.src=encodeURI(b);c.type="text/javascript";e.appendChild(c)}catch(f){this.disp_err("1206",f)}};this.handle_js_response=function(c,d,e){if(!d){var f=e.error_code;var a=e.error_msg;this.disp_err(f,a)}else{this.res_arr=[];this.res_arr_idx=0;if(0==c){this.flexi_search=0;if(this.house_search){e=this.filter_data_by_house_name(e);if(null==e){this.disp_err_msg(this.config.err_msg5);return}}this.add_to_res_array(e)}else{this.flexi_search=1;this.res_arr.total_postcode_count=e.total_postcode_count;this.res_arr.total_thoroughfare_count=e.total_thoroughfare_count;this.res_arr.total_delivery_point_count=e.total_delivery_point_count;for(var i=1;i<=e.total_postcode_count;i++){this.add_to_res_array(e[i])}}if(this.res_arr_idx){var b=false;if(1==this.res_arr_idx&&this.config.single_res_autoselect){var g=null;if(""!=this.config.single_res_notice){g=document.createTextNode(this.config.single_res_notice)}this.update_res(g);this.populate_form_fields(this.res_arr[0]);b=true}else{this.disp_res_arr();document.getElementById("crafty_postcode_lookup_result_option"+this.obj_idx).focus()}if(0==c&&""!=e.postcode){var h=this.get_elem(6);h.value=e.postcode}if(this.config.on_result_ready){this.config.on_result_ready()}if(b&&this.config.on_result_selected){this.config.on_result_selected(0)}}else{this.disp_err("1205","no result to display")}}};this.add_to_res_array=function(f){for(var d=1;d<=f.thoroughfare_count;d++){var e=f[d]["thoroughfare_name"];if(""!=f[d]["thoroughfare_descriptor"]){e+=" "+f[d]["thoroughfare_descriptor"]}e=this.leading_caps(e,this.config.addr_uppercase);var c=f[d]["dependent_thoroughfare_name"];if(""!=f[d]["dependent_thoroughfare_descriptor"]){c+=" "+f[d]["dependent_thoroughfare_descriptor"]}c=this.leading_caps(c,this.config.addr_uppercase);if("delivery_point_count" in f[d]&&0<f[d]["delivery_point_count"]){for(var a=1;a<=f[d]["delivery_point_count"];a++){var g=this.new_res_line();g.street1=e;g.street2=c;var b=f[d][a];if("match_quality" in b){g.match_quality=b.match_quality}else{g.match_quality=1}g.housenumber=b.building_number;g.housename2=this.leading_caps(b.sub_building_name,this.config.addr_uppercase);g.housename1=this.leading_caps(b.building_name,this.config.addr_uppercase);g.org=b.department_name;if(""!=g.org&&""!=b.organisation_name){g.org+=this.config.delimiter}g.org=this.leading_caps(g.org+b.organisation_name,this.config.org_uppercase);g.pobox=this.leading_caps(b.po_box_number,this.config.addr_uppercase);g.postcode=f.postcode;g.town=this.leading_caps(f.town,this.config.town_uppercase);g.locality=this.leading_caps(f.dependent_locality,this.config.addr_uppercase);g.locality_dep=this.leading_caps(f.double_dependent_locality,this.config.addr_uppercase);if(this.config.traditional_county){g.county=this.leading_caps(f.traditional_county,this.config.county_uppercase)}else{g.county=this.leading_caps(f.postal_county,this.config.county_uppercase)}g.udprn=b.udprn;this.res_arr[this.res_arr_idx]=g;this.res_arr_idx++}}else{var g=this.new_res_line();g.street1=e;g.street2=c;g.postcode=f.postcode;g.town=this.leading_caps(f.town,this.config.town_uppercase);g.locality=this.leading_caps(f.dependent_locality,this.config.addr_uppercase);g.locality_dep=this.leading_caps(f.double_dependent_locality,this.config.addr_uppercase);if(this.config.traditional_county){g.county=this.leading_caps(f.traditional_county,this.config.county_uppercase)}else{g.county=this.leading_caps(f.postal_county,this.config.county_uppercase)}g.match_quality=2;this.res_arr[this.res_arr_idx]=g;this.res_arr_idx++}}};this.filter_data_by_house_name=function(f){var g=this.get_elem(8);if(!g||!g.value.length){return f}var j=g.value.toUpperCase();var k=-1;if(parseInt(j)==j){k=parseInt(j)}var l=" "+j;var e=[];var i=1;var b=0;for(var c=1;c<=f.thoroughfare_count;c++){e[i]=[];b=0;for(var d=1;d<=f[c]["delivery_point_count"];d++){var h=f[c][d];var a=" "+h.sub_building_name+" "+h.building_name+" ";if(-1!=a.indexOf(l)||k==parseInt(h.building_number)){b++;e[i][b]=[];e[i][b]["building_number"]=h.building_number;e[i][b]["sub_building_name"]=h.sub_building_name;e[i][b]["building_name"]=h.building_name;e[i][b]["department_name"]=h.department_name;e[i][b]["organisation_name"]=h.organisation_name;e[i][b]["po_box_number"]=h.po_box_number;e[i][b]["udprn"]=h.udprn}}if(b){e[i]["delivery_point_count"]=b;e[i]["thoroughfare_name"]=f[c]["thoroughfare_name"];e[i]["thoroughfare_descriptor"]=f[c]["thoroughfare_descriptor"];e[i]["dependent_thoroughfare_name"]=f[c]["dependent_thoroughfare_name"];e[i]["dependent_thoroughfare_descriptor"]=f[c]["dependent_thoroughfare_descriptor"];i++}}if(1<i){e.thoroughfare_count=i-1;e.town=f.town;e.dependent_locality=f.dependent_locality;e.double_dependent_locality=f.double_dependent_locality;e.traditional_county=f.traditional_county;e.postal_county=f.postal_county;e.postcode=f.postcode;return e}return null};this.lookup_timeout_err=function(){this.disp_err("9001","Internal Timeout after "+this.config.lookup_timeout+"ms")}};
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>UK_Postcode_Address_Finder</name>
4
- <version>1.7</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>
@@ -17,8 +17,22 @@ Please note:
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 1.7
21
- * added ability to search for address by house name or number - this can further speed up form filling for customers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  v 1.6.2
24
  * fix for Internet Explorer in admin panel -&gt; new customer page; the add address button didn't always work
@@ -74,9 +88,9 @@ v 1.1.0
74
 
75
  v 1.0.0 - Initial Release</notes>
76
  <authors><author><name>Adam Stylo</name><user>auto-converted</user><email>adam@craftyclicks.co.uk</email></author></authors>
77
- <date>2010-02-26</date>
78
- <time>15:16:25</time>
79
- <contents><target name="mage"><dir name="app"><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="5b6f8624b0536c43bd5ee1d4a0cf3144"/></dir></dir><dir name="sales"><dir name="order"><dir name="create"><dir name="form"><file name="address.phtml" hash="39c36f20d55f8d71a26a9b9b83306a58"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="craftyclicks.xml" hash="92171a888dea8fd634e1939a1ffd86dc"/></dir><dir name="template"><dir name="dnc"><dir name="craftyclicks"><file name="address_form.phtml" hash="fcb3cc2696ac5b98c9ba7a2e87d908ae"/><file name="checkout_onepage.phtml" hash="a083c7d757e759520543e1d13e86191c"/><file name="crafty_template_helper.php" hash="bde402e4eba6e2df0cb0ef74beec7b6f"/><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="fe63fb43ce2f5cbf465d0672f49fd91e"/><file name="shipping.phtml" hash="a2a3307e26508a3015e5643a456f9e33"/></dir></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="8f674dfead75c7264479f1700ab86a07"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Dnc_Craftyclicks.xml" hash="48e9db6214d39f822c474f3c6cc8f9a9"/></dir></dir></dir></target><target name="magelocal"><dir name="Dnc"><dir name="Craftyclicks"><dir name="etc"><file name="config.xml" hash="36d7c8176820d12944884f48966d9d51"/><file name="system.xml" hash="b4248948c14641a55a7c51f4dd37be2a"/></dir><dir name="Helper"><file name="Data.php" hash="10c8592d3f990953767d6c96c2d0d5f4"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="craftyclicks"><file name="button_find_address.gif" hash="0fdef9bf7ad0f7ec3f6530b7ff40bf59"/><file name="crafty_postcode_busy.gif" hash="618a14f4dca4f51100cd2400e7f9049c"/></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="crafty"><file name="crafty_postcode.js" hash="f07aa2204345071074ca10568341b4cf"/></dir></dir></target></contents>
80
  <compatible/>
81
  <dependencies/>
82
  </package>
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>
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
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>
skin/frontend/{default/default → base/default/images}/craftyclicks/button_find_address.gif RENAMED
File without changes
skin/frontend/{default/default → base/default/images}/craftyclicks/crafty_postcode_busy.gif RENAMED
File without changes