Lexel_UkAddressFinder - Version 0.2.0

Version Notes

Remove unnecessary dependencies from the extension.

Download this release

Release Info

Developer Lexel Software
Extension Lexel_UkAddressFinder
Version 0.2.0
Comparing to
See all releases


Version 0.2.0

app/code/community/Lexel/UkAddressFinder/Helper/Data.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the Open Software License (OSL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://opensource.org/licenses/osl-3.0.php
9
+ *
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to helpdesk@lexel.co.uk so we can send you a copy immediately.
13
+ *
14
+ * @category Lexel
15
+ * @package Lexel_UkAddressFinder
16
+ * @copyright Copyright (c) 2013 Lexel Software Ltd (http://www.lexel.co.uk)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Lexel_UkAddressFinder_Helper_Data extends Mage_Core_Helper_Abstract {}
app/code/community/Lexel/UkAddressFinder/controllers/IndexController.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * NOTICE OF LICENSE
4
+ *
5
+ * This source file is subject to the Open Software License (OSL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://opensource.org/licenses/osl-3.0.php
9
+ *
10
+ * If you did not receive a copy of the license and are unable to
11
+ * obtain it through the world-wide-web, please send an email
12
+ * to helpdesk@lexel.co.uk so we can send you a copy immediately.
13
+ *
14
+ * @category Lexel
15
+ * @package Lexel_UkAddressFinder
16
+ * @copyright Copyright (c) 2013 Lexel Software Ltd (http://www.lexel.co.uk)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
+ */
19
+
20
+ class Lexel_UkAddressFinder_IndexController extends Mage_Core_Controller_Front_Action
21
+ {
22
+ public function billingaddresslistfinderAction()
23
+ {
24
+ $postCode = $this->getRequest()->getPost('postcode');
25
+ $userName = Mage::getStoreConfig('addressfinder/general/username'); // get username from backend system configuration
26
+ $password = Mage::getStoreConfig('addressfinder/general/password'); // get password from backend system configuration
27
+ $licenseKey = Mage::getStoreConfig('addressfinder/general/license_key'); // get license key from backend system configuration
28
+
29
+ /* call to lexel PAF API via curl */
30
+
31
+ $url = "http://services.lexel.co.uk/paf/";
32
+
33
+ $queryString = "?Username=".$userName."&Password=".$password."&LicenceKey=".$licenseKey."&LookupType=ByPostcodeList&ID=".urlencode($postCode);
34
+ $response = file_get_contents($url.$queryString);
35
+ $dom = new DOMDocument('1.0', 'iso-8859-1');
36
+ $dom->loadXML($response);
37
+ $infoNode = $dom->getElementsByTagName('Information')->item(0);
38
+
39
+ $errorNode = $infoNode->getElementsByTagName('Error')->item(0);
40
+ if ($errorNode->getElementsByTagName('ErrorNo')->item(0)->nodeValue != '0') {
41
+ $message = $errorNode->getElementsByTagName('ErrorMsg')->item(0)->nodeValue;
42
+ echo "<div>We apologize, we cannot find this address in our database, please check that your postcode is correct</div>";
43
+ }
44
+ echo "<select id='addressLookUp' onchange='billingExactAddressFinder(this.value);'>";
45
+ echo "<option>----- please select your address ----</option>";
46
+ $addressParentNode = $infoNode->childNodes->item(1);
47
+ foreach ($addressParentNode->childNodes as $addressNode)
48
+ {
49
+ echo "<option value=".$addressNode->getAttribute('AddressID').">".$addressNode->getAttribute('Description')."</option>";
50
+ }
51
+ echo "</select>";
52
+ }
53
+
54
+ public function billingexactaddressfinderAction()
55
+ {
56
+ $addressId = $this->getRequest()->getPost('addressid');
57
+ $userName = Mage::getStoreConfig('addressfinder/general/username'); // get username from backend system configuration
58
+ $password = Mage::getStoreConfig('addressfinder/general/password'); // get password from backend system configuration
59
+ $licenseKey = Mage::getStoreConfig('addressfinder/general/license_key'); // get license key from backend system configuration
60
+
61
+ /* call to lexel PAF API via curl */
62
+
63
+
64
+ $url = "http://services.lexel.co.uk/paf/";
65
+
66
+ $queryString = "?Username=".$userName."&Password=".$password."&LicenceKey=".$licenseKey."&LookupType=ByAddressID&ID=".urlencode($addressId);
67
+ print $url . $queryString;
68
+ $response = file_get_contents($url.$queryString);
69
+ //$xml_object = simplexml_load_file($response);
70
+ #print_r(htmlspecialchars($response));
71
+ $dom = new DOMDocument('1.0', 'iso-8859-1');
72
+ $dom->loadXML($response);
73
+ $infoNode = $dom->getElementsByTagName('Information')->item(0);
74
+
75
+ $errorNode = $infoNode->getElementsByTagName('Error')->item(0);
76
+ if ($errorNode->getElementsByTagName('ErrorNo')->item(0)->nodeValue != '0') {
77
+ $message = $errorNode->getElementsByTagName('ErrorMsg')->item(0)->nodeValue;
78
+ echo "<div>We apologize, we cannot find this address in our database, please check that your postcode is correct</div>";
79
+ }
80
+
81
+ $addressParentNode = $infoNode->getElementsByTagName('Address')->item(0);
82
+
83
+ $OrganisationName = $addressParentNode->getElementsByTagName('OrganisationName')->item(0)->nodeValue;
84
+ $AddressLine1 = $addressParentNode->getElementsByTagName('AddressLine1')->item(0)->nodeValue;
85
+ $AddressLine2 = $addressParentNode->getElementsByTagName('AddressLine2')->item(0)->nodeValue;
86
+ $County = $addressParentNode->getElementsByTagName('County')->item(0)->nodeValue;
87
+ $PostTown = $addressParentNode->getElementsByTagName('PostTown')->item(0)->nodeValue;
88
+ $PostCode = $addressParentNode->getElementsByTagName('PostCode')->item(0)->nodeValue;
89
+ $totalString = '~'.$OrganisationName.'~'.$AddressLine1.'~'.$AddressLine2.'~'.$County.'~'.$PostTown.'~'.$PostCode;
90
+ echo $totalString;
91
+ }
92
+
93
+ public function shippingaddresslistfinderAction()
94
+ {
95
+ $postCode = $this->getRequest()->getPost('postcode');
96
+ $userName = Mage::getStoreConfig('addressfinder/general/username'); // get username from backend system configuration
97
+ $password = Mage::getStoreConfig('addressfinder/general/password'); // get password from backend system configuration
98
+ $licenseKey = Mage::getStoreConfig('addressfinder/general/license_key'); // get license key from backend system configuration
99
+
100
+ /* call to lexel PAF API via curl */
101
+
102
+ $url = "http://services.lexel.co.uk/paf/";
103
+
104
+ $queryString = "?Username=".$userName."&Password=".$password."&LicenceKey=".$licenseKey."&LookupType=ByPostcodeList&ID=".urlencode($postCode);
105
+ $response = file_get_contents($url.$queryString);
106
+ $dom = new DOMDocument('1.0', 'iso-8859-1');
107
+ $dom->loadXML($response);
108
+ $infoNode = $dom->getElementsByTagName('Information')->item(0);
109
+
110
+ $errorNode = $infoNode->getElementsByTagName('Error')->item(0);
111
+ if ($errorNode->getElementsByTagName('ErrorNo')->item(0)->nodeValue != '0') {
112
+ $message = $errorNode->getElementsByTagName('ErrorMsg')->item(0)->nodeValue;
113
+ echo "<div>We apologize, we cannot find this address in our database, please check that your postcode is correct</div>";
114
+ }
115
+ echo "<select id='addressLookUp' onchange='shippingExactAddressFinder(this.value);'>";
116
+ echo "<option>----- please select your address ----</option>";
117
+ $addressParentNode = $infoNode->childNodes->item(1);
118
+ foreach ($addressParentNode->childNodes as $addressNode)
119
+ {
120
+ echo "<option value=".$addressNode->getAttribute('AddressID').">".$addressNode->getAttribute('Description')."</option>";
121
+ }
122
+ echo "</select>";
123
+ }
124
+
125
+ public function shippingexactaddressfinderAction()
126
+ {
127
+ $addressId = $this->getRequest()->getPost('addressid');
128
+ $userName = Mage::getStoreConfig('addressfinder/general/username'); // get username from backend system configuration
129
+ $password = Mage::getStoreConfig('addressfinder/general/password'); // get password from backend system configuration
130
+ $licenseKey = Mage::getStoreConfig('addressfinder/general/license_key'); // get license key from backend system configuration
131
+
132
+ /* call to lexel PAF API via curl */
133
+
134
+
135
+ $url = "http://services.lexel.co.uk/paf/";
136
+
137
+ $queryString = "?Username=".$userName."&Password=".$password."&LicenceKey=".$licenseKey."&LookupType=ByAddressID&ID=".urlencode($addressId);
138
+ print $url . $queryString;
139
+ $response = file_get_contents($url.$queryString);
140
+ //$xml_object = simplexml_load_file($response);
141
+ #print_r(htmlspecialchars($response));
142
+ $dom = new DOMDocument('1.0', 'iso-8859-1');
143
+ $dom->loadXML($response);
144
+ $infoNode = $dom->getElementsByTagName('Information')->item(0);
145
+
146
+ $errorNode = $infoNode->getElementsByTagName('Error')->item(0);
147
+ if ($errorNode->getElementsByTagName('ErrorNo')->item(0)->nodeValue != '0') {
148
+ $message = $errorNode->getElementsByTagName('ErrorMsg')->item(0)->nodeValue;
149
+ echo "<div>We apologize, we cannot find this address in our database, please check that your postcode is correct</div>";
150
+ }
151
+
152
+ $addressParentNode = $infoNode->getElementsByTagName('Address')->item(0);
153
+
154
+ $OrganisationName = $addressParentNode->getElementsByTagName('OrganisationName')->item(0)->nodeValue;
155
+ $AddressLine1 = $addressParentNode->getElementsByTagName('AddressLine1')->item(0)->nodeValue;
156
+ $AddressLine2 = $addressParentNode->getElementsByTagName('AddressLine2')->item(0)->nodeValue;
157
+ $County = $addressParentNode->getElementsByTagName('County')->item(0)->nodeValue;
158
+ $PostTown = $addressParentNode->getElementsByTagName('PostTown')->item(0)->nodeValue;
159
+ $PostCode = $addressParentNode->getElementsByTagName('PostCode')->item(0)->nodeValue;
160
+ $totalString = '~'.$OrganisationName.'~'.$AddressLine1.'~'.$AddressLine2.'~'.$County.'~'.$PostTown.'~'.$PostCode;
161
+ echo $totalString;
162
+ }
163
+ }
app/code/community/Lexel/UkAddressFinder/etc/config.xml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
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 helpdesk@lexel.co.uk so we can send you a copy immediately.
14
+ *
15
+ * @category Lexel
16
+ * @package Lexel_UkAddressFinder
17
+ * @copyright Copyright (c) 2013 Lexel Software Ltd (http://www.lexel.co.uk)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ -->
21
+ <config>
22
+ <modules>
23
+ <Lexel_UkAddressFinder>
24
+ <version>0.2.0</version>
25
+ </Lexel_UkAddressFinder>
26
+ </modules>
27
+
28
+ <global>
29
+ <helpers>
30
+ <addressfinder>
31
+ <class>Lexel_UkAddressFinder_Helper</class>
32
+ </addressfinder>
33
+ </helpers>
34
+ </global>
35
+
36
+ <frontend>
37
+ <routers>
38
+ <addressfinder>
39
+ <use>standard</use>
40
+ <args>
41
+ <module>Lexel_UkAddressFinder</module>
42
+ <frontName>addressfinder</frontName>
43
+ </args>
44
+ </addressfinder>
45
+ </routers>
46
+ <layout>
47
+ <updates>
48
+ <addressfinder>
49
+ <file>addressfinder.xml</file>
50
+ </addressfinder>
51
+ </updates>
52
+ </layout>
53
+ </frontend>
54
+
55
+ <admin>
56
+ <routers>
57
+ <addressfinder>
58
+ <use>admin</use>
59
+ <args>
60
+ <module>Lexel_UkAddressFinder</module>
61
+ <frontName>addressfinder</frontName>
62
+ </args>
63
+ </addressfinder>
64
+ </routers>
65
+ </admin>
66
+
67
+ <adminhtml>
68
+ <acl>
69
+ <resources>
70
+ <all>
71
+ <title>Allow Everything</title>
72
+ </all>
73
+ <admin>
74
+ <children>
75
+ <Lexel_UkAddressFinder>
76
+ <title>UkAddressFinder Module</title>
77
+ <sort_order>10</sort_order>
78
+ </Lexel_UkAddressFinder>
79
+ <system>
80
+ <children>
81
+ <config>
82
+ <children>
83
+ <addressfinder translate="title" module="addressfinder">
84
+ <title>UkAddressFinder Section</title>
85
+ </addressfinder>
86
+ </children>
87
+ </config>
88
+ </children>
89
+ </system>
90
+ </children>
91
+ </admin>
92
+ </resources>
93
+ </acl>
94
+ </adminhtml>
95
+ </config>
app/code/community/Lexel/UkAddressFinder/etc/system.xml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * NOTICE OF LICENSE
5
+ *
6
+ * This source file is subject to the Open Software License (OSL 3.0)
7
+ * that is bundled with this package in the file LICENSE.txt.
8
+ * It is also available through the world-wide-web at this URL:
9
+ * http://opensource.org/licenses/osl-3.0.php
10
+ *
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 helpdesk@lexel.co.uk so we can send you a copy immediately.
14
+ *
15
+ * @category Lexel
16
+ * @package Lexel_UkAddressFinder
17
+ * @copyright Copyright (c) 2013 Lexel Software Ltd (http://www.lexel.co.uk)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+ -->
21
+ <config>
22
+ <sections>
23
+ <addressfinder translate="label" module="addressfinder">
24
+ <label>Lexel Address Finder</label>
25
+ <tab>sales</tab>
26
+ <frontend_type>text</frontend_type>
27
+ <sort_order>306</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ <groups>
32
+ <license translate="label">
33
+ <label>License Key</label>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>100</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <comment>
40
+ <![CDATA[
41
+ <div style="padding:10px; background-color:#fff; border:1px solid #ddd; margin-bottom:7px;">
42
+ <p>Please go to <a href="http://www.lexelpaf.co.uk/" target="_blank">www.lexelpaf.co.uk</a> and register to use the Lexel Address Service. Once you have registered you will be given a username, password and license key which you must enter below.</p>
43
+ <p>If you require any assistance please email <a href="mailto:helpdesk@lexel.co.uk">helpdesk@lexel.co.uk</a>.</p>
44
+ </div>
45
+ ]]>
46
+ </comment>
47
+
48
+ <fields>
49
+ <username translate="label">
50
+ <label>Username</label>
51
+ <frontend_type>text</frontend_type>
52
+ <sort_order>1</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </username>
57
+ <password translate="label">
58
+ <label>Password</label>
59
+ <frontend_type>password</frontend_type>
60
+ <sort_order>2</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </password>
65
+ <license_key translate="label">
66
+ <label>License Key</label>
67
+ <frontend_type>text</frontend_type>
68
+ <sort_order>3</sort_order>
69
+ <show_in_default>1</show_in_default>
70
+ <show_in_website>1</show_in_website>
71
+ <show_in_store>1</show_in_store>
72
+ </license_key>
73
+ </fields>
74
+ </license>
75
+ </groups>
76
+ </addressfinder>
77
+ </sections>
78
+ </config>
app/design/frontend/base/default/layout/addressfinder.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.2.0">
3
+ <checkout_onepage_index>
4
+ <reference name="content">
5
+ <reference name="checkout.onepage">
6
+ <block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="addressfinder/billing.phtml"/>
7
+ <block type="checkout/onepage_shipping" name="checkout.onepage.shipping" as="shipping" template="addressfinder/shipping.phtml"/>
8
+ </reference>
9
+ </reference>
10
+ </checkout_onepage_index>
11
+ </layout>
app/design/frontend/base/default/template/addressfinder/billing.phtml ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form id="co-billing-form" action="">
28
+ <fieldset>
29
+ <ul class="form-list">
30
+ <li>
31
+ <div style="display:inline; width:100%;" id="billing-findAddress" class="field">
32
+ <input type="text" title="Enter Your Post Code" class="input-text postcode-finder required-entry" name="billing-addressFinder" onfocus="javascript:if(this.value == 'Enter Your Post Code'){ this.value= ''; }" onblur="javascript:if(this.value == ''){ this.value= 'Enter Your Post Code'; }" value="Enter Your Post Code" id="billing-addressFinder">
33
+ &nbsp;
34
+ <button class="button" title="Find Address" onclick="billingAddressListFinder($('billing-addressFinder').value);" type="button"><span><span>Find Address</span></span></button>
35
+ </div>
36
+ </li>
37
+ <li id="billingAddressList"></li>
38
+ <?php if ($this->customerHasAddresses()): ?>
39
+ <li class="wide">
40
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
41
+ <div class="input-box">
42
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
43
+ </div>
44
+ </li>
45
+ <?php endif; ?>
46
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
47
+ <fieldset>
48
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
49
+ <ul>
50
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
51
+ <li class="fields">
52
+ <div class="field">
53
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
54
+ <div class="input-box">
55
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
56
+ </div>
57
+ </div>
58
+ <?php if(!$this->isCustomerLoggedIn()): ?>
59
+ <div class="field">
60
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
61
+ <div class="input-box">
62
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
63
+ </div>
64
+ </div>
65
+ <?php endif; ?>
66
+ </li>
67
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
68
+ <li class="wide">
69
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
70
+ <div class="input-box">
71
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
72
+ </div>
73
+ </li>
74
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
75
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
76
+ <li class="wide">
77
+ <div class="input-box">
78
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" />
79
+ </div>
80
+ </li>
81
+ <?php endfor; ?>
82
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
83
+ <li class="wide">
84
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
85
+ <div class="input-box">
86
+ <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
87
+ </div>
88
+ </li>
89
+ <?php endif; ?>
90
+ <li class="fields">
91
+ <div class="field">
92
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
93
+ <div class="input-box">
94
+ <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" />
95
+ </div>
96
+ </div>
97
+ <div class="field">
98
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
99
+ <div class="input-box">
100
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
101
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
102
+ </select>
103
+ <script type="text/javascript">
104
+ //<![CDATA[
105
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
106
+ //]]>
107
+ </script>
108
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
109
+ </div>
110
+ </div>
111
+ </li>
112
+ <li class="fields">
113
+ <div class="field">
114
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
115
+ <div class="input-box">
116
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
117
+ </div>
118
+ </div>
119
+ <div class="field">
120
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
121
+ <div class="input-box">
122
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
123
+ </div>
124
+ </div>
125
+ </li>
126
+ <li class="fields">
127
+ <div class="field">
128
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
129
+ <div class="input-box">
130
+ <input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
131
+ </div>
132
+ </div>
133
+ <div class="field">
134
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
135
+ <div class="input-box">
136
+ <input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
137
+ </div>
138
+ </div>
139
+ </li>
140
+ <?php if(!$this->isCustomerLoggedIn()): ?>
141
+
142
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
143
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
144
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
145
+ <li class="fields">
146
+ <?php if ($_dob->isEnabled()): ?>
147
+ <div class="field">
148
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
149
+ </div>
150
+ <?php endif; ?>
151
+ <?php if ($_gender->isEnabled()): ?>
152
+ <div class="field">
153
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
154
+ </div>
155
+ <?php endif ?>
156
+ </li>
157
+ <?php endif ?>
158
+
159
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
160
+ <?php if ($_taxvat->isEnabled()): ?>
161
+ <li>
162
+ <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
163
+ </li>
164
+ <?php endif ?>
165
+
166
+ <li class="fields" id="register-customer-password">
167
+ <div class="field">
168
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
169
+ <div class="input-box">
170
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
171
+ </div>
172
+ </div>
173
+ <div class="field">
174
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
175
+ <div class="input-box">
176
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
177
+ </div>
178
+ </div>
179
+ </li>
180
+ <?php endif; ?>
181
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
182
+ <li class="control">
183
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
184
+ </li>
185
+ <?php else:?>
186
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
187
+ <?php endif; ?>
188
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
189
+ </ul>
190
+ </fieldset>
191
+ </li>
192
+ <?php /* Extensions placeholder */ ?>
193
+ <?php echo $this->getChildHtml('checkout.onepage.billing.extra')?>
194
+ <?php if ($this->canShip()): ?>
195
+ <li class="control">
196
+ <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>
197
+ <li class="control">
198
+ <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>
199
+ </li>
200
+ <?php endif; ?>
201
+ </ul>
202
+ <?php if (!$this->canShip()): ?>
203
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
204
+ <?php endif; ?>
205
+ <div class="buttons-set" id="billing-buttons-container">
206
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
207
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
208
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
209
+ <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...') ?>
210
+ </span>
211
+ </div>
212
+ </fieldset>
213
+ </form>
214
+ <script type="text/javascript">
215
+ //<![CDATA[
216
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
217
+ var billingForm = new VarienForm('co-billing-form');
218
+
219
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
220
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
221
+
222
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
223
+ //]]>
224
+ </script>
225
+
226
+ <script type="text/javascript">
227
+ //<![CDATA[
228
+ function billingAddressListFinder (code) {
229
+ new Ajax.Request(
230
+ '<?php echo $this->getUrl('addressfinder/index/billingaddresslistfinder')?>',
231
+ {
232
+ method:'post',
233
+ parameters: {postcode:code},
234
+ onSuccess: function (transport) {
235
+ var response = transport.responseText || "no response text";
236
+ $('billingAddressList').innerHTML = response;
237
+ },
238
+ onFailure: function() {
239
+ alert('Something went wrong...')
240
+ }
241
+ }
242
+ );
243
+
244
+ }
245
+
246
+ function billingExactAddressFinder (id) {
247
+ new Ajax.Request(
248
+ '<?php echo $this->getUrl('addressfinder/index/billingexactaddressfinder')?>',
249
+ {
250
+ method:'post',
251
+ parameters: {addressid:id},
252
+ onSuccess: function (transport) {
253
+ var response = transport.responseText || "no response text";
254
+ var fullAddress = response.split('~');
255
+ $('billing:company').value = fullAddress[1];
256
+ $('billing:street1').value = fullAddress[2];
257
+ $('billing:street2').value = fullAddress[3];
258
+ $('billing:region').value = fullAddress[4];
259
+ $('billing:city').value = fullAddress[5];
260
+ $('billing:postcode').value = fullAddress[6];
261
+ },
262
+ onFailure: function() {
263
+ alert('Something went wrong...')
264
+ }
265
+ }
266
+ );
267
+ }
268
+ //]]>
269
+ </script>
app/design/frontend/base/default/template/addressfinder/shipping.phtml ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <form action="" id="co-shipping-form">
28
+ <ul class="form-list">
29
+ <li>
30
+ <div style="display:inline; width:100%;" id="shipping-findAddress" class="field">
31
+ <input type="text" title="Enter Your Post Code" class="input-text postcode-finder required-entry" name="shipping-addressFinder" onfocus="javascript:if(this.value == 'Enter Your Post Code'){ this.value= ''; }" onblur="javascript:if(this.value == ''){ this.value= 'Enter Your Post Code'; }" value="Enter Your Post Code" id="shipping-addressFinder">
32
+ &nbsp;
33
+ <button class="button" title="Find Address" onclick="shippingAddressListFinder($('shipping-addressFinder').value);" type="button"><span><span>Find Address</span></span></button>
34
+ </div>
35
+ </li>
36
+ <li id="shippingAddressList"></li>
37
+ <?php if ($this->customerHasAddresses()): ?>
38
+ <li class="wide">
39
+ <label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
40
+ <div class="input-box">
41
+ <?php echo $this->getAddressesHtmlSelect('shipping') ?>
42
+ </div>
43
+ </li>
44
+ <?php endif ?>
45
+ <li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
46
+ <fieldset>
47
+ <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
48
+ <ul>
49
+ <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>
50
+ <li class="fields">
51
+ <div class="fields">
52
+ <label for="shipping:company"><?php echo $this->__('Company') ?></label>
53
+ <div class="input-box">
54
+ <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
55
+ </div>
56
+ </div>
57
+ </li>
58
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
59
+ <li class="wide">
60
+ <label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
61
+ <div class="input-box">
62
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
63
+ </div>
64
+ </li>
65
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
66
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
67
+ <li class="wide">
68
+ <div class="input-box">
69
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" />
70
+ </div>
71
+ </li>
72
+ <?php endfor; ?>
73
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
74
+ <li class="wide">
75
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
76
+ <div class="input-box">
77
+ <input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
78
+ </div>
79
+ </li>
80
+ <?php endif; ?>
81
+ <li class="fields">
82
+ <div class="field">
83
+ <label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
84
+ <div class="input-box">
85
+ <input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
86
+ </div>
87
+ </div>
88
+ <div class="field">
89
+ <label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
90
+ <div class="input-box">
91
+ <select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
92
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
93
+ </select>
94
+ <script type="text/javascript">
95
+ //<![CDATA[
96
+ $('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
97
+ //]]>
98
+ </script>
99
+ <input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
100
+ </div>
101
+ </div>
102
+ </li>
103
+ <li class="fields">
104
+ <div class="field">
105
+ <label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
106
+ <div class="input-box">
107
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" />
108
+ </div>
109
+ </div>
110
+ <div class="field">
111
+ <label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
112
+ <div class="input-box">
113
+ <?php echo $this->getCountryHtmlSelect('shipping') ?>
114
+ </div>
115
+ </div>
116
+ </li>
117
+ <li class="fields">
118
+ <div class="field">
119
+ <label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
120
+ <div class="input-box">
121
+ <input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
122
+ </div>
123
+ </div>
124
+ <div class="field">
125
+ <label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
126
+ <div class="input-box">
127
+ <input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
128
+ </div>
129
+ </div>
130
+ </li>
131
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
132
+ <li class="control">
133
+ <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>
134
+ <?php else:?>
135
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
136
+ <?php endif;?>
137
+ </ul>
138
+ </fieldset>
139
+ </li>
140
+ <li class="control">
141
+ <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>
142
+ </li>
143
+ </ul>
144
+ <div class="buttons-set" id="shipping-buttons-container">
145
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
146
+ <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
147
+ <button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
148
+ <span id="shipping-please-wait" class="please-wait" style="display:none;">
149
+ <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...') ?>
150
+ </span>
151
+ </div>
152
+ </form>
153
+ <script type="text/javascript">
154
+ //<![CDATA[
155
+ var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
156
+ '<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
157
+ var shippingForm = new VarienForm('co-shipping-form');
158
+ shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
159
+ //shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
160
+ $('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
161
+
162
+ var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
163
+ //]]>
164
+ </script>
165
+
166
+ <script type="text/javascript">
167
+ //<![CDATA[
168
+ function shippingAddressListFinder (code) {
169
+ new Ajax.Request(
170
+ '<?php echo $this->getUrl('addressfinder/index/shippingaddresslistfinder')?>',
171
+ {
172
+ method:'post',
173
+ parameters: {postcode:code},
174
+ onSuccess: function (transport) {
175
+ var response = transport.responseText || "no response text";
176
+ $('shippingAddressList').innerHTML = response;
177
+ },
178
+ onFailure: function() {
179
+ alert('Something went wrong...')
180
+ }
181
+ }
182
+ );
183
+ }
184
+
185
+ function shippingExactAddressFinder (id) {
186
+ new Ajax.Request(
187
+ '<?php echo $this->getUrl('addressfinder/index/shippingexactaddressfinder')?>',
188
+ {
189
+ method:'post',
190
+ parameters: {addressid:id},
191
+ onSuccess: function (transport) {
192
+ var response = transport.responseText || "no response text";
193
+ var fullAddress = response.split('~');
194
+ $('shipping:company').value = fullAddress[1];
195
+ $('shipping:street1').value = fullAddress[2];
196
+ $('shipping:street2').value = fullAddress[3];
197
+ $('shipping:region').value = fullAddress[4];
198
+ $('shipping:city').value = fullAddress[5];
199
+ $('shipping:postcode').value = fullAddress[6];
200
+ },
201
+ onFailure: function() {
202
+ alert('Something went wrong...')
203
+ }
204
+ }
205
+ );
206
+ }
207
+ //]]>
208
+ </script>
app/etc/modules/Lexel_UkAddressFinder.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Lexel_UkAddressFinder>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Lexel_UkAddressFinder>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Lexel_UkAddressFinder</name>
4
+ <version>0.2.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License v3.0 (OSL-3.0)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>UK Address Finder - Increase conversions and reduce customer keystrokes by up to 80%. </summary>
10
+ <description>&lt;h2&gt;UK Address Finder&lt;/h2&gt;&#xD;
11
+ &#xD;
12
+ &lt;p&gt;Lexel's Postcode Address Finder will allow your customer to just enter a postcode, press "Find Address" and then have a select box with pre-selected address's that match the postcode your customer has entered.&lt;/p&gt;&#xD;
13
+ &#xD;
14
+ &lt;p&gt;This extension increases conversions and reduces customer keystrokes meaning that there's less errors when entering address information.&lt;/p&gt;&#xD;
15
+ &#xD;
16
+ &lt;h3&gt;Features&lt;/h3&gt;&#xD;
17
+ &#xD;
18
+ &lt;ul&gt;&#xD;
19
+ &lt;li&gt;Reduces customer keystrokes by up to 80%&lt;/li&gt;&#xD;
20
+ &lt;li&gt;Reduces incorrect address's saving you time on re-shipping items&lt;/li&gt;&#xD;
21
+ &lt;li&gt;Faster checkout improving conversions&lt;/li&gt;&#xD;
22
+ &lt;li&gt;Flexible licensing - Monthly/Annual Licences available (Please contact us)&lt;/li&gt;&#xD;
23
+ &lt;/ul&gt;&#xD;
24
+ &#xD;
25
+ &lt;h3&gt;Important Information&lt;/h3&gt;&#xD;
26
+ &#xD;
27
+ &lt;p&gt;All you need to do is install the extension and then go to System -&gt; Configuration -&gt; Address Finder and follow the instructions.&lt;/p&gt;&#xD;
28
+ &#xD;
29
+ &lt;p&gt;The extension is free, however credits are not free and these need to be purchased through the Lexel website.&lt;/p&gt;&#xD;
30
+ &#xD;
31
+ &lt;p&gt;Please note we are unable to help with custom theme support.&lt;/p&gt;</description>
32
+ <notes>Remove unnecessary dependencies from the extension.</notes>
33
+ <authors><author><name>Lexel Software</name><user>lexel_uk</user><email>helpdesk@lexel.co.uk</email></author><author><name>Zodiac Media</name><user>zodiac_media</user><email>info@zodiacmedia.co.uk</email></author></authors>
34
+ <date>2013-10-10</date>
35
+ <time>17:34:00</time>
36
+ <contents><target name="magecommunity"><dir name="Lexel"><dir name="UkAddressFinder"><dir name="Helper"><file name="Data.php" hash="0af50634eb3c8f98d33d6a99a7838e35"/></dir><dir name="controllers"><file name="IndexController.php" hash="0dbca807346dae29be659fa14f9ab14c"/></dir><dir name="etc"><file name="config.xml" hash="f827020f3c358ec5264f24c906a76d31"/><file name="system.xml" hash="eaa085b4e0b606955a7e9a2934452261"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="addressfinder.xml" hash="8bd3513d5687823a670ab432274494bc"/></dir><dir name="template"><dir name="addressfinder"><file name="billing.phtml" hash="40c71cf08b16f61194a643aee7c82b41"/><file name="shipping.phtml" hash="71f27c04e9440c75a05a2ec58097f484"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Lexel_UkAddressFinder.xml" hash="9bbea2ea3a3f53770dcf3d4c15cfead6"/></dir></target></contents>
37
+ <compatible/>
38
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
39
+ </package>