Version Notes
Stable release of Postcode Lookup Extension
Download this release
Release Info
Developer | Magento Core Team |
Extension | devshark_postcodelookup |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Devshark/Postcodelookup/Helper/Data.php +3 -0
- app/code/local/Devshark/Postcodelookup/controllers/IndexController.php +56 -0
- app/code/local/Devshark/Postcodelookup/etc/config.xml +73 -0
- app/code/local/Devshark/Postcodelookup/etc/system.xml +59 -0
- app/design/frontend/default/default/layout/postcodelookup.xml +30 -0
- app/design/frontend/default/default/template/devshark/postcodelookup/checkout/onepage/billing.phtml +155 -0
- app/design/frontend/default/default/template/devshark/postcodelookup/checkout/onepage/shipping.phtml +103 -0
- app/design/frontend/default/default/template/devshark/postcodelookup/customer/address/edit.phtml +147 -0
- app/etc/modules/Devshark_Postcodelookup.xml +10 -0
- js/postcodelookup/postcodelookup.js +62 -0
- package.xml +18 -0
app/code/local/Devshark/Postcodelookup/Helper/Data.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Devshark_Postcodelookup_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{ }
|
app/code/local/Devshark/Postcodelookup/controllers/IndexController.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Devshark_Postcodelookup_IndexController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
public function indexAction() {
|
6 |
+
|
7 |
+
$account = Mage::getStoreConfig('postcodelookup/account/accountname'); // Insert your account name here
|
8 |
+
$password = Mage::getStoreConfig('postcodelookup/account/accountpassword'); // Insert your password here
|
9 |
+
|
10 |
+
$URL = "http://ws1.postcodesoftware.co.uk/lookup.asmx/getAddress?account=" . $account . "&password=" . $password . "&postcode=" . $this->getRequest()->getParam('postcode');
|
11 |
+
|
12 |
+
$xml = simplexml_load_file(str_replace(' ','', $URL)); // Removes unnecessary spaces
|
13 |
+
|
14 |
+
if ($xml->ErrorNumber <> 0) // If an error has occured show message
|
15 |
+
{
|
16 |
+
print "<span style='color:red;'>" . $xml->ErrorMessage . "</span>";
|
17 |
+
}
|
18 |
+
else
|
19 |
+
{
|
20 |
+
|
21 |
+
if ($xml->Address2 != "")
|
22 |
+
{
|
23 |
+
if ($xml->Address3 != "")
|
24 |
+
{
|
25 |
+
if ($xml->Address4 != "")
|
26 |
+
{ $AddressLine1 = $xml->Address1 . ", " . $xml->Address2; $AddressLine2 = $xml->Address3 . ", " . $xml->Address4; }
|
27 |
+
else
|
28 |
+
{ $AddressLine1 = $xml->Address1; $AddressLine2 = $xml->Address2 . ", " . $xml->Address3; }
|
29 |
+
}
|
30 |
+
else
|
31 |
+
{ $AddressLine1 = $xml->Address1; $AddressLine2 = $xml->Address2; }
|
32 |
+
}
|
33 |
+
else
|
34 |
+
{
|
35 |
+
$AddressLine1 = $xml->Address1;
|
36 |
+
}
|
37 |
+
|
38 |
+
$chunks = spliti (";", $xml->PremiseData); // Splits up premise data
|
39 |
+
print "<select class=\"validate-select\" id='address_dropdown' onChange=\"sendText('$AddressLine2','$xml->Town','$xml->County','$xml->Postcode');\" style=\"width:300px\">\n<option> [ Please Select ] </option>";
|
40 |
+
foreach ($chunks as $v) // Adds premises to combo box
|
41 |
+
{
|
42 |
+
if ($v <> "")
|
43 |
+
{
|
44 |
+
list($organisation, $building , $number) = split('[|]', $v); // Splits premises into organisation, building and number
|
45 |
+
echo "<option value='$organisation'>";
|
46 |
+
if ($organisation <> "")echo $organisation . ", ";
|
47 |
+
if ($building <> "")echo str_replace("/",", ",$building) . ", ";
|
48 |
+
if ($number <> "")echo $number . " ";
|
49 |
+
print $AddressLine1;
|
50 |
+
print "</option>\n";
|
51 |
+
}
|
52 |
+
}
|
53 |
+
print "</select>";
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
app/code/local/Devshark/Postcodelookup/etc/config.xml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Devshark_Postcodelookup>
|
5 |
+
<version>1.4.0</version>
|
6 |
+
</Devshark_Postcodelookup>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<frontend>
|
10 |
+
<routers>
|
11 |
+
<devshark_postcodelookup>
|
12 |
+
<use>standard</use>
|
13 |
+
<args>
|
14 |
+
<module>Devshark_Postcodelookup</module>
|
15 |
+
<frontName>postcodelookup</frontName>
|
16 |
+
</args>
|
17 |
+
</devshark_postcodelookup>
|
18 |
+
</routers>
|
19 |
+
<layout>
|
20 |
+
<updates>
|
21 |
+
<devshark_postcodelookup>
|
22 |
+
<file>postcodelookup.xml</file>
|
23 |
+
</devshark_postcodelookup>
|
24 |
+
</updates>
|
25 |
+
</layout>
|
26 |
+
</frontend>
|
27 |
+
|
28 |
+
<global>
|
29 |
+
<helpers>
|
30 |
+
<postcodelookup>
|
31 |
+
<class>Devshark_Postcodelookup_Helper</class>
|
32 |
+
</postcodelookup>
|
33 |
+
</helpers>
|
34 |
+
<models>
|
35 |
+
<postcodelookup>
|
36 |
+
<class>Devshark_Postcodelookup_Model</class>
|
37 |
+
</postcodelookup>
|
38 |
+
</models>
|
39 |
+
</global>
|
40 |
+
|
41 |
+
<default>
|
42 |
+
<postcodelookup>
|
43 |
+
<account>
|
44 |
+
<active>0</active>
|
45 |
+
<model>devshark/postcodelookup</model>
|
46 |
+
<accountname>test</accountname>
|
47 |
+
<accountpassword>test</accountpassword>
|
48 |
+
</account>
|
49 |
+
</postcodelookup>
|
50 |
+
</default>
|
51 |
+
<adminhtml>
|
52 |
+
<acl>
|
53 |
+
<resources>
|
54 |
+
<admin>
|
55 |
+
<children>
|
56 |
+
<system>
|
57 |
+
<children>
|
58 |
+
<config>
|
59 |
+
<children>
|
60 |
+
<postcodelookup translate="title" module="customer">
|
61 |
+
<title>postcodelookup</title>
|
62 |
+
<sort_order>20</sort_order>
|
63 |
+
</postcodelookup>
|
64 |
+
</children>
|
65 |
+
</config>
|
66 |
+
</children>
|
67 |
+
</system>
|
68 |
+
</children>
|
69 |
+
</admin>
|
70 |
+
</resources>
|
71 |
+
</acl>
|
72 |
+
</adminhtml>
|
73 |
+
</config>
|
app/code/local/Devshark/Postcodelookup/etc/system.xml
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<tabs>
|
5 |
+
<postcodelookup translate="label" module="postcodelookup">
|
6 |
+
<label>Postcode Lookup</label>
|
7 |
+
<sort_order>301</sort_order>
|
8 |
+
</postcodelookup>
|
9 |
+
</tabs>
|
10 |
+
<sections>
|
11 |
+
<postcodelookup translate="label" module="postcodelookup">
|
12 |
+
<label>Configuration Area</label>
|
13 |
+
<tab>postcodelookup</tab>
|
14 |
+
<sort_order>1</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>0</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<account translate="label">
|
20 |
+
<label>Account Details</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>0</show_in_website>
|
25 |
+
<show_in_store>0</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<active translate="label">
|
28 |
+
<label>Active</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</active>
|
36 |
+
|
37 |
+
<accountname translate="label">
|
38 |
+
<label>Account Name</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>2</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</accountname>
|
45 |
+
|
46 |
+
<accountpassword translate="label">
|
47 |
+
<label>Account Password</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>3</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</accountpassword>
|
54 |
+
</fields>
|
55 |
+
</account>
|
56 |
+
</groups>
|
57 |
+
</postcodelookup>
|
58 |
+
</sections>
|
59 |
+
</config>
|
app/design/frontend/default/default/layout/postcodelookup.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<checkout_onepage_index>
|
4 |
+
<reference name="head">
|
5 |
+
<action method="addJs"><script>postcodelookup/postcodelookup.js</script></action>
|
6 |
+
</reference>
|
7 |
+
<reference name="checkout.onepage.shipping">
|
8 |
+
<action method="setTemplate"><template>devshark/postcodelookup/checkout/onepage/shipping.phtml</template></action>
|
9 |
+
</reference>
|
10 |
+
<reference name="checkout.onepage.billing">
|
11 |
+
<action method="setTemplate"><template>devshark/postcodelookup/checkout/onepage/billing.phtml</template></action>
|
12 |
+
</reference>
|
13 |
+
</checkout_onepage_index>
|
14 |
+
<checkout_multishipping_customer_address>
|
15 |
+
<reference name="head">
|
16 |
+
<action method="addJs"><script>postcodelookup/postcodelookup.js</script></action>
|
17 |
+
</reference>
|
18 |
+
<reference name="customer_address_edit">
|
19 |
+
<action method="setTemplate"><template>devshark/postcodelookup/customer/address/edit.phtml</template></action>
|
20 |
+
</reference>
|
21 |
+
</checkout_multishipping_customer_address>
|
22 |
+
<customer_address_form>
|
23 |
+
<reference name="head">
|
24 |
+
<action method="addJs"><script>postcodelookup/postcodelookup.js</script></action>
|
25 |
+
</reference>
|
26 |
+
<reference name="customer_address_edit">
|
27 |
+
<action method="setTemplate"><template>devshark/postcodelookup/customer/address/edit.phtml</template></action>
|
28 |
+
</reference>
|
29 |
+
</customer_address_form>
|
30 |
+
</layout>
|
app/design/frontend/default/default/template/devshark/postcodelookup/checkout/onepage/billing.phtml
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design_default
|
22 |
+
* @package Mage
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<form id="co-billing-form" action="">
|
28 |
+
<?php if ($this->customerHasAddresses()): ?>
|
29 |
+
<p><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></p>
|
30 |
+
<ul><li><p><?php echo $this->getAddressesHtmlSelect('billing') ?></p></li></ul>
|
31 |
+
|
32 |
+
<?php endif ?>
|
33 |
+
<fieldset class="group-select" id="billing-new-address-form" <?php if ($this->customerHasAddresses()): ?>style="display:none"<?php endif ?>>
|
34 |
+
<input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
|
35 |
+
<ul>
|
36 |
+
<li><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())
|
37 |
+
->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
|
38 |
+
<li><div class="input-box">
|
39 |
+
<label for="billing:company"><?php echo $this->__('Company') ?></label><br />
|
40 |
+
<input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" /></div>
|
41 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
42 |
+
<div class="input-box">
|
43 |
+
<label for="billing:email"><?php echo $this->__('Email Address') ?> <span class="required">*</span></label><br />
|
44 |
+
<input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="validate-email required-entry input-text" /></div>
|
45 |
+
<?php endif ?>
|
46 |
+
</li>
|
47 |
+
|
48 |
+
<?php if(Mage::getStoreConfig('postcodelookup/account/active') == 0 ) { ?>
|
49 |
+
<li>
|
50 |
+
<label for="billing:postcode"><?php echo $this->__('Postcode') ?> <span class="required">*</span></label><br />
|
51 |
+
<input type="text" style="width:70px;" title="<?php echo $this->__('Postcode') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="validate-zip-international required-entry input-text" />
|
52 |
+
</li>
|
53 |
+
<?php } else { ?>
|
54 |
+
<li>
|
55 |
+
<label for="billing:postcode"><?php echo $this->__('Postcode') ?> <span class="required">*</span></label><br />
|
56 |
+
<input type="text" style="width:70px;" title="<?php echo $this->__('Postcode') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="validate-zip-international required-entry input-text" /><input type="button" onclick="LookupPostcode('billing', '<?= Mage::getBaseUrl(); ?>postcodelookup/');" value="Find" />
|
57 |
+
<span id="billing:loading" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="Loading" /></span>
|
58 |
+
</li>
|
59 |
+
<li>
|
60 |
+
<div id="billing:result"></div>
|
61 |
+
</li>
|
62 |
+
<?php } ?>
|
63 |
+
|
64 |
+
|
65 |
+
<li><label for="billing:street1"><?php echo $this->__('Address') ?> <span class="required">*</span></label><br />
|
66 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="required-entry input-text" /></li>
|
67 |
+
<?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
|
68 |
+
<li><input type="text" title="<?php echo $this->__('Street Address '.$_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" /></li>
|
69 |
+
<?php endfor ?>
|
70 |
+
<li><div class="input-box">
|
71 |
+
<label for="billing:city"><?php echo $this->__('City') ?> <span class="required">*</span></label><br />
|
72 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="required-entry input-text" id="billing:city" /></div>
|
73 |
+
<div class="input-box">
|
74 |
+
<label for="billing:region"><?php echo $this->__('State/Province') ?> <span class="required">*</span></label><br/>
|
75 |
+
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none">
|
76 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
77 |
+
</select>
|
78 |
+
<script type="text/javascript">
|
79 |
+
$('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
80 |
+
</script>
|
81 |
+
<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" />
|
82 |
+
</div></li>
|
83 |
+
<li><div class="input-box">
|
84 |
+
<label for="billing:country_id"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
|
85 |
+
<?php echo $this->getCountryHtmlSelect('billing') ?></div></li>
|
86 |
+
<li><div class="input-box">
|
87 |
+
<label for="billing:telephone"><?php echo $this->__('Telephone') ?> <span class="required">*</span></label><br/>
|
88 |
+
<input type="text" name="billing[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="required-entry input-text" id="billing:telephone" /></div>
|
89 |
+
<div class="input-box">
|
90 |
+
<label for="billing:fax"><?php echo $this->__('Fax') ?></label><br/>
|
91 |
+
<input type="text" name="billing[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="billing:fax" /></div></li>
|
92 |
+
<?php if(!$this->isCustomerLoggedIn()): ?>
|
93 |
+
|
94 |
+
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
|
95 |
+
<?php if ($_dob->isEnabled()): ?>
|
96 |
+
<li>
|
97 |
+
<?php echo $_dob->setDate($this->getQuote()->getCustomerDob())
|
98 |
+
->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
99 |
+
</li>
|
100 |
+
<?php endif ?>
|
101 |
+
|
102 |
+
<?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
|
103 |
+
<?php if ($_taxvat->isEnabled()): ?>
|
104 |
+
<li>
|
105 |
+
<?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())
|
106 |
+
->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
|
107 |
+
</li>
|
108 |
+
<?php endif ?>
|
109 |
+
|
110 |
+
<li id="register-customer-password">
|
111 |
+
<div class="input-box">
|
112 |
+
<label for="billing:customer_password"><?php echo $this->__('Password') ?> <span class="required">*</span></label><br/>
|
113 |
+
<input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="required-entry validate-password input-text" /></div>
|
114 |
+
<div class="input-box">
|
115 |
+
<label for="billing:confirm_password"><?php echo $this->__('Confirm Password') ?> <span class="required">*</span></label><br/>
|
116 |
+
<input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="required-entry validate-password input-text" /></div></li>
|
117 |
+
<?php endif ?>
|
118 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
119 |
+
<li><input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> /> <label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
|
120 |
+
<?php else:?>
|
121 |
+
<li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
|
122 |
+
<?php endif;?>
|
123 |
+
</ul>
|
124 |
+
</fieldset>
|
125 |
+
<fieldset>
|
126 |
+
<?php if ($this->canShip()): ?>
|
127 |
+
<p>
|
128 |
+
<input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1" <?php if ($this->isUseBillingAddressForShipping()) {?>checked="checked" <?php }?>onclick="$('shipping:same_as_billing').checked = true;" /> <label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label> <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0" <?php if (!$this->isUseBillingAddressForShipping()) {?>checked="checked" <?php }?>onclick="$('shipping:same_as_billing').checked = false;" /> <label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
|
129 |
+
</p>
|
130 |
+
<?php else: ?>
|
131 |
+
<p class="no-display"><input type="hidden" name="billing[use_for_shipping]" value="1" /></p>
|
132 |
+
<?php endif; ?>
|
133 |
+
</fieldset>
|
134 |
+
</form>
|
135 |
+
<div class="button-set">
|
136 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
137 |
+
<div id="billing-buttons-container">
|
138 |
+
<button class="form-button right" onclick="billing.save()"><span><?php echo $this->__('Continue') ?></span></button>
|
139 |
+
<span id="billing-please-wait" style="display:none;" class="opc-please-wait">
|
140 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt="" /> <?php echo $this->__('Loading next step...') ?>
|
141 |
+
</span>
|
142 |
+
</div>
|
143 |
+
</div>
|
144 |
+
|
145 |
+
<script type="text/javascript">
|
146 |
+
//<![CDATA[
|
147 |
+
var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
|
148 |
+
var billingForm = new VarienForm('co-billing-form');
|
149 |
+
|
150 |
+
//billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
151 |
+
$('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
|
152 |
+
|
153 |
+
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions);
|
154 |
+
//]]>
|
155 |
+
</script>
|
app/design/frontend/default/default/template/devshark/postcodelookup/checkout/onepage/shipping.phtml
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
|
4 |
+
*/
|
5 |
+
?>
|
6 |
+
<form id="co-shipping-form" action="">
|
7 |
+
<?php if ($this->customerHasAddresses()): ?>
|
8 |
+
<p><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></p>
|
9 |
+
<p><?php echo $this->getAddressesHtmlSelect('shipping') ?></p>
|
10 |
+
<?php endif ?>
|
11 |
+
|
12 |
+
<fieldset class="group-select" id="shipping-new-address-form" <?php if ($this->customerHasAddresses()): ?>style="display:none"<?php endif ?>>
|
13 |
+
<input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
|
14 |
+
<ul>
|
15 |
+
<li><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())
|
16 |
+
->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
|
17 |
+
<li><div class="input-box">
|
18 |
+
<label for="shipping:company"><?php echo $this->__('Company') ?></label><br/>
|
19 |
+
<input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" onchange="shipping.setSameAsBilling(false);" /></div>
|
20 |
+
<?php if(false): ?>
|
21 |
+
<div class="input-box">
|
22 |
+
<label for="shipping:email"><?php echo $this->__('Email Address') ?> <span class="required">*</span></label><br />
|
23 |
+
<input type="text" name="shipping[email]" id="shipping:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="validate-email required-entry input-text" /></div>
|
24 |
+
<?php endif ?>
|
25 |
+
</li>
|
26 |
+
|
27 |
+
|
28 |
+
<?php if(Mage::getStoreConfig('postcodelookup/account/active') == 0 ) { ?>
|
29 |
+
<li>
|
30 |
+
<label for="shipping:postcode"><?php echo $this->__('Postcode') ?> <span class="required">*</span></label><br />
|
31 |
+
<input style="width:70px;" type="text" title="<?php echo $this->__('Postcode') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="validate-zip-international required-entry input-text" onchange="shipping.setSameAsBilling(false);"/>
|
32 |
+
</li>
|
33 |
+
<?php } else { ?>
|
34 |
+
<li>
|
35 |
+
<label for="shipping:postcode"><?php echo $this->__('Postcode') ?> <span class="required">*</span></label><br />
|
36 |
+
<input style="width:70px;" type="text" title="<?php echo $this->__('Postcode') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="validate-zip-international required-entry input-text" onchange="shipping.setSameAsBilling(false);"/><input type="button" onclick="LookupPostcode('shipping', '<?= Mage::getBaseUrl(); ?>postcodelookup/');" value="Find" />
|
37 |
+
<span id="shipping:loading" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="Loading" /></span>
|
38 |
+
</li>
|
39 |
+
<li>
|
40 |
+
<div id="shipping:result"></div>
|
41 |
+
</li>
|
42 |
+
<?php } ?>
|
43 |
+
<li><label for="shipping:street1"><?php echo $this->__('Address') ?> <span class="required">*</span></label><br />
|
44 |
+
<input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="required-entry input-text" onchange="shipping.setSameAsBilling(false);" /></li>
|
45 |
+
<?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
|
46 |
+
<li><input type="text" title="<?php echo $this->__('Street Address '.$_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" onchange="shipping.setSameAsBilling(false);"/></li>
|
47 |
+
<?php endfor ?>
|
48 |
+
<li><div class="input-box">
|
49 |
+
<label for="shipping:city"><?php echo $this->__('City') ?> <span class="required">*</span></label><br />
|
50 |
+
<input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="required-entry input-text" id="shipping:city" onchange="shipping.setSameAsBilling(false);" /></div>
|
51 |
+
<div class="input-box">
|
52 |
+
<label for="shipping:region_id"><?php echo $this->__('State/Province') ?> <span class="required">*</span></label><br />
|
53 |
+
<select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none">
|
54 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
55 |
+
</select>
|
56 |
+
<script type="text/javascript">
|
57 |
+
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
58 |
+
</script>
|
59 |
+
<input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none" /></div></li>
|
60 |
+
<li><div class="input-box">
|
61 |
+
</div>
|
62 |
+
<div class="input-box">
|
63 |
+
<label for="shipping:country_id"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
|
64 |
+
<?php echo $this->getCountryHtmlSelect('shipping') ?>
|
65 |
+
</div></li>
|
66 |
+
<li><div class="input-box">
|
67 |
+
<label for="shipping:telephone"><?php echo $this->__('Telephone') ?> <span class="required">*</span></label><br />
|
68 |
+
<input type="text" name="shipping[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="required-entry input-text" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" /></div>
|
69 |
+
<div class="input-box">
|
70 |
+
<label for="shipping:fax"><?php echo $this->__('Fax') ?></label><br />
|
71 |
+
<input type="text" name="shipping[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" /></div></li>
|
72 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
73 |
+
<li><input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> /> <label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
|
74 |
+
<?php else:?>
|
75 |
+
<li><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
|
76 |
+
<?php endif;?>
|
77 |
+
</ul>
|
78 |
+
</fieldset>
|
79 |
+
<p><input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1" <?php if($this->getAddress()->getSameAsBilling()): ?>checked="checked"<?php endif ?> onclick="shipping.setSameAsBilling(this.checked)" /> <label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label></p>
|
80 |
+
</form>
|
81 |
+
<div class="button-set">
|
82 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
83 |
+
<div id="shipping-buttons-container">
|
84 |
+
<a href="#" class="back left" onclick="checkout.back(); return false;"><?php echo $this->__('Back') ?></a>
|
85 |
+
<button class="form-button right" onclick="shipping.save()"><span><?php echo $this->__('Continue') ?></span></button>
|
86 |
+
<span id="shipping-please-wait" style="display:none;" class="opc-please-wait">
|
87 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt="" /> <?php echo $this->__('Loading next step...') ?>
|
88 |
+
</span>
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
|
92 |
+
<script type="text/javascript">
|
93 |
+
//<![CDATA[
|
94 |
+
var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
|
95 |
+
'<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
|
96 |
+
var shippingForm = new VarienForm('co-shipping-form');
|
97 |
+
shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
|
98 |
+
//shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
|
99 |
+
$('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
|
100 |
+
|
101 |
+
var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', countryRegions);
|
102 |
+
//]]>
|
103 |
+
</script>
|
app/design/frontend/default/default/template/devshark/postcodelookup/customer/address/edit.phtml
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design_default
|
22 |
+
* @package Mage
|
23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Edit customer address template
|
30 |
+
*
|
31 |
+
* @see Mage_Customer_Block_Address_Edit
|
32 |
+
*/
|
33 |
+
?>
|
34 |
+
<?php if($this->getTitle()): ?>
|
35 |
+
<div class="page-head">
|
36 |
+
<h3><?php echo $this->getTitle() ?></h3>
|
37 |
+
</div>
|
38 |
+
<?php endif; ?>
|
39 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
40 |
+
<form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate">
|
41 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
42 |
+
<fieldset class="group-select">
|
43 |
+
<input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
|
44 |
+
<input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
|
45 |
+
<h4 class="legend"><?php echo $this->__('Contact Information') ?></h4>
|
46 |
+
<ul>
|
47 |
+
<li>
|
48 |
+
<?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getCustomer())->toHtml() ?>
|
49 |
+
</li>
|
50 |
+
<li>
|
51 |
+
<label for="company"><?php echo $this->__('Company') ?></label><br />
|
52 |
+
<input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" class="input-text" />
|
53 |
+
</li>
|
54 |
+
<li>
|
55 |
+
<div class="input-box">
|
56 |
+
<label for="telephone"><?php echo $this->__('Telephone') ?> <span class="required">*</span></label><br />
|
57 |
+
<input type="text" name="telephone" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="required-entry input-text" id="telephone" />
|
58 |
+
</div>
|
59 |
+
<div class="input-box">
|
60 |
+
<label for="fax"><?php echo $this->__('Fax') ?></label><br />
|
61 |
+
<input type="text" name="fax" id="fax" title="<?php echo $this->__('Fax') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" class="input-text" />
|
62 |
+
</div>
|
63 |
+
</li>
|
64 |
+
</ul>
|
65 |
+
</fieldset>
|
66 |
+
<fieldset class="group-select">
|
67 |
+
<h4 class="legend"><?php echo $this->__('Address') ?></h4>
|
68 |
+
<ul>
|
69 |
+
<?php if(Mage::getStoreConfig('postcodelookup/account/active') == 0 ) { ?>
|
70 |
+
<li>
|
71 |
+
<label for="zip"><?php echo $this->__('Postcode') ?> <span class="required">*</span></label><br />
|
72 |
+
<input type="text" style="width:70px;" name="postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Postcode') ?>" id="zip" class="validate-zip-international required-entry input-text" />
|
73 |
+
</li>
|
74 |
+
<?php } else { ?>
|
75 |
+
<li>
|
76 |
+
<label for="zip"><?php echo $this->__('Postcode') ?> <span class="required">*</span></label><br />
|
77 |
+
<input type="text" style="width:70px;" name="postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Postcode') ?>" id="zip" class="validate-zip-international required-entry input-text" /><input type="button" onclick="LookupPostcode('edit', '<?= Mage::getBaseUrl(); ?>postcodelookup/');" value="Find" />
|
78 |
+
<span id="loading" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="Loading" /></span>
|
79 |
+
</li>
|
80 |
+
<li>
|
81 |
+
<div id="result"></div>
|
82 |
+
</li>
|
83 |
+
<?php } ?>
|
84 |
+
<li>
|
85 |
+
<label for="street_1"><?php echo $this->__('Street Address') ?> <span class="required">*</span></label><br />
|
86 |
+
<input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="required-entry input-text" />
|
87 |
+
</li>
|
88 |
+
|
89 |
+
<?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
|
90 |
+
<li>
|
91 |
+
<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" />
|
92 |
+
</li>
|
93 |
+
<?php endfor ?>
|
94 |
+
<li>
|
95 |
+
<div class="input-box">
|
96 |
+
<label for="city"><?php echo $this->__('City') ?> <span class="required">*</span></label><br />
|
97 |
+
<input type="text" name="city" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="required-entry input-text" id="city" />
|
98 |
+
</div>
|
99 |
+
<div class="input-box">
|
100 |
+
<label for="region_id"><?php echo $this->__('State/Province') ?> <span class="required">*</span></label><br />
|
101 |
+
<select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none">
|
102 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
103 |
+
</select>
|
104 |
+
<script type="text/javascript">
|
105 |
+
$('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
|
106 |
+
</script>
|
107 |
+
<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" />
|
108 |
+
</div>
|
109 |
+
</li>
|
110 |
+
<li>
|
111 |
+
<div class="input-box">
|
112 |
+
<label for="country"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br />
|
113 |
+
<?php echo $this->getCountryHtmlSelect() ?>
|
114 |
+
</div>
|
115 |
+
</li>
|
116 |
+
<li>
|
117 |
+
<?php if($this->isDefaultBilling()): ?>
|
118 |
+
<strong><?php echo $this->__('Default Billing Address') ?></strong>
|
119 |
+
<?php elseif($this->canSetAsDefaultBilling()): ?>
|
120 |
+
<input type="checkbox" id="primary_billing" name="default_billing" value="1" />
|
121 |
+
<label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
|
122 |
+
<?php else: ?>
|
123 |
+
<input type="hidden" name="default_billing" value="1" />
|
124 |
+
<?php endif; ?>
|
125 |
+
</li>
|
126 |
+
<li>
|
127 |
+
<?php if($this->isDefaultShipping()): ?>
|
128 |
+
<strong><?php echo $this->__('Default Shipping Address') ?></strong>
|
129 |
+
<?php elseif($this->canSetAsDefaultShipping()): ?>
|
130 |
+
<input type="checkbox" id="primary_shipping" name="default_shipping" value="1" />
|
131 |
+
<label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
|
132 |
+
<?php else: ?>
|
133 |
+
<input type="hidden" name="default_shipping" value="1" />
|
134 |
+
<?php endif; ?>
|
135 |
+
</li>
|
136 |
+
</ul>
|
137 |
+
</fieldset>
|
138 |
+
<div class="button-set">
|
139 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
140 |
+
<a href="<?php echo $this->getBackUrl() ?>" class="left">« <?php echo $this->__('Back') ?></a>
|
141 |
+
<button class="form-button" type="submit"><span><?php echo $this->__('Save Address') ?></span></button>
|
142 |
+
</div>
|
143 |
+
</form>
|
144 |
+
<script type="text/javascript">
|
145 |
+
var dataForm = new VarienForm('form-validate', true);
|
146 |
+
new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
|
147 |
+
</script>
|
app/etc/modules/Devshark_Postcodelookup.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Devshark_Postcodelookup>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<version>1.4.0</version>
|
8 |
+
</Devshark_Postcodelookup>
|
9 |
+
</modules>
|
10 |
+
</config>
|
js/postcodelookup/postcodelookup.js
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var type, txtPostcode, txtCompany, txtStreet1, txtStreet2, txtCity, txtRegion, txtResult;
|
2 |
+
|
3 |
+
function sendText(addressline2, town, county, postcode)
|
4 |
+
{
|
5 |
+
var company = $('address_dropdown').value;
|
6 |
+
var addressline1 =$('address_dropdown').options[$('address_dropdown').selectedIndex].text;
|
7 |
+
|
8 |
+
if (company != "")
|
9 |
+
{
|
10 |
+
addressline1 = addressline1.replace(company + ', ','');
|
11 |
+
$(txtCompany).value = company;
|
12 |
+
}
|
13 |
+
if (addressline2 != "")
|
14 |
+
{
|
15 |
+
$(txtStreet2).value = addressline2;
|
16 |
+
}
|
17 |
+
$(txtPostcode).value = postcode;
|
18 |
+
$(txtStreet1).value = addressline1;
|
19 |
+
$(txtCity).value = town;
|
20 |
+
$(txtRegion).value = county;
|
21 |
+
$(txtResult).innerHTML = "";
|
22 |
+
}
|
23 |
+
|
24 |
+
function LookupPostcode(type,url)
|
25 |
+
{
|
26 |
+
if (type == 'billing')
|
27 |
+
{
|
28 |
+
txtPostcode = 'billing:postcode';
|
29 |
+
txtCompany = 'billing:company';
|
30 |
+
txtStreet1 = 'billing:street1';
|
31 |
+
txtStreet2 = 'billing:street2';
|
32 |
+
txtCity = 'billing:city';
|
33 |
+
txtRegion = 'billing:region';
|
34 |
+
txtResult = 'billing:result';
|
35 |
+
spnLoading = 'billing:loading';
|
36 |
+
}
|
37 |
+
if (type == 'shipping')
|
38 |
+
{
|
39 |
+
txtPostcode = 'shipping:postcode';
|
40 |
+
txtCompany = 'shipping:company';
|
41 |
+
txtStreet1 = 'shipping:street1';
|
42 |
+
txtStreet2 = 'shipping:street2';
|
43 |
+
txtCity = 'shipping:city';
|
44 |
+
txtRegion = 'shipping:region';
|
45 |
+
txtResult = 'shipping:result';
|
46 |
+
spnLoading = 'shipping:loading';
|
47 |
+
}
|
48 |
+
if (type == 'edit')
|
49 |
+
{
|
50 |
+
txtPostcode = 'zip';
|
51 |
+
txtCompany = 'company';
|
52 |
+
txtStreet1 = 'street_1';
|
53 |
+
txtStreet2 = 'street_2';
|
54 |
+
txtCity = 'city';
|
55 |
+
txtRegion = 'region';
|
56 |
+
txtResult = 'result';
|
57 |
+
spnLoading = 'loading';
|
58 |
+
}
|
59 |
+
//onLoading: function(){ $('ajax_loading').show() }, onLoaded: function(){ $('ajax_loading').hide() }
|
60 |
+
new Ajax.Updater({success: txtResult},url,{method: 'post', parameters: 'postcode=' + $F(txtPostcode), onFailure: txtResult, onLoading: function(){ $(spnLoading).show() }, onLoaded: function(){ $(spnLoading).hide() }});
|
61 |
+
//$('ajax_loading').hide();
|
62 |
+
}
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>devshark_postcodelookup</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Postcode Lookup Extension</summary>
|
10 |
+
<description>Postcode Lookup Extension will allow you to add address lookup facility to your magento site, improving your image and verification.</description>
|
11 |
+
<notes>Stable release of Postcode Lookup Extension</notes>
|
12 |
+
<authors><author><name>Devshark</name><user>auto-converted</user><email>info@devshark.co.uk</email></author></authors>
|
13 |
+
<date>2010-03-17</date>
|
14 |
+
<time>20:05:54</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Devshark"><dir name="Postcodelookup"><dir name="controllers"><file name="IndexController.php" hash="8144c592c71ee001efdf96c7a7ebd12f"/></dir><dir name="etc"><file name="config.xml" hash="8df95c607055afd1db3bb15575655e5e"/><file name="system.xml" hash="320a28d3a850e24f7f2a0237507ef959"/></dir><dir name="Helper"><file name="Data.php" hash="6caf2a1fd4b06da76c2b7871d62ab200"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="postcodelookup.xml" hash="5ca715ad7a8ddca62a59ed6b9cdbc7a3"/></dir><dir name="template"><dir name="devshark"><dir name="postcodelookup"><dir name="checkout"><dir name="onepage"><file name="billing.phtml" hash="604b8e88fc8c7bb8386f6ca070229eaa"/><file name="shipping.phtml" hash="c21b9c07c770b2fd6764e94d29518491"/></dir></dir><dir name="customer"><dir name="address"><file name="edit.phtml" hash="6d0ae0ef8952b0ccb751edddd20b5628"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="postcodelookup"><file name="postcodelookup.js" hash="75c4c50c3a01908fa6296b301655bf61"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Devshark_Postcodelookup.xml" hash="0e856ec0896911397e3e3687214f0b50"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|