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 @@