UK_and_International_Address_Auto-Fill_from_Postcode_Anywhere - Version 1.0.0

Version Notes

Stable Release

Download this release

Release Info

Developer PCA_Tom
Extension UK_and_International_Address_Auto-Fill_from_Postcode_Anywhere
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/PostcodeAnywhere/AddressLookup/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class PostcodeAnywhere_AddressLookup_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
app/code/community/PostcodeAnywhere/AddressLookup/controllers/IndexController.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class PostcodeAnywhere_AddressLookup_IndexController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ public function indexAction() {
6
+
7
+ $this->loadLayout();
8
+ $this->renderLayout();
9
+ }
10
+ }
app/code/community/PostcodeAnywhere/AddressLookup/etc/config.xml ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <PostcodeAnywhere_AddressLookup>
5
+ <version>0.0.1</version>
6
+ </PostcodeAnywhere_AddressLookup>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <AddressLookup>
11
+ <class>PostcodeAnywhere_AddressLookup_Block</class>
12
+ </AddressLookup>
13
+ </blocks>
14
+ <helpers>
15
+ <PostcodeAnywhere_AddressLookup>
16
+ <class>PostcodeAnywhere_AddressLookup_Helper</class>
17
+ </PostcodeAnywhere_AddressLookup>
18
+ </helpers>
19
+ </global>
20
+ <frontend>
21
+ <layout>
22
+ <updates>
23
+ <customer>
24
+ <file>AddressLookup.xml</file>
25
+ </customer>
26
+ <checkout>
27
+ <file>GuestAddressLookup.xml</file>
28
+ </checkout>
29
+ <persistent>
30
+ <file>PCAPersistent.xml</file>
31
+ </persistent>
32
+ </updates>
33
+ </layout>
34
+ </frontend>
35
+ <adminhtml>
36
+ <acl>
37
+ <resources>
38
+ <all>
39
+ <title>Allow Everything</title>
40
+ </all>
41
+ <admin>
42
+ <children>
43
+ <system>
44
+ <children>
45
+ <config>
46
+ <children>
47
+ <PostcodeAnywhere>
48
+ <title>PostcodeAnywhere - All</title>
49
+ </PostcodeAnywhere>
50
+ </children>
51
+ </config>
52
+ </children>
53
+ </system>
54
+ </children>
55
+ </admin>
56
+ </resources>
57
+ </acl>
58
+ </adminhtml>
59
+ </config>
app/code/community/PostcodeAnywhere/AddressLookup/etc/system.xml ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <PostcodeAnywhere translate="label" module="PostcodeAnywhere_AddressLookup">
5
+ <label>Postcode Anywhere</label>
6
+ <sort_order>100</sort_order>
7
+ </PostcodeAnywhere>
8
+ </tabs>
9
+ <sections>
10
+ <PostcodeAnywhere translate="label" module="PostcodeAnywhere_AddressLookup">
11
+ <label>Extension Settings</label>
12
+ <tab>PostcodeAnywhere</tab>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+
18
+ <groups>
19
+ <PostcodeAnywhere_group translate="label" module="PostcodeAnywhere_AddressLookup">
20
+ <label>Postcode Anywhere Options</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1000</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+
27
+ <fields>
28
+ <PostcodeAnywhere_key translate="label">
29
+ <label>Website License Key: </label>
30
+ <comment>Enter your Postcode Anywhere key for website lookups.</comment>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>10</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </PostcodeAnywhere_key>
37
+ <PostcodeAnywhere_internalkey translate="label">
38
+ <label>Internal License Key: </label>
39
+ <comment>Enter your Postcode Anywhere key for internal lookups.</comment>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>20</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </PostcodeAnywhere_internalkey>
46
+ <PostcodeAnywhere_rmdata translate="label">
47
+ <label>Use Royal Mail Data: </label>
48
+ <comment>Use Royal Mail data for UK lookups.</comment>
49
+ <frontend_type>Radios</frontend_type>
50
+ <sort_order>30</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ <source_model>adminhtml/system_config_source_yesno</source_model>
55
+ </PostcodeAnywhere_rmdata>
56
+ <PostcodeAnywhere_enableinternal translate="label">
57
+ <label>Enable Internal Lookups: </label>
58
+ <comment>Use the functionality within the admin panel. Additional setup files required from Postcode Anywhere.</comment>
59
+ <frontend_type>Radios</frontend_type>
60
+ <sort_order>40</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
+ <source_model>adminhtml/system_config_source_yesno</source_model>
65
+ </PostcodeAnywhere_enableinternal>
66
+ </fields>
67
+ </PostcodeAnywhere_group>
68
+ </groups>
69
+ </PostcodeAnywhere>
70
+ </sections>
71
+ </config>
app/design/frontend/default/default/layout/AddressLookup.xml ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package base_default
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
27
+ */
28
+
29
+ Supported layout update handles (action):
30
+ - customer_account_index
31
+ - customer_address_index
32
+ - customer_address_view
33
+ - customer_account_login
34
+ - customer_account_logoutsuccess
35
+ - customer_account_create
36
+ - customer_account_forgotpassword
37
+ - customer_account_confirmation
38
+ - customer_account_edit
39
+
40
+ Supported layout update handles (special):
41
+ - default
42
+
43
+ -->
44
+ <layout version="0.1.0">
45
+
46
+ <!--
47
+ Default layout, loads most of the pages
48
+ -->
49
+
50
+ <default>
51
+ <!-- Mage_Customer -->
52
+ <reference name="top.links">
53
+ <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
54
+ </reference>
55
+ </default>
56
+
57
+ <!--
58
+ Load this update on every page when customer is logged in
59
+ -->
60
+
61
+ <customer_logged_in>
62
+ <reference name="top.links">
63
+ <action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action>
64
+ </reference>
65
+ </customer_logged_in>
66
+
67
+ <!--
68
+ Load this update on every page when customer is logged out
69
+ -->
70
+
71
+ <customer_logged_out>
72
+ <!---<reference name="right">
73
+ <block type="customer/form_login" name="customer_form_mini_login" before="-" template="customer/form/mini.login.phtml"/>
74
+ </reference>-->
75
+ <reference name="top.links">
76
+ <action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
77
+ </reference>
78
+ <remove name="wishlist_sidebar"></remove>
79
+ <remove name="reorder"></remove>
80
+ </customer_logged_out>
81
+
82
+ <!--
83
+ Layout for customer login page
84
+ -->
85
+
86
+ <customer_account_login translate="label">
87
+ <label>Customer Account Login Form</label>
88
+ <!-- Mage_Customer -->
89
+ <remove name="right"/>
90
+ <remove name="left"/>
91
+
92
+ <reference name="root">
93
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
94
+ </reference>
95
+ <reference name="content">
96
+ <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
97
+ </reference>
98
+ </customer_account_login>
99
+
100
+ <!--
101
+ Layout for customer log out page
102
+ -->
103
+
104
+ <customer_account_logoutsuccess translate="label">
105
+ <label>Customer Account Logout Success</label>
106
+ <!-- Mage_Customer -->
107
+ <remove name="right"/>
108
+ <remove name="left"/>
109
+
110
+ <reference name="root">
111
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
112
+ </reference>
113
+ <reference name="content">
114
+ <block type="core/template" name="customer_logout" template="customer/logout.phtml"/>
115
+ </reference>
116
+ </customer_account_logoutsuccess>
117
+
118
+ <!--
119
+ New customer registration
120
+ -->
121
+
122
+ <customer_account_create translate="label">
123
+ <label>Customer Account Registration Form</label>
124
+ <!-- Mage_Customer -->
125
+ <remove name="right"/>
126
+ <remove name="left"/>
127
+
128
+ <reference name="root">
129
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
130
+ </reference>
131
+ <reference name="content">
132
+ <block type="customer/form_register" name="customer_form_register" template="customer/form/pca_register.phtml">
133
+ <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
134
+ <label>Form Fields Before</label>
135
+ </block>
136
+ </block>
137
+ </reference>
138
+ </customer_account_create>
139
+
140
+ <customer_account_forgotpassword translate="label">
141
+ <label>Customer Forgot Password Form</label>
142
+ <remove name="right"/>
143
+ <remove name="left"/>
144
+
145
+ <reference name="root">
146
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
147
+ <action method="setHeaderTitle" translate="title" module="customer"><title>Password forgotten</title></action>
148
+ </reference>
149
+ <reference name="content">
150
+ <!--<block type="core/template" name="forgotPassword" template="customer/form/forgotpassword.phtml"/>-->
151
+ <block type="customer/account_forgotpassword" name="forgotPassword" template="customer/form/forgotpassword.phtml"/>
152
+ </reference>
153
+ </customer_account_forgotpassword>
154
+
155
+ <customer_account_confirmation>
156
+ <remove name="right"/>
157
+ <remove name="left"/>
158
+
159
+ <reference name="root">
160
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
161
+ <action method="setHeaderTitle" translate="title" module="customer"><title>Send confirmation link</title></action>
162
+ </reference>
163
+ <reference name="content">
164
+ <block type="core/template" name="accountConfirmation" template="customer/form/confirmation.phtml"/>
165
+ </reference>
166
+ </customer_account_confirmation>
167
+
168
+ <customer_account_edit translate="label">
169
+ <label>Customer Account Edit Form</label>
170
+ <update handle="customer_account"/>
171
+ <reference name="root">
172
+ <action method="setHeaderTitle" translate="title" module="customer"><title>Edit Account Info</title></action>
173
+ </reference>
174
+ <reference name="my.account.wrapper">
175
+ <block type="customer/form_edit" name="customer_edit" template="customer/form/edit.phtml"/>
176
+ </reference>
177
+
178
+ <reference name="left">
179
+ <action method="unsetChild"><name>left.permanent.callout</name></action>
180
+ </reference>
181
+ </customer_account_edit>
182
+
183
+ <!--
184
+ Customer account pages, rendered for all tabs in dashboard
185
+ -->
186
+
187
+ <customer_account translate="label">
188
+ <label>Customer My Account (All Pages)</label>
189
+ <!--remove name="catalog.compare.sidebar"/>
190
+ <remove name="sale.reorder.sidebar"/-->
191
+ <!-- Mage_Customer -->
192
+ <reference name="root">
193
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
194
+ </reference>
195
+
196
+ <reference name="content">
197
+ <block type="page/html_wrapper" name="my.account.wrapper" translate="label">
198
+ <label>My Account Wrapper</label>
199
+ <action method="setElementClass"><value>my-account</value></action>
200
+ </block>
201
+ </reference>
202
+
203
+ <reference name="left">
204
+ <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
205
+ <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
206
+ <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
207
+ <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
208
+ </block>
209
+ <block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml">
210
+ <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
211
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
212
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
213
+ </block>
214
+ <block type="catalog/product_compare_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
215
+ <block type="sales/reorder_sidebar" name="sale.reorder.sidebar" as="reorder" template="sales/reorder/sidebar.phtml"/>
216
+ <remove name="tags_popular"/>
217
+
218
+ </reference>
219
+ </customer_account>
220
+
221
+ <!--
222
+ Customer account home dashboard layout
223
+ -->
224
+
225
+ <customer_account_index translate="label">
226
+ <label>Customer My Account Dashboard</label>
227
+ <update handle="customer_account"/>
228
+ <!-- Mage_Customer -->
229
+ <reference name="root">
230
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
231
+ </reference>
232
+ <reference name="my.account.wrapper">
233
+ <block type="customer/account_dashboard" name="customer_account_dashboard" template="customer/account/dashboard.phtml">
234
+ <block type="customer/account_dashboard_hello" name="customer_account_dashboard_hello" as="hello" template="customer/account/dashboard/hello.phtml"/>
235
+ <block type="core/template" name="customer_account_dashboard_top" as="top" />
236
+ <block type="customer/account_dashboard_info" name="customer_account_dashboard_info" as="info" template="customer/account/dashboard/info.phtml"/>
237
+ <block type="customer/account_dashboard_newsletter" name="customer_account_dashboard_newsletter" as="newsletter" template="customer/account/dashboard/newsletter.phtml"/>
238
+ <block type="customer/account_dashboard_address" name="customer_account_dashboard_address" as="address" template="customer/account/dashboard/address.phtml"/>
239
+ </block>
240
+ </reference>
241
+
242
+ </customer_account_index>
243
+
244
+ <!--
245
+ Customer account address book
246
+ -->
247
+
248
+ <customer_address_index translate="label">
249
+ <label>Customer My Account Address Book</label>
250
+ <!-- Mage_Customer -->
251
+ <update handle="customer_account"/>
252
+ <reference name="my.account.wrapper">
253
+ <block type="customer/address_book" name="address_book" template="customer/address/book.phtml"/>
254
+ </reference>
255
+ </customer_address_index>
256
+
257
+ <!--
258
+ Customer account address edit page
259
+ -->
260
+
261
+ <customer_address_form translate="label">
262
+ <label>Customer My Account Address Edit Form</label>
263
+ <!-- Mage_Customer -->
264
+ <update handle="customer_account"/>
265
+ <reference name="my.account.wrapper">
266
+ <block type="customer/address_edit" name="customer_address_edit" template="customer/address/pca_edit.phtml"/>
267
+ </reference>
268
+ </customer_address_form>
269
+
270
+ </layout>
app/design/frontend/default/default/layout/GuestAddressLookup.xml ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package base_default
24
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+
28
+ -->
29
+ <layout version="0.1.0">
30
+
31
+ <!--
32
+ Default layout, loads most of the pages
33
+ -->
34
+
35
+ <default>
36
+
37
+ <!-- Mage_Checkout -->
38
+ <reference name="top.links">
39
+ <block type="checkout/links" name="checkout_cart_link">
40
+ <action method="addCartLink"></action>
41
+ <action method="addCheckoutLink"></action>
42
+ </block>
43
+ </reference>
44
+ <reference name="left">
45
+ <block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">
46
+ <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
47
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
48
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
49
+ <block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
50
+ <label>Shopping Cart Sidebar Extra Actions</label>
51
+ </block>
52
+ </block>
53
+ </reference>
54
+ </default>
55
+
56
+ <checkout_cart_index translate="label">
57
+ <label>Shopping Cart</label>
58
+ <remove name="right"/>
59
+ <remove name="left"/>
60
+ <!-- Mage_Checkout -->
61
+ <reference name="root">
62
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
63
+ </reference>
64
+ <reference name="content">
65
+ <block type="checkout/cart" name="checkout.cart">
66
+ <action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
67
+ <action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
68
+ <action method="chooseTemplate"/>
69
+ <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/item/default.phtml</template></action>
70
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/item/default.phtml</template></action>
71
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/item/default.phtml</template></action>
72
+
73
+ <block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
74
+ <label>Payment Methods Before Checkout Button</label>
75
+ <block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="checkout/onepage/link.phtml"/>
76
+ </block>
77
+
78
+ <block type="page/html_wrapper" name="checkout.cart.form.before" as="form_before" translate="label">
79
+ <label>Shopping Cart Form Before</label>
80
+ </block>
81
+
82
+ <block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
83
+ <label>Payment Methods After Checkout Button</label>
84
+ <block type="checkout/onepage_link" name="checkout.cart.methods.onepage" template="checkout/onepage/link.phtml"/>
85
+ <block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
86
+ </block>
87
+
88
+ <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
89
+ <block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>
90
+ <block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>
91
+
92
+ <block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
93
+ </block>
94
+ </reference>
95
+ <block type="core/text_list" name="additional.product.info" translate="label">
96
+ <label>Additional Product Info</label>
97
+ </block>
98
+ </checkout_cart_index>
99
+
100
+ <checkout_cart_configure translate="label">
101
+ <label>Configure Cart Item</label>
102
+ <update handle="catalog_product_view"/>
103
+ <reference name="product.info">
104
+ <block type="checkout/cart_item_configure" name="checkout.cart.item.configure.block"></block>
105
+ </reference>
106
+ </checkout_cart_configure>
107
+
108
+ <!--
109
+ Multi address shipping checkout main layout,
110
+ will be rendered on all checkout pages
111
+ -->
112
+
113
+ <checkout_multishipping translate="label">
114
+ <label>Multishipping Checkout</label>
115
+ <!-- Mage_Checkout -->
116
+ <remove name="right"/>
117
+ <remove name="left"/>
118
+
119
+ <reference name="root">
120
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
121
+ </reference>
122
+ <reference name="content">
123
+ <block type="checkout/multishipping_state" name="checkout_state" template="checkout/multishipping/state.phtml"/>
124
+ </reference>
125
+ </checkout_multishipping>
126
+
127
+ <checkout_multishipping_login>
128
+ <update handle="customer_account_login"/>
129
+ </checkout_multishipping_login>
130
+
131
+ <checkout_multishipping_register>
132
+ <update handle="customer_account_create"/>
133
+ </checkout_multishipping_register>
134
+
135
+ <!--
136
+ Multi address shipping checkout selection of address per item page
137
+ -->
138
+
139
+ <checkout_multishipping_address_select translate="label">
140
+ <label>Multishipping Checkout Shipping Address Selection</label>
141
+ <update handle="checkout_multishipping"/>
142
+ <!-- Mage_Checkout -->
143
+ <reference name="content">
144
+ <block type="checkout/multishipping_address_select" name="checkout_address_select" template="checkout/multishipping/address/select.phtml"/>
145
+ </reference>
146
+ </checkout_multishipping_address_select>
147
+
148
+ <checkout_multishipping_address_selectbilling translate="label">
149
+ <label>Multishipping Checkout Billing Address Selection</label>
150
+ <update handle="checkout_multishipping"/>
151
+ <!-- Mage_Checkout -->
152
+ <reference name="content">
153
+ <block type="checkout/multishipping_address_select" name="checkout_address_select" template="checkout/multishipping/address/select.phtml"/>
154
+ </reference>
155
+ </checkout_multishipping_address_selectbilling>
156
+
157
+
158
+ <checkout_multishipping_address_newshipping translate="label">
159
+ <label>Multishipping Checkout Shipping Address Creation</label>
160
+ <update handle="checkout_multishipping"/>
161
+ <update handle="checkout_multishipping_customer_address"/>
162
+ </checkout_multishipping_address_newshipping>
163
+
164
+ <checkout_multishipping_address_newbilling translate="label">
165
+ <label>Multishipping Checkout Billing Address Creation</label>
166
+ <update handle="checkout_multishipping"/>
167
+ <update handle="checkout_multishipping_customer_address"/>
168
+ </checkout_multishipping_address_newbilling>
169
+
170
+ <checkout_multishipping_address_editshipping translate="label">
171
+ <label>Multishipping Checkout Shipping Address Edit Form</label>
172
+ <update handle="checkout_multishipping"/>
173
+ <update handle="checkout_multishipping_customer_address"/>
174
+ </checkout_multishipping_address_editshipping>
175
+
176
+ <checkout_multishipping_address_editaddress>
177
+ <update handle="checkout_multishipping"/>
178
+ <update handle="checkout_multishipping_customer_address"/>
179
+ </checkout_multishipping_address_editaddress>
180
+
181
+ <checkout_multishipping_address_editbilling translate="label">
182
+ <label>Multishipping Checkout Billing Address Edit Form</label>
183
+ <update handle="checkout_multishipping"/>
184
+ <update handle="checkout_multishipping_customer_address"/>
185
+ </checkout_multishipping_address_editbilling>
186
+
187
+ <checkout_multishipping_customer_address translate="label">
188
+ <label>Multishipping Checkout Customer Address Edit Form</label>
189
+ <reference name="content">
190
+ <block type="customer/address_edit" name="customer_address_edit" template="customer/address/pca_edit.phtml"/>
191
+ </reference>
192
+ </checkout_multishipping_customer_address>
193
+
194
+ <!--
195
+ Multi address shipping checkout address page
196
+ -->
197
+
198
+ <checkout_multishipping_addresses translate="label">
199
+ <label>Multishipping Checkout Address (Any) Form</label>
200
+ <update handle="checkout_multishipping"/>
201
+ <!-- Mage_Checkout -->
202
+ <reference name="content">
203
+ <block type="checkout/multishipping_addresses" name="checkout_addresses" template="checkout/multishipping/addresses.phtml">
204
+ <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/multishipping/item/default.phtml</template></action>
205
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/multishipping/item/default.phtml</template></action>
206
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/multishipping/item/default.phtml</template></action>
207
+ </block>
208
+ </reference>
209
+ </checkout_multishipping_addresses>
210
+
211
+ <!--
212
+ Multi address shipping checkout shipping information
213
+ -->
214
+
215
+ <checkout_multishipping_shipping translate="label">
216
+ <label>Multishipping Checkout Shipping Information Step</label>
217
+ <update handle="checkout_multishipping"/>
218
+ <!-- Mage_Checkout -->
219
+ <reference name="content">
220
+ <block type="checkout/multishipping_shipping" name="checkout_shipping" template="checkout/multishipping/shipping.phtml">
221
+ <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/multishipping/item/default.phtml</template></action>
222
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/multishipping/item/default.phtml</template></action>
223
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/multishipping/item/default.phtml</template></action>
224
+
225
+ <block type="checkout/multishipping_billing_items" name="checkout_billing_items" template="checkout/multishipping/billing/items.phtml">
226
+ <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/multishipping/item/default.phtml</template></action>
227
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/multishipping/item/default.phtml</template></action>
228
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/multishipping/item/default.phtml</template></action>
229
+ </block>
230
+ </block>
231
+ </reference>
232
+ </checkout_multishipping_shipping>
233
+
234
+ <!--
235
+ Multi address shipping checkout billing information
236
+ -->
237
+
238
+ <checkout_multishipping_billing translate="label">
239
+ <label>Multishipping Checkout Billing Information Step</label>
240
+ <update handle="checkout_multishipping"/>
241
+ <!-- Mage_Checkout -->
242
+ <reference name="content">
243
+ <block type="checkout/multishipping_billing" name="checkout_billing" template="checkout/multishipping/billing.phtml">
244
+ <action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
245
+
246
+ <!--<block type="checkout/multishipping_billing_items" name="checkout_billing_items" template="checkout/multishipping/billing/items.phtml">
247
+ <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/multishipping/item/default.phtml</template></action>
248
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/multishipping/item/default.phtml</template></action>
249
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/multishipping/item/default.phtml</template></action>
250
+ </block>-->
251
+
252
+ </block>
253
+ </reference>
254
+ </checkout_multishipping_billing>
255
+
256
+ <!--
257
+ Multi address shipping checkout overview
258
+ -->
259
+
260
+ <checkout_multishipping_overview translate="label">
261
+ <label>Multishipping Checkout Overview</label>
262
+ <update handle="checkout_multishipping"/>
263
+ <!-- Mage_Checkout -->
264
+ <reference name="content">
265
+ <block type="checkout/multishipping_overview" name="checkout_overview" template="checkout/multishipping/overview.phtml">
266
+ <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/multishipping/item/default.phtml</template></action>
267
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/multishipping/item/default.phtml</template></action>
268
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/multishipping/item/default.phtml</template></action>
269
+ <action method="addRowItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/multishipping/overview/item.phtml</template></action>
270
+ <action method="addRowItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/multishipping/overview/item.phtml</template></action>
271
+ <block type="checkout/multishipping_payment_info" name="payment_info">
272
+ <action method="setInfoTemplate"><method></method><template></template></action>
273
+ </block>
274
+ <block type="checkout/agreements" name="checkout.multishipping.agreements" as="agreements" template="checkout/multishipping/agreements.phtml"/>
275
+ <block type="checkout/cart_totals" name="totals" />
276
+ <block type="core/text_list" name="checkout.multishipping.overview.items.after" as="items_after" translate="label">
277
+ <label>Overview Items After</label>
278
+ </block>
279
+ </block>
280
+ </reference>
281
+ </checkout_multishipping_overview>
282
+
283
+ <!--
284
+ Multi address shipping checkout success
285
+ -->
286
+
287
+ <checkout_multishipping_success translate="label">
288
+ <label>Multishipping Checkout Success</label>
289
+ <update handle="checkout_multishipping"/>
290
+ <!-- Mage_Checkout -->
291
+ <reference name="content">
292
+ <block type="checkout/multishipping_success" name="checkout_success" template="checkout/multishipping/success.phtml"/>
293
+ </reference>
294
+ </checkout_multishipping_success>
295
+
296
+ <!--
297
+ One page checkout main layout
298
+ -->
299
+
300
+ <checkout_onepage_index translate="label">
301
+ <label>One Page Checkout</label>
302
+ <!-- Mage_Checkout -->
303
+ <remove name="left"/>
304
+
305
+ <reference name="root">
306
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
307
+ </reference>
308
+ <reference name="right">
309
+ <action method="unsetChildren"></action>
310
+ <block type="page/html_wrapper" name="checkout.progress.wrapper" translate="label">
311
+ <label>Checkout Progress Wrapper</label>
312
+ <action method="setElementId"><value>checkout-progress-wrapper</value></action>
313
+ <block type="checkout/onepage_progress" name="checkout.progress" before="-" template="checkout/onepage/progress.phtml"/>
314
+ </block>
315
+ </reference>
316
+ <reference name="content">
317
+ <block type="checkout/onepage" name="checkout.onepage" template="checkout/onepage.phtml">
318
+ <block type="checkout/onepage_login" name="checkout.onepage.login" as="login" template="checkout/onepage/login.phtml">
319
+ <block type="page/html_wrapper" name="checkout.onepage.login.before" as="login_before" translate="label">
320
+ <label>Login/Registration Before</label>
321
+ <action method="setMayBeInvisible"><value>1</value></action>
322
+ </block>
323
+ </block>
324
+ <block type="checkout/onepage_billing" name="checkout.onepage.billing" as="billing" template="checkout/onepage/pca_billing.phtml"/>
325
+ <block type="checkout/onepage_shipping" name="checkout.onepage.shipping" as="shipping" template="checkout/onepage/pca_shipping.phtml"/>
326
+ <block type="checkout/onepage_shipping_method" name="checkout.onepage.shipping_method" as="shipping_method" template="checkout/onepage/shipping_method.phtml">
327
+ <block type="checkout/onepage_shipping_method_available" name="checkout.onepage.shipping_method.available" as="available" template="checkout/onepage/shipping_method/available.phtml"/>
328
+ <block type="checkout/onepage_shipping_method_additional" name="checkout.onepage.shipping_method.additional" as="additional" template="checkout/onepage/shipping_method/additional.phtml"/>
329
+ </block>
330
+ <block type="checkout/onepage_payment" name="checkout.onepage.payment" as="payment" template="checkout/onepage/payment.phtml">
331
+ <block type="checkout/onepage_payment_methods" name="checkout.payment.methods" as="methods" template="checkout/onepage/payment/methods.phtml">
332
+ <action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
333
+ </block>
334
+ </block>
335
+ <block type="checkout/onepage_review" name="checkout.onepage.review" as="review" template="checkout/onepage/review.phtml"/>
336
+ </block>
337
+ </reference>
338
+ </checkout_onepage_index>
339
+
340
+ <!--
341
+ One page checkout progress block
342
+ -->
343
+
344
+ <checkout_onepage_progress>
345
+ <!-- Mage_Checkout -->
346
+ <remove name="right"/>
347
+ <remove name="left"/>
348
+
349
+ <block type="checkout/onepage_progress" name="root" output="toHtml" template="checkout/onepage/progress.phtml">
350
+ <block type="checkout/onepage_payment_info" name="payment_info">
351
+ <action method="setInfoTemplate"><method></method><template></template></action>
352
+ </block>
353
+ </block>
354
+ </checkout_onepage_progress>
355
+
356
+ <!--
357
+ One page checkout payment methods block
358
+ -->
359
+ <checkout_onepage_paymentmethod>
360
+ <remove name="right"/>
361
+ <remove name="left"/>
362
+
363
+ <block type="checkout/onepage_payment_methods" name="root" output="toHtml" template="checkout/onepage/payment/methods.phtml">
364
+ <action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
365
+ </block>
366
+ </checkout_onepage_paymentmethod>
367
+
368
+
369
+ <!--
370
+ One page checkout shipping methods block
371
+ -->
372
+
373
+ <checkout_onepage_shippingmethod>
374
+ <!-- Mage_Checkout -->
375
+ <remove name="right"/>
376
+ <remove name="left"/>
377
+
378
+ <block type="checkout/onepage_shipping_method_available" name="root" output="toHtml" template="checkout/onepage/shipping_method/available.phtml"/>
379
+ </checkout_onepage_shippingmethod>
380
+
381
+ <checkout_onepage_additional>
382
+ <!-- Mage_Checkout -->
383
+ <remove name="right"/>
384
+ <remove name="left"/>
385
+
386
+ <block type="checkout/onepage_shipping_method_additional" name="root" output="toHtml" template="checkout/onepage/shipping_method/additional.phtml">
387
+ <action method="setDontDisplayContainer"><param>1</param></action>
388
+ </block>
389
+ </checkout_onepage_additional>
390
+
391
+ <!--
392
+ One page checkout order review block
393
+ -->
394
+
395
+ <checkout_onepage_review translate="label">
396
+ <label>One Page Checkout Overview</label>
397
+ <!-- Mage_Checkout -->
398
+ <remove name="right"/>
399
+ <remove name="left"/>
400
+
401
+ <block type="checkout/onepage_review_info" name="root" output="toHtml" template="checkout/onepage/review/info.phtml">
402
+ <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/onepage/review/item.phtml</template></action>
403
+ <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/onepage/review/item.phtml</template></action>
404
+ <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/onepage/review/item.phtml</template></action>
405
+ <block type="checkout/cart_totals" name="checkout.onepage.review.info.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
406
+ <block type="core/text_list" name="checkout.onepage.review.info.items.before" as="items_before" translate="label">
407
+ <label>Items Before</label>
408
+ </block>
409
+ <block type="core/text_list" name="checkout.onepage.review.info.items.after" as="items_after" translate="label">
410
+ <label>Items After</label>
411
+ </block>
412
+ <block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>
413
+ <block type="core/template" name="checkout.onepage.review.button" as="button" template="checkout/onepage/review/button.phtml"/>
414
+ </block>
415
+ </checkout_onepage_review>
416
+
417
+ <checkout_onepage_success translate="label">
418
+ <label>One Page Checkout Success</label>
419
+ <reference name="root">
420
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
421
+ </reference>
422
+ <reference name="content">
423
+ <block type="checkout/onepage_success" name="checkout.success" template="checkout/success.phtml"/>
424
+ </reference>
425
+ </checkout_onepage_success>
426
+ <checkout_onepage_failure translate="label">
427
+ <label>One Page Checkout Failure</label>
428
+ <reference name="root">
429
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
430
+ </reference>
431
+ <reference name="content">
432
+ <block type="checkout/onepage_failure" name="checkout.failure" template="checkout/onepage/failure.phtml"/>
433
+ </reference>
434
+ </checkout_onepage_failure>
435
+ <block type="core/list" name="additional.product.info"/>
436
+ </layout>
app/design/frontend/default/default/layout/PCAPersistent.xml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Academic Free License (AFL 3.0)
9
+ * that is bundled with this package in the file LICENSE_AFL.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/afl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * DISCLAIMER
17
+ *
18
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
19
+ * versions in the future. If you wish to customize Magento for your
20
+ * needs please refer to http://www.magentocommerce.com for more information.
21
+ *
22
+ * @category design
23
+ * @package base_default
24
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
25
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
26
+ */
27
+
28
+ -->
29
+ <layout version="0.1.0">
30
+ <customer_account_login>
31
+ <reference name="customer_form_login">
32
+ <action method="setTemplate"><template>persistent/customer/form/login.phtml</template></action>
33
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
34
+ <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
35
+ </reference>
36
+ </customer_account_login>
37
+
38
+ <customer_account_create>
39
+ <reference name="customer_form_register">
40
+ <action method="setTemplate"><template>persistent/customer/form/pca_register.phtml</template></action>
41
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
42
+ <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
43
+ </reference>
44
+ </customer_account_create>
45
+
46
+ <checkout_onepage_index>
47
+ <reference name="checkout.onepage.login">
48
+ <action method="setTemplate"><template>persistent/checkout/onepage/login.phtml</template></action>
49
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
50
+ </reference>
51
+ <reference name="checkout.onepage.billing">
52
+ <action method="setTemplate"><template>persistent/checkout/onepage/pca_billing.phtml</template></action>
53
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
54
+ <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
55
+ </reference>
56
+ </checkout_onepage_index>
57
+ <customer_logged_out>
58
+ <reference name="right">
59
+ <block type="sales/reorder_sidebar" name="sale.reorder.sidebar" as="reorder" template="sales/reorder/sidebar.phtml"/>
60
+ </reference>
61
+ </customer_logged_out>
62
+ </layout>
app/design/frontend/default/default/template/checkout/onepage/pca_billing.phtml ADDED
@@ -0,0 +1,307 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.js" ></script>
29
+ <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.css" type="text/css" media="all"/>
30
+
31
+ <style type="text/css">
32
+ label { font:bold 9pt arial;color:#455f70; }
33
+ table { margin:15px;padding:15px;background-color:#ddeffd;border-radius:5px;border:solid 1px #98b4c9; }
34
+ #billing:postcode {width:150px;}
35
+ </style>
36
+
37
+
38
+
39
+
40
+ <form id="co-billing-form" action="">
41
+ <fieldset>
42
+ <ul class="form-list">
43
+ <?php if ($this->customerHasAddresses()): ?>
44
+
45
+
46
+ <li class="wide">
47
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
48
+ <div class="input-box">
49
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
50
+ </div>
51
+ </li>
52
+ <?php endif; ?>
53
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
54
+ <fieldset>
55
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
56
+ <ul>
57
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
58
+ <li class="fields">
59
+ <div class="field">
60
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
61
+ <div class="input-box">
62
+ <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" />
63
+ </div>
64
+ </div>
65
+ <?php if(!$this->isCustomerLoggedIn()): ?>
66
+ <div class="field">
67
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
68
+ <div class="input-box">
69
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
70
+ </div>
71
+ </div> <br /><br /><br />
72
+ <?php endif ?>
73
+ </li> <li class="fields">
74
+ <div class="field">
75
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
76
+ <div class="input-box">
77
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
78
+ </div>
79
+ </div>
80
+ </li>
81
+
82
+
83
+ <li class="fields">
84
+ <div class="field">
85
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
86
+ <div class="input-box">
87
+ <input type="text" style="width: 150px" title=""<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" />
88
+ </div>
89
+ <li class="wide">
90
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
91
+ <div class="input-box">
92
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" />
93
+ </div>
94
+ </li>
95
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
96
+ <li class="wide">
97
+ <div class="input-box">
98
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" />
99
+ </div>
100
+ </li>
101
+ <?php endfor ?>
102
+ <li class="fields">
103
+ <div class="field">
104
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
105
+ <div class="input-box">
106
+ <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="input-text required-entry" id="billing:city" />
107
+ </div>
108
+ </div>
109
+ <div class="field">
110
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
111
+ <div class="input-box">
112
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
113
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
114
+ </select>
115
+ <script type="text/javascript">
116
+ //<![CDATA[
117
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
118
+ //]]>
119
+ </script>
120
+ <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;" />
121
+ </div>
122
+ </div>
123
+ </li>
124
+
125
+
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->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" 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->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" 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
+ </ul>
189
+ </fieldset>
190
+ </li>
191
+ <?php if ($this->canShip()): ?>
192
+ <li class="control">
193
+ <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>
194
+ <li class="control">
195
+ <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>
196
+ </li>
197
+ <?php endif; ?>
198
+ </ul>
199
+ <?php if (!$this->canShip()): ?>
200
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
201
+ <?php endif; ?>
202
+ <div class="buttons-set" id="billing-buttons-container">
203
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
204
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
205
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
206
+ <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...') ?>
207
+ </span>
208
+ </div>
209
+ </fieldset>
210
+ </form>
211
+ <script type="text/javascript">
212
+ //<![CDATA[
213
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
214
+ var billingForm = new VarienForm('co-billing-form');
215
+
216
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
217
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
218
+
219
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions, undefined, 'billing:postcode');
220
+ //]]>
221
+ </script>
222
+
223
+
224
+
225
+ <script type="text/javascript">
226
+
227
+ document.getElementById("billing:postcode").parentNode.appendChild(new pca.Button("Find", search).element);
228
+
229
+ var RoyalMail_Data = true;
230
+
231
+ if(<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_rmdata',Mage::app()->getStore()); ?> == 0)
232
+ {
233
+ RoyalMail_Data = false;
234
+ }
235
+
236
+
237
+
238
+ var _fieldList = [
239
+ { element: "billing:company", field: "Company" },
240
+ { element: "billing:street1", field: "Line1" },
241
+ { element: "billing:street2", field: "Line2" },
242
+ { element: "billing:city", field: "City" },
243
+ { element: "billing:region_id", field: "STATENAME" },
244
+ { element: "billing:region", field: "State" },
245
+ { element: "billing:postcode", field: "PostalCode" },
246
+ { element: "billing:country_id", field: "Country" }
247
+ ],
248
+ _options = {
249
+ key: '<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_key',Mage::app()->getStore()); ?>',
250
+ dataSourceOptions: { international: true, royalMail: RoyalMail_Data, usps: true }
251
+ };
252
+ _control = new pca.Address(_fieldList, _options);
253
+
254
+ function search() {
255
+ var _line1 = pca.getValue("billing:street1"),
256
+ _city = pca.getValue("billing:city"),
257
+ _state = pca.getValue("billing:region_id"),
258
+ _locality = _city + (_city && _state ? "," : "") + _state,
259
+ _postcode = pca.getValue("billing:postcode"),
260
+ _country = pca.getValue("billing:country_id");
261
+
262
+ _control.search(_line1, _locality, _postcode, _country);
263
+ }
264
+
265
+ function clearFields() {
266
+ _control.clear();
267
+ }
268
+
269
+
270
+
271
+ var _stateData = {
272
+ "USA": { "AL": "Alabama", "AK": "Alaska", "AZ": "Arizona", "AR": "Arkansas",
273
+ "CA": "California", "CO": "Colorado", "CT": "Connecticut", "DE": "Delaware",
274
+ "DC": "District Of Columbia", "FL": "Florida", "GA": "Georgia", "HI": "Hawaii",
275
+ "ID": "Idaho", "IL": "Illinois", "IN": "Indiana", "IA": "Iowa", "KS": "Kansas",
276
+ "KY": "Kentucky", "LA": "Louisiana", "ME": "Maine", "MD": "Maryland",
277
+ "MA": "Massachusetts", "MI": "Michigan", "MN": "Minnesota", "MS": "Mississippi",
278
+ "MO": "Missouri", "MT": "Montana", "NE": "Nebraska", "NV": "Nevada",
279
+ "NH": "New Hampshire", "NJ": "New Jersey", "NM": "New Mexico", "NY": "New York",
280
+ "NC": "North Carolina", "ND": "North Dakota", "OH": "Ohio", "OK": "Oklahoma",
281
+ "OR": "Oregon", "PA": "Pennsylvania", "PR": "Puerto Rico", "RI": "Rhode Island",
282
+ "SC": "South Carolina", "SD": "South Dakota", "TN": "Tennessee", "TX": "Texas",
283
+ "UT": "Utah", "VT": "Vermont", "VI": "Virgin Islands", "VA": "Virginia",
284
+ "WA": "Washington", "WV": "West Virginia", "WI": "Wisconsin", "WY": "Wyoming"
285
+ },
286
+ "CAN": { "AB": "Alberta", "BC": "British Columbia", "MB": "Alabama", "NL": "Newfoundland and Labrador",
287
+ "NB": "New Brunswick", "NS": "Nova Scotia", "NT": "Northwest Territories", "NU": "Nunavut",
288
+ "ON": "Ontario", "PE": "Prince Edward Island", "QC": "Quebec", "SK": "Saskatchewan",
289
+ "YT": "Yukon Territory"
290
+ }
291
+ };
292
+
293
+
294
+
295
+ _control.listen("select", function (address) {
296
+ if (address.State)
297
+ address.State = ((_stateData[address.CountryCode] || {})[address.State] || address.State);
298
+ pca.setValue("billing:region_id", address.State);
299
+
300
+ });
301
+
302
+
303
+ _control.listen("error", function (error) { alert(error) });
304
+
305
+
306
+
307
+ </script>
app/design/frontend/default/default/template/checkout/onepage/pca_shipping.phtml ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.js" ></script>
28
+ <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.css" type="text/css" media="all"/>
29
+
30
+ <style type="text/css">
31
+ label { font:bold 9pt arial;color:#455f70; }
32
+ table { margin:15px;padding:15px;background-color:#ddeffd;border-radius:5px;border:solid 1px #98b4c9; }
33
+ #shipping:postcode {width:150px;}
34
+ </style>
35
+
36
+
37
+ <form action="" id="co-shipping-form">
38
+ <ul class="form-list">
39
+ <?php if ($this->customerHasAddresses()): ?>
40
+ <li class="wide">
41
+ <label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
42
+ <div class="input-box">
43
+ <?php echo $this->getAddressesHtmlSelect('shipping') ?>
44
+ </div>
45
+ </li>
46
+ <?php endif ?>
47
+ <li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
48
+ <fieldset>
49
+ <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
50
+ <ul>
51
+ <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>
52
+ <li class="fields">
53
+ <div class="fields">
54
+ <label for="shipping:company"><?php echo $this->__('Company') ?></label>
55
+ <div class="input-box">
56
+ <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);" />
57
+ </div>
58
+ </div>
59
+ <?php if(false): ?>
60
+ <div class="fields">
61
+ <label for="shipping:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
62
+ <div class="input-box">
63
+ <input type="text" name="shipping[email]" id="shipping:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
64
+ </div>
65
+ </div>
66
+ <?php endif ?>
67
+ </li> <li class="fields">
68
+ <div class="field">
69
+ <label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
70
+ <div class="input-box">
71
+ <?php echo $this->getCountryHtmlSelect('shipping') ?>
72
+ </div>
73
+ </div>
74
+ </li>
75
+ <li class="fields">
76
+ <div class="field">
77
+ <label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
78
+ <div class="input-box">
79
+ <input type="text" style="width: 150px" title=""<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" onchange="shipping.setSameAsBilling(false);" />
80
+ </div></div>
81
+ <li class="wide">
82
+ <label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
83
+ <div class="input-box">
84
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" onchange="shipping.setSameAsBilling(false);" />
85
+ </div>
86
+ </li>
87
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
88
+ <li class="wide">
89
+ <div class="input-box">
90
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" onchange="shipping.setSameAsBilling(false);" />
91
+ </div>
92
+ </li>
93
+ <?php endfor ?>
94
+ <li class="fields">
95
+ <div class="field">
96
+ <label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
97
+ <div class="input-box">
98
+ <input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="input-text required-entry" id="shipping:city" onchange="shipping.setSameAsBilling(false);" />
99
+ </div>
100
+ </div>
101
+ <div class="field">
102
+ <label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
103
+ <div class="input-box">
104
+ <select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
105
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
106
+ </select>
107
+ <script type="text/javascript">
108
+ //<![CDATA[
109
+ $('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
110
+ //]]>
111
+ </script>
112
+ <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;" />
113
+ </div>
114
+ </div>
115
+ </li>
116
+ <li class="fields">
117
+ <div class="field">
118
+ <label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
119
+ <div class="input-box">
120
+ <input type="text" name="shipping[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
121
+ </div>
122
+ </div>
123
+ <div class="field">
124
+ <label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
125
+ <div class="input-box">
126
+ <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);" />
127
+ </div>
128
+ </div>
129
+ </li>
130
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
131
+ <li class="control">
132
+ <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>
133
+ <?php else:?>
134
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
135
+ <?php endif;?>
136
+ </ul>
137
+ </fieldset>
138
+ </li>
139
+ <li class="control">
140
+ <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>
141
+ </li>
142
+ </ul>
143
+ <div class="buttons-set" id="shipping-buttons-container">
144
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
145
+ <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
146
+ <button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipping.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
147
+ <span id="shipping-please-wait" class="please-wait" style="display:none;">
148
+ <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...') ?>
149
+ </span>
150
+ </div>
151
+ </form>
152
+ <script type="text/javascript">
153
+ //<![CDATA[
154
+ var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
155
+ '<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
156
+ var shippingForm = new VarienForm('co-shipping-form');
157
+ shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
158
+ //shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
159
+ $('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
160
+
161
+ var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', countryRegions, undefined, 'shipping:postcode');
162
+ //]]>
163
+ </script>
164
+
165
+
166
+ <script type="text/javascript">
167
+
168
+ document.getElementById("shipping:postcode").parentNode.appendChild(new pca.Button("Find", shippingsearch).element);
169
+
170
+ var RoyalMail_Data = true;
171
+
172
+ if(<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_rmdata',Mage::app()->getStore()); ?> == 0)
173
+ {
174
+ RoyalMail_Data = false;
175
+ }
176
+
177
+
178
+
179
+ var _shippingfieldList = [
180
+ { element: "shipping:company", field: "Company" },
181
+ { element: "shipping:street1", field: "Line1" },
182
+ { element: "shipping:street2", field: "Line2" },
183
+ { element: "shipping:city", field: "City" },
184
+ { element: "shipping:region_id", field: "STATENAME" },
185
+ { element: "shipping:region", field: "State" },
186
+ { element: "shipping:postcode", field: "PostalCode" },
187
+ { element: "shipping:country_id", field: "Country" }
188
+ ],
189
+ _shippingoptions = {
190
+ key: '<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_key',Mage::app()->getStore()); ?>',
191
+ dataSourceOptions: { international: true, royalMail: RoyalMail_Data, usps: true }
192
+ };
193
+ _shippingcontrol = new pca.Address(_shippingfieldList, _shippingoptions);
194
+
195
+ function shippingsearch() {
196
+ var _shippingline1 = pca.getValue("shipping:street1"),
197
+ _shippingcity = pca.getValue("shipping:city"),
198
+ _shippingstate = pca.getValue("shipping:region_id"),
199
+ _shippinglocality = _shippingcity + (_shippingcity && _shippingstate ? "," : "") + _shippingstate,
200
+ _shippingpostcode = pca.getValue("shipping:postcode"),
201
+ _shippingcountry = pca.getValue("shipping:country_id");
202
+
203
+ _shippingcontrol.search(_shippingline1, _shippinglocality, _shippingpostcode, _shippingcountry);
204
+ }
205
+
206
+ function clearFields() {
207
+ _shippingcontrol.clear();
208
+ }
209
+
210
+
211
+
212
+
213
+ var _stateData = {
214
+ "USA": { "AL": "Alabama", "AK": "Alaska", "AZ": "Arizona", "AR": "Arkansas",
215
+ "CA": "California", "CO": "Colorado", "CT": "Connecticut", "DE": "Delaware",
216
+ "DC": "District Of Columbia", "FL": "Florida", "GA": "Georgia", "HI": "Hawaii",
217
+ "ID": "Idaho", "IL": "Illinois", "IN": "Indiana", "IA": "Iowa", "KS": "Kansas",
218
+ "KY": "Kentucky", "LA": "Louisiana", "ME": "Maine", "MD": "Maryland",
219
+ "MA": "Massachusetts", "MI": "Michigan", "MN": "Minnesota", "MS": "Mississippi",
220
+ "MO": "Missouri", "MT": "Montana", "NE": "Nebraska", "NV": "Nevada",
221
+ "NH": "New Hampshire", "NJ": "New Jersey", "NM": "New Mexico", "NY": "New York",
222
+ "NC": "North Carolina", "ND": "North Dakota", "OH": "Ohio", "OK": "Oklahoma",
223
+ "OR": "Oregon", "PA": "Pennsylvania", "PR": "Puerto Rico", "RI": "Rhode Island",
224
+ "SC": "South Carolina", "SD": "South Dakota", "TN": "Tennessee", "TX": "Texas",
225
+ "UT": "Utah", "VT": "Vermont", "VI": "Virgin Islands", "VA": "Virginia",
226
+ "WA": "Washington", "WV": "West Virginia", "WI": "Wisconsin", "WY": "Wyoming"
227
+ },
228
+ "CAN": { "AB": "Alberta", "BC": "British Columbia", "MB": "Alabama", "NL": "Newfoundland and Labrador",
229
+ "NB": "New Brunswick", "NS": "Nova Scotia", "NT": "Northwest Territories", "NU": "Nunavut",
230
+ "ON": "Ontario", "PE": "Prince Edward Island", "QC": "Quebec", "SK": "Saskatchewan",
231
+ "YT": "Yukon Territory"
232
+ }
233
+ };
234
+
235
+
236
+
237
+ _shippingcontrol.listen("select", function (address) {
238
+ if (address.State)
239
+ address.State = ((_stateData[address.CountryCode] || {})[address.State] || address.State);
240
+ pca.setValue("shipping:region_id", address.State);
241
+
242
+ });
243
+
244
+
245
+ _shippingcontrol.listen("error", function (error) { alert(error) });
246
+
247
+
248
+
249
+ </script>
app/design/frontend/default/default/template/customer/address/pca_edit.phtml ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2011 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
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.js" ></script>
28
+ <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.css" type="text/css" media="all"/>
29
+
30
+ <style type="text/css">
31
+ label { font:bold 9pt arial;color:#455f70; }
32
+ table { margin:15px;padding:15px;background-color:#ddeffd;border-radius:5px;border:solid 1px #98b4c9; }
33
+ #zip {width:150px;}
34
+ </style>
35
+
36
+
37
+
38
+
39
+ <?php
40
+ /**
41
+ * Edit customer address template
42
+ *
43
+ * @see Mage_Customer_Block_Address_Edit
44
+ */
45
+ ?>
46
+ <?php if($this->getTitle()): ?>
47
+ <div class="page-title">
48
+ <h1><?php echo $this->getTitle() ?></h1>
49
+ </div>
50
+ <?php endif; ?>
51
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
52
+ <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate">
53
+ <div class="fieldset">
54
+ <?php echo $this->getBlockHtml('formkey')?>
55
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
56
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
57
+ <h2 class="legend"><?php echo $this->__('Contact Information') ?></h2>
58
+ <ul class="form-list">
59
+ <li class="fields">
60
+ <?php echo $this->getNameBlockHtml() ?>
61
+ </li>
62
+ <li class="wide">
63
+ <label for="company"><?php echo $this->__('Company') ?></label>
64
+ <div class="input-box">
65
+ <input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" class="input-text" />
66
+ </div>
67
+ </li>
68
+ <li class="fields">
69
+ <div class="field">
70
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
71
+ <div class="input-box">
72
+ <input type="text" name="telephone" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="telephone" />
73
+ </div>
74
+ </div>
75
+ <div class="field">
76
+ <label for="fax"><?php echo $this->__('Fax') ?></label>
77
+ <div class="input-box">
78
+ <input type="text" name="fax" id="fax" title="<?php echo $this->__('Fax') ?>" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" class="input-text" />
79
+ </div>
80
+ </div>
81
+ </li>
82
+ </ul>
83
+ </div>
84
+ <div class="fieldset">
85
+ <h2 class="legend"><?php echo $this->__('Address') ?></h2>
86
+ <ul class="form-list">
87
+ <li class="fields">
88
+ <div class="field">
89
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
90
+ <div class="input-box">
91
+ <?php echo $this->getCountryHtmlSelect() ?>
92
+ </div>
93
+ </div>
94
+ </li>
95
+ <li class="fields">
96
+ <div class="field">
97
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
98
+ <div class="input-box">
99
+ <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
100
+ </div>
101
+ </div>
102
+ </li>
103
+
104
+
105
+
106
+
107
+ <li class="wide">
108
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
109
+ <div class="input-box">
110
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
111
+ </div>
112
+ </li>
113
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
114
+ <li class="wide">
115
+ <div class="input-box">
116
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
117
+ </div>
118
+ </li>
119
+ <?php endfor ?>
120
+ <li class="fields">
121
+ <div class="field">
122
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
123
+ <div class="input-box">
124
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
125
+ </div>
126
+ </div>
127
+ <div class="field">
128
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
129
+ <div class="input-box">
130
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
131
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
132
+ </select>
133
+ <script type="text/javascript">
134
+ //<![CDATA[
135
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
136
+ //]]>
137
+ </script>
138
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" />
139
+ </div>
140
+ </div>
141
+ </li>
142
+
143
+ <li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
144
+ <?php if($this->isDefaultBilling()): ?>
145
+ <strong><?php echo $this->__('Default Billing Address') ?></strong>
146
+ <?php elseif($this->canSetAsDefaultBilling()): ?>
147
+ <input type="checkbox" id="primary_billing" name="default_billing" value="1" title="<?php echo $this->__('Use as My Default Billing Address') ?>" class="checkbox" /><label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
148
+ <?php else: ?>
149
+ <input type="hidden" name="default_billing" value="1" />
150
+ <?php endif; ?>
151
+ </li>
152
+ <li<?php if($this->canSetAsDefaultShipping()) echo ' class="control"' ?>>
153
+ <?php if($this->isDefaultShipping()): ?>
154
+ <strong><?php echo $this->__('Default Shipping Address') ?></strong>
155
+ <?php elseif($this->canSetAsDefaultShipping()): ?>
156
+ <input type="checkbox" id="primary_shipping" name="default_shipping" value="1" title="<?php echo $this->__('Use as My Default Shipping Address') ?>" class="checkbox" /><label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
157
+ <?php else: ?>
158
+ <input type="hidden" name="default_shipping" value="1" />
159
+ <?php endif; ?>
160
+ </li>
161
+ </ul>
162
+ </div>
163
+ <div class="buttons-set">
164
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
165
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
166
+ <button type="submit" title="<?php echo $this->__('Save Address') ?>" class="button"><span><span><?php echo $this->__('Save Address') ?></span></span></button>
167
+ </div>
168
+ </form>
169
+ <script type="text/javascript">
170
+ //<![CDATA[
171
+ var dataForm = new VarienForm('form-validate', true);
172
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
173
+ //]]>
174
+ </script>
175
+
176
+ <script type="text/javascript">
177
+
178
+ //document.getElementById("zip").parentNode.appendChild(pca.create("button", { value:"Find", className: "button", onclick: search }));
179
+
180
+ document.getElementById("zip").parentNode.appendChild(new pca.Button("Find", search).element);
181
+
182
+ var RoyalMail_Data = true;
183
+
184
+ if(<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_rmdata',Mage::app()->getStore()); ?> == 0)
185
+ {
186
+ RoyalMail_Data = false;
187
+ }
188
+
189
+
190
+
191
+ var _fieldList = [
192
+ { element: "company", field: "Company" },
193
+ { element: "street_1", field: "Line1" },
194
+ { element: "street_2", field: "Line2" },
195
+ { element: "city", field: "City" },
196
+ { element: "region_id", field: "STATENAME" },
197
+ { element: "region", field: "State" },
198
+ { element: "zip", field: "PostalCode" },
199
+ { element: "country", field: "Country" }
200
+ ],
201
+ _options = {
202
+ key: '<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_key',Mage::app()->getStore()); ?>',
203
+ dataSourceOptions: { international: true, royalMail: RoyalMail_Data, usps: true }
204
+ };
205
+ _control = new pca.Address(_fieldList, _options);
206
+
207
+ function search() {
208
+ var _line1 = pca.getValue("street_1"),
209
+ _city = pca.getValue("city"),
210
+ _state = pca.getValue("region_id"),
211
+ _locality = _city + (_city && _state ? "," : "") + _state,
212
+ _postcode = pca.getValue("zip"),
213
+ _country = pca.getValue("country");
214
+
215
+ _control.search(_line1, _locality, _postcode, _country);
216
+ }
217
+
218
+ function clearFields() {
219
+ _control.clear();
220
+ }
221
+
222
+
223
+
224
+ var _stateData = {
225
+ "USA": { "AL": "Alabama", "AK": "Alaska", "AZ": "Arizona", "AR": "Arkansas",
226
+ "CA": "California", "CO": "Colorado", "CT": "Connecticut", "DE": "Delaware",
227
+ "DC": "District Of Columbia", "FL": "Florida", "GA": "Georgia", "HI": "Hawaii",
228
+ "ID": "Idaho", "IL": "Illinois", "IN": "Indiana", "IA": "Iowa", "KS": "Kansas",
229
+ "KY": "Kentucky", "LA": "Louisiana", "ME": "Maine", "MD": "Maryland",
230
+ "MA": "Massachusetts", "MI": "Michigan", "MN": "Minnesota", "MS": "Mississippi",
231
+ "MO": "Missouri", "MT": "Montana", "NE": "Nebraska", "NV": "Nevada",
232
+ "NH": "New Hampshire", "NJ": "New Jersey", "NM": "New Mexico", "NY": "New York",
233
+ "NC": "North Carolina", "ND": "North Dakota", "OH": "Ohio", "OK": "Oklahoma",
234
+ "OR": "Oregon", "PA": "Pennsylvania", "PR": "Puerto Rico", "RI": "Rhode Island",
235
+ "SC": "South Carolina", "SD": "South Dakota", "TN": "Tennessee", "TX": "Texas",
236
+ "UT": "Utah", "VT": "Vermont", "VI": "Virgin Islands", "VA": "Virginia",
237
+ "WA": "Washington", "WV": "West Virginia", "WI": "Wisconsin", "WY": "Wyoming"
238
+ },
239
+ "CAN": { "AB": "Alberta", "BC": "British Columbia", "MB": "Alabama", "NL": "Newfoundland and Labrador",
240
+ "NB": "New Brunswick", "NS": "Nova Scotia", "NT": "Northwest Territories", "NU": "Nunavut",
241
+ "ON": "Ontario", "PE": "Prince Edward Island", "QC": "Quebec", "SK": "Saskatchewan",
242
+ "YT": "Yukon Territory"
243
+ }
244
+ };
245
+
246
+
247
+
248
+ _control.listen("select", function (address) {
249
+ if (address.State)
250
+ address.State = ((_stateData[address.CountryCode] || {})[address.State] || address.State);
251
+ pca.setValue("region_id", address.State);
252
+
253
+ });
254
+
255
+
256
+ _control.listen("error", function (error) { alert(error) });
257
+
258
+
259
+
260
+ </script>
app/design/frontend/default/default/template/customer/address/pca_register.phtml ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.js" ></script>
28
+ <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.css" type="text/css" media="all"/>
29
+
30
+ <style type="text/css">
31
+ label { font:bold 9pt arial;color:#455f70; }
32
+ table { margin:15px;padding:15px;background-color:#ddeffd;border-radius:5px;border:solid 1px #98b4c9; }
33
+ #zip {width:150px;}
34
+ </style>
35
+
36
+ <?php
37
+ /**
38
+ * Create account form template
39
+ *
40
+ * @see Mage_Customer_Block_Form_Register
41
+ */
42
+ ?>
43
+ <div class="account-create">
44
+ <div class="page-title">
45
+ <h1><?php echo $this->__('Create an Account') ?></h1>
46
+ </div>
47
+ <?php echo $this->getChildHtml('form_fields_before')?>
48
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
49
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
50
+ <div class="fieldset">
51
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
52
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
53
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
54
+ <ul class="form-list">
55
+ <li class="fields">
56
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
57
+ </li>
58
+ <li>
59
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
60
+ <div class="input-box">
61
+ <input type="text" name="email" id="email_address" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
62
+ </div>
63
+ </li> <li>
64
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
65
+ <div class="input-box">
66
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->htmlEscape($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" />
67
+ </div>
68
+ </li>
69
+ <?php if ($this->isNewsletterEnabled()): ?>
70
+ <li class="control">
71
+ <div class="input-box">
72
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
73
+ </div>
74
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
75
+ </li>
76
+ <?php endif ?>
77
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
78
+ <?php if ($_dob->isEnabled()): ?>
79
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
80
+ <?php endif ?>
81
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
82
+ <?php if ($_taxvat->isEnabled()): ?>
83
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
84
+ <?php endif ?>
85
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
86
+ <?php if ($_gender->isEnabled()): ?>
87
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
88
+ <?php endif ?>
89
+ </ul>
90
+ </div>
91
+ <?php if($this->getShowAddressFields()): ?>
92
+ <div class="fieldset">
93
+ <input type="hidden" name="create_address" value="1" />
94
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
95
+ <ul class="form-list">
96
+ <li class="fields"><div class="field">
97
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
98
+ <div class="input-box">
99
+ <?php echo $this->getCountryHtmlSelect() ?>
100
+ </div>
101
+ </div> </li> <li>
102
+ <div class="field">
103
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
104
+ <div class="input-box">
105
+ <input type="text" name="postcode" style="width:200px;" value="<?php echo $this->htmlEscape($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
106
+ </div>
107
+ </div>
108
+ </li>
109
+ <li class="fields">
110
+ <div class="field">
111
+ <label for="company"><?php echo $this->__('Company') ?></label>
112
+ <div class="input-box">
113
+ <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
114
+ </div>
115
+ </div>
116
+
117
+ </li>
118
+ <li class="wide">
119
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
120
+ <div class="input-box">
121
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
122
+ </div>
123
+ </li>
124
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
125
+ <li class="wide">
126
+ <div class="input-box">
127
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
128
+ </div>
129
+ </li>
130
+ <?php endfor ?>
131
+ <li class="fields">
132
+ <div class="field">
133
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
134
+ <div class="input-box">
135
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
136
+ </div>
137
+ </div>
138
+ <div class="field">
139
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
140
+ <div class="input-box">
141
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
142
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
143
+ </select>
144
+ <script type="text/javascript">
145
+ //<![CDATA[
146
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
147
+ //]]>
148
+ </script>
149
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
150
+ </div>
151
+ </div>
152
+ </li>
153
+ </ul>
154
+ <input type="hidden" name="default_billing" value="1" />
155
+ <input type="hidden" name="default_shipping" value="1" />
156
+ </div>
157
+ <?php endif; ?>
158
+ <div class="fieldset">
159
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
160
+ <ul class="form-list">
161
+ <li class="fields">
162
+ <div class="field">
163
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
164
+ <div class="input-box">
165
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
166
+ </div>
167
+ </div>
168
+ <div class="field">
169
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
170
+ <div class="input-box">
171
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
172
+ </div>
173
+ </div>
174
+ </li>
175
+ </ul>
176
+ </div>
177
+ <div class="buttons-set">
178
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
179
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
180
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
181
+ </div>
182
+ </form>
183
+ <script type="text/javascript">
184
+ //<![CDATA[
185
+ var dataForm = new VarienForm('form-validate', true);
186
+ <?php if($this->getShowAddressFields()): ?>
187
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
188
+ <?php endif; ?>
189
+ //]]>
190
+
191
+
192
+ document.getElementById("zip").parentNode.appendChild(new pca.Button("Find", search).element);
193
+
194
+ var RoyalMail_Data = true;
195
+
196
+ if(<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_rmdata',Mage::app()->getStore()); ?> == 0)
197
+ {
198
+ RoyalMail_Data = false;
199
+ }
200
+
201
+
202
+
203
+ var _fieldList = [
204
+ { element: "company", field: "Company" },
205
+ { element: "street_1", field: "Line1" },
206
+ { element: "street_2", field: "Line2" },
207
+ { element: "city", field: "City" },
208
+ { element: "region_id", field: "STATENAME" },
209
+ { element: "region", field: "State" },
210
+ { element: "zip", field: "PostalCode" },
211
+ { element: "country", field: "Country" }
212
+ ],
213
+ _options = {
214
+ key: '<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_key',Mage::app()->getStore()); ?>',
215
+ dataSourceOptions: { international: true, royalMail: RoyalMail_Data, usps: true }
216
+ };
217
+ _control = new pca.Address(_fieldList, _options);
218
+
219
+ function search() {
220
+ var _line1 = pca.getValue("street_1"),
221
+ _city = pca.getValue("city"),
222
+ _state = pca.getValue("region_id"),
223
+ _locality = _city + (_city && _state ? "," : "") + _state,
224
+ _postcode = pca.getValue("zip"),
225
+ _country = pca.getValue("country");
226
+
227
+ _control.search(_line1, _locality, _postcode, _country);
228
+ }
229
+
230
+ function clearFields() {
231
+ _control.clear();
232
+ }
233
+
234
+
235
+
236
+ var _stateData = {
237
+ "USA": { "AL": "Alabama", "AK": "Alaska", "AZ": "Arizona", "AR": "Arkansas",
238
+ "CA": "California", "CO": "Colorado", "CT": "Connecticut", "DE": "Delaware",
239
+ "DC": "District Of Columbia", "FL": "Florida", "GA": "Georgia", "HI": "Hawaii",
240
+ "ID": "Idaho", "IL": "Illinois", "IN": "Indiana", "IA": "Iowa", "KS": "Kansas",
241
+ "KY": "Kentucky", "LA": "Louisiana", "ME": "Maine", "MD": "Maryland",
242
+ "MA": "Massachusetts", "MI": "Michigan", "MN": "Minnesota", "MS": "Mississippi",
243
+ "MO": "Missouri", "MT": "Montana", "NE": "Nebraska", "NV": "Nevada",
244
+ "NH": "New Hampshire", "NJ": "New Jersey", "NM": "New Mexico", "NY": "New York",
245
+ "NC": "North Carolina", "ND": "North Dakota", "OH": "Ohio", "OK": "Oklahoma",
246
+ "OR": "Oregon", "PA": "Pennsylvania", "PR": "Puerto Rico", "RI": "Rhode Island",
247
+ "SC": "South Carolina", "SD": "South Dakota", "TN": "Tennessee", "TX": "Texas",
248
+ "UT": "Utah", "VT": "Vermont", "VI": "Virgin Islands", "VA": "Virginia",
249
+ "WA": "Washington", "WV": "West Virginia", "WI": "Wisconsin", "WY": "Wyoming"
250
+ },
251
+ "CAN": { "AB": "Alberta", "BC": "British Columbia", "MB": "Alabama", "NL": "Newfoundland and Labrador",
252
+ "NB": "New Brunswick", "NS": "Nova Scotia", "NT": "Northwest Territories", "NU": "Nunavut",
253
+ "ON": "Ontario", "PE": "Prince Edward Island", "QC": "Quebec", "SK": "Saskatchewan",
254
+ "YT": "Yukon Territory"
255
+ }
256
+ };
257
+
258
+
259
+
260
+ _control.listen("select", function (address) {
261
+ if (address.State)
262
+ address.State = ((_stateData[address.CountryCode] || {})[address.State] || address.State);
263
+ pca.setValue("region_id", address.State);
264
+
265
+ });
266
+
267
+
268
+ _control.listen("error", function (error) { alert(error) });
269
+
270
+
271
+
272
+ </script>
273
+ </div>
app/design/frontend/default/default/template/customer/form/pca_register.phtml ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.js" ></script>
28
+ <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.css" type="text/css" media="all"/>
29
+
30
+ <style type="text/css">
31
+ label { font:bold 9pt arial;color:#455f70; }
32
+ table { margin:15px;padding:15px;background-color:#ddeffd;border-radius:5px;border:solid 1px #98b4c9; }
33
+ #zip {width:150px;}
34
+ </style>
35
+
36
+
37
+ <?php
38
+ /**
39
+ * Create account form template
40
+ *
41
+ * @see Mage_Customer_Block_Form_Register
42
+ */
43
+ ?>
44
+ <div class="account-create">
45
+ <div class="page-title">
46
+ <h1><?php echo $this->__('Create an Account') ?></h1>
47
+ </div>
48
+ <?php echo $this->getChildHtml('form_fields_before')?>
49
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
50
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
51
+ <div class="fieldset">
52
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
53
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
54
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
55
+ <ul class="form-list">
56
+ <li class="fields">
57
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
58
+ </li>
59
+ <li>
60
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
61
+ <div class="input-box">
62
+ <input type="text" name="email" id="email_address" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
63
+ </div>
64
+ </li>
65
+ <?php if ($this->isNewsletterEnabled()): ?>
66
+ <li class="control">
67
+ <div class="input-box">
68
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
69
+ </div>
70
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
71
+ </li>
72
+ <?php endif ?>
73
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
74
+ <?php if ($_dob->isEnabled()): ?>
75
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
76
+ <?php endif ?>
77
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
78
+ <?php if ($_taxvat->isEnabled()): ?>
79
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
80
+ <?php endif ?>
81
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
82
+ <?php if ($_gender->isEnabled()): ?>
83
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
84
+ <?php endif ?>
85
+ </ul>
86
+ </div>
87
+ <?php if($this->getShowAddressFields()): ?>
88
+ <div class="fieldset">
89
+ <input type="hidden" name="create_address" value="1" />
90
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
91
+ <ul class="form-list">
92
+ <li class="fields">
93
+ <div class="field">
94
+ <label for="company"><?php echo $this->__('Company') ?></label>
95
+ <div class="input-box">
96
+ <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
97
+ </div>
98
+ </div>
99
+ <div class="field">
100
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
101
+ <div class="input-box">
102
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->htmlEscape($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" />
103
+ </div>
104
+ </div>
105
+ </li>
106
+
107
+
108
+
109
+ <li class="fields"><div class="field">
110
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
111
+ <div class="input-box">
112
+ <?php echo $this->getCountryHtmlSelect() ?>
113
+ </div>
114
+ </div> </li> <li>
115
+ <div class="field">
116
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
117
+ <div class="input-box">
118
+ <input type="text" name="postcode" style="width:200px;" value="<?php echo $this->htmlEscape($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
119
+ </div>
120
+ </div>
121
+ </li>
122
+
123
+ <li class="wide">
124
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
125
+ <div class="input-box">
126
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
127
+ </div>
128
+ </li>
129
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
130
+ <li class="wide">
131
+ <div class="input-box">
132
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
133
+ </div>
134
+ </li>
135
+ <?php endfor ?>
136
+ <li class="fields">
137
+ <div class="field">
138
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
139
+ <div class="input-box">
140
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
141
+ </div>
142
+ </div>
143
+ <div class="field">
144
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
145
+ <div class="input-box">
146
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
147
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
148
+ </select>
149
+ <script type="text/javascript">
150
+ //<![CDATA[
151
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
152
+ //]]>
153
+ </script>
154
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
155
+ </div>
156
+ </div>
157
+ </li>
158
+ </ul>
159
+ <input type="hidden" name="default_billing" value="1" />
160
+ <input type="hidden" name="default_shipping" value="1" />
161
+ </div>
162
+ <?php endif; ?>
163
+ <div class="fieldset">
164
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
165
+ <ul class="form-list">
166
+ <li class="fields">
167
+ <div class="field">
168
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
169
+ <div class="input-box">
170
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
171
+ </div>
172
+ </div>
173
+ <div class="field">
174
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
175
+ <div class="input-box">
176
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
177
+ </div>
178
+ </div>
179
+ </li>
180
+ </ul>
181
+ </div>
182
+ <div class="buttons-set">
183
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
184
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
185
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
186
+ </div>
187
+ </form>
188
+ <script type="text/javascript">
189
+ //<![CDATA[
190
+ var dataForm = new VarienForm('form-validate', true);
191
+ <?php if($this->getShowAddressFields()): ?>
192
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
193
+ <?php endif; ?>
194
+ //]]>
195
+
196
+
197
+ document.getElementById("zip").parentNode.appendChild(new pca.Button("Find", search).element);
198
+
199
+ var RoyalMail_Data = true;
200
+
201
+ if(<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_rmdata',Mage::app()->getStore()); ?> == 0)
202
+ {
203
+ RoyalMail_Data = false;
204
+ }
205
+
206
+
207
+
208
+ var _fieldList = [
209
+ { element: "company", field: "Company" },
210
+ { element: "street_1", field: "Line1" },
211
+ { element: "street_2", field: "Line2" },
212
+ { element: "city", field: "City" },
213
+ { element: "region_id", field: "STATENAME" },
214
+ { element: "region", field: "State" },
215
+ { element: "zip", field: "PostalCode" },
216
+ { element: "country", field: "Country" }
217
+ ],
218
+ _options = {
219
+ key: '<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_key',Mage::app()->getStore()); ?>',
220
+ dataSourceOptions: { international: true, royalMail: RoyalMail_Data, usps: true }
221
+ };
222
+ _control = new pca.Address(_fieldList, _options);
223
+
224
+ function search() {
225
+ var _line1 = pca.getValue("street_1"),
226
+ _city = pca.getValue("city"),
227
+ _state = pca.getValue("region_id"),
228
+ _locality = _city + (_city && _state ? "," : "") + _state,
229
+ _postcode = pca.getValue("zip"),
230
+ _country = pca.getValue("country");
231
+
232
+ _control.search(_line1, _locality, _postcode, _country);
233
+ }
234
+
235
+ function clearFields() {
236
+ _control.clear();
237
+ }
238
+
239
+
240
+
241
+ var _stateData = {
242
+ "USA": { "AL": "Alabama", "AK": "Alaska", "AZ": "Arizona", "AR": "Arkansas",
243
+ "CA": "California", "CO": "Colorado", "CT": "Connecticut", "DE": "Delaware",
244
+ "DC": "District Of Columbia", "FL": "Florida", "GA": "Georgia", "HI": "Hawaii",
245
+ "ID": "Idaho", "IL": "Illinois", "IN": "Indiana", "IA": "Iowa", "KS": "Kansas",
246
+ "KY": "Kentucky", "LA": "Louisiana", "ME": "Maine", "MD": "Maryland",
247
+ "MA": "Massachusetts", "MI": "Michigan", "MN": "Minnesota", "MS": "Mississippi",
248
+ "MO": "Missouri", "MT": "Montana", "NE": "Nebraska", "NV": "Nevada",
249
+ "NH": "New Hampshire", "NJ": "New Jersey", "NM": "New Mexico", "NY": "New York",
250
+ "NC": "North Carolina", "ND": "North Dakota", "OH": "Ohio", "OK": "Oklahoma",
251
+ "OR": "Oregon", "PA": "Pennsylvania", "PR": "Puerto Rico", "RI": "Rhode Island",
252
+ "SC": "South Carolina", "SD": "South Dakota", "TN": "Tennessee", "TX": "Texas",
253
+ "UT": "Utah", "VT": "Vermont", "VI": "Virgin Islands", "VA": "Virginia",
254
+ "WA": "Washington", "WV": "West Virginia", "WI": "Wisconsin", "WY": "Wyoming"
255
+ },
256
+ "CAN": { "AB": "Alberta", "BC": "British Columbia", "MB": "Alabama", "NL": "Newfoundland and Labrador",
257
+ "NB": "New Brunswick", "NS": "Nova Scotia", "NT": "Northwest Territories", "NU": "Nunavut",
258
+ "ON": "Ontario", "PE": "Prince Edward Island", "QC": "Quebec", "SK": "Saskatchewan",
259
+ "YT": "Yukon Territory"
260
+ }
261
+ };
262
+
263
+
264
+
265
+ _control.listen("select", function (address) {
266
+ if (address.State)
267
+ address.State = ((_stateData[address.CountryCode] || {})[address.State] || address.State);
268
+ pca.setValue("region_id", address.State);
269
+
270
+ });
271
+
272
+
273
+ _control.listen("error", function (error) { alert(error) });
274
+
275
+
276
+
277
+ </script>
278
+ </div>
app/design/frontend/default/default/template/persistent/checkout/onepage/pca_billing.phtml ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.js" ></script>
29
+ <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.css" type="text/css" media="all"/>
30
+
31
+ <style type="text/css">
32
+ label { font:bold 9pt arial;color:#455f70; }
33
+ table { margin:15px;padding:15px;background-color:#ddeffd;border-radius:5px;border:solid 1px #98b4c9; }
34
+ #billing:postcode {width:150px;}
35
+ </style>
36
+
37
+
38
+
39
+
40
+ <form id="co-billing-form" action="">
41
+ <fieldset>
42
+ <ul class="form-list">
43
+ <?php if ($this->customerHasAddresses()): ?>
44
+
45
+
46
+ <li class="wide">
47
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
48
+ <div class="input-box">
49
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
50
+ </div>
51
+ </li>
52
+ <?php endif; ?>
53
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
54
+ <fieldset>
55
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
56
+ <ul>
57
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
58
+ <li class="fields">
59
+ <div class="field">
60
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
61
+ <div class="input-box">
62
+ <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" />
63
+ </div>
64
+ </div>
65
+ <?php if(!$this->isCustomerLoggedIn()): ?>
66
+ <div class="field">
67
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
68
+ <div class="input-box">
69
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
70
+ </div>
71
+ </div> <br /><br /><br />
72
+ <?php endif ?>
73
+ </li> <li class="fields">
74
+ <div class="field">
75
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
76
+ <div class="input-box">
77
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
78
+ </div>
79
+ </div>
80
+ </li>
81
+
82
+
83
+ <li class="fields">
84
+ <div class="field">
85
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
86
+ <div class="input-box">
87
+ <input type="text" style="width: 150px" title=""<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" />
88
+ </div>
89
+ <li class="wide">
90
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
91
+ <div class="input-box">
92
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" />
93
+ </div>
94
+ </li>
95
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
96
+ <li class="wide">
97
+ <div class="input-box">
98
+ <input type="text" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" />
99
+ </div>
100
+ </li>
101
+ <?php endfor ?>
102
+ <li class="fields">
103
+ <div class="field">
104
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
105
+ <div class="input-box">
106
+ <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="input-text required-entry" id="billing:city" />
107
+ </div>
108
+ </div>
109
+ <div class="field">
110
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
111
+ <div class="input-box">
112
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
113
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
114
+ </select>
115
+ <script type="text/javascript">
116
+ //<![CDATA[
117
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
118
+ //]]>
119
+ </script>
120
+ <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;" />
121
+ </div>
122
+ </div>
123
+ </li>
124
+
125
+
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->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" 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->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" 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
+ </ul>
189
+ </fieldset>
190
+ </li>
191
+ <?php if ($this->canShip()): ?>
192
+ <li class="control">
193
+ <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>
194
+ <li class="control">
195
+ <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>
196
+ </li>
197
+ <?php endif; ?>
198
+ </ul>
199
+ <?php if (!$this->canShip()): ?>
200
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
201
+ <?php endif; ?>
202
+ <div class="buttons-set" id="billing-buttons-container">
203
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
204
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="billing.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
205
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
206
+ <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...') ?>
207
+ </span>
208
+ </div>
209
+ </fieldset>
210
+ </form>
211
+ <script type="text/javascript">
212
+ //<![CDATA[
213
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
214
+ var billingForm = new VarienForm('co-billing-form');
215
+
216
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
217
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
218
+
219
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions, undefined, 'billing:postcode');
220
+ //]]>
221
+ </script>
222
+
223
+
224
+
225
+ <script type="text/javascript">
226
+
227
+ document.getElementById("billing:postcode").parentNode.appendChild(new pca.Button("Find", search).element);
228
+
229
+ var RoyalMail_Data = true;
230
+
231
+ if(<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_rmdata',Mage::app()->getStore()); ?> == 0)
232
+ {
233
+ RoyalMail_Data = false;
234
+ }
235
+
236
+
237
+
238
+ var _fieldList = [
239
+ { element: "billing:company", field: "Company" },
240
+ { element: "billing:street1", field: "Line1" },
241
+ { element: "billing:street2", field: "Line2" },
242
+ { element: "billing:city", field: "City" },
243
+ { element: "billing:region_id", field: "STATENAME" },
244
+ { element: "billing:region", field: "State" },
245
+ { element: "billing:postcode", field: "PostalCode" },
246
+ { element: "billing:country_id", field: "Country" }
247
+ ],
248
+ _options = {
249
+ key: '<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_key',Mage::app()->getStore()); ?>',
250
+ dataSourceOptions: { international: true, royalMail: RoyalMail_Data, usps: true }
251
+ };
252
+ _control = new pca.Address(_fieldList, _options);
253
+
254
+ function search() {
255
+ var _line1 = pca.getValue("billing:street1"),
256
+ _city = pca.getValue("billing:city"),
257
+ _state = pca.getValue("billing:region_id"),
258
+ _locality = _city + (_city && _state ? "," : "") + _state,
259
+ _postcode = pca.getValue("billing:postcode"),
260
+ _country = pca.getValue("billing:country_id");
261
+
262
+ _control.search(_line1, _locality, _postcode, _country);
263
+ }
264
+
265
+ function clearFields() {
266
+ _control.clear();
267
+ }
268
+
269
+
270
+ var _stateData = {
271
+ "USA": { "AL": "Alabama", "AK": "Alaska", "AZ": "Arizona", "AR": "Arkansas",
272
+ "CA": "California", "CO": "Colorado", "CT": "Connecticut", "DE": "Delaware",
273
+ "DC": "District Of Columbia", "FL": "Florida", "GA": "Georgia", "HI": "Hawaii",
274
+ "ID": "Idaho", "IL": "Illinois", "IN": "Indiana", "IA": "Iowa", "KS": "Kansas",
275
+ "KY": "Kentucky", "LA": "Louisiana", "ME": "Maine", "MD": "Maryland",
276
+ "MA": "Massachusetts", "MI": "Michigan", "MN": "Minnesota", "MS": "Mississippi",
277
+ "MO": "Missouri", "MT": "Montana", "NE": "Nebraska", "NV": "Nevada",
278
+ "NH": "New Hampshire", "NJ": "New Jersey", "NM": "New Mexico", "NY": "New York",
279
+ "NC": "North Carolina", "ND": "North Dakota", "OH": "Ohio", "OK": "Oklahoma",
280
+ "OR": "Oregon", "PA": "Pennsylvania", "PR": "Puerto Rico", "RI": "Rhode Island",
281
+ "SC": "South Carolina", "SD": "South Dakota", "TN": "Tennessee", "TX": "Texas",
282
+ "UT": "Utah", "VT": "Vermont", "VI": "Virgin Islands", "VA": "Virginia",
283
+ "WA": "Washington", "WV": "West Virginia", "WI": "Wisconsin", "WY": "Wyoming"
284
+ },
285
+ "CAN": { "AB": "Alberta", "BC": "British Columbia", "MB": "Alabama", "NL": "Newfoundland and Labrador",
286
+ "NB": "New Brunswick", "NS": "Nova Scotia", "NT": "Northwest Territories", "NU": "Nunavut",
287
+ "ON": "Ontario", "PE": "Prince Edward Island", "QC": "Quebec", "SK": "Saskatchewan",
288
+ "YT": "Yukon Territory"
289
+ }
290
+ };
291
+
292
+
293
+
294
+ _control.listen("select", function (address) {
295
+ if (address.State)
296
+ address.State = ((_stateData[address.CountryCode] || {})[address.State] || address.State);
297
+ pca.setValue("billing:region_id", address.State);
298
+
299
+ });
300
+
301
+
302
+ _control.listen("error", function (error) { alert(error) });
303
+
304
+
305
+ </script>
app/design/frontend/default/default/template/persistent/customer/form/pca_register.phtml ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.js" ></script>
28
+ <link rel="stylesheet" href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>PostcodeAnywhere/address.css" type="text/css" media="all"/>
29
+
30
+ <style type="text/css">
31
+ label { font:bold 9pt arial;color:#455f70; }
32
+ table { margin:15px;padding:15px;background-color:#ddeffd;border-radius:5px;border:solid 1px #98b4c9; }
33
+ #zip {width:150px;}
34
+ </style>
35
+
36
+
37
+ <?php
38
+ /**
39
+ * Create account form template
40
+ *
41
+ * @see Mage_Customer_Block_Form_Register
42
+ */
43
+ ?>
44
+ <div class="account-create">
45
+ <div class="page-title">
46
+ <h1><?php echo $this->__('Create an Account') ?></h1>
47
+ </div>
48
+ <?php echo $this->getChildHtml('form_fields_before')?>
49
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
50
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
51
+ <div class="fieldset">
52
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
53
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
54
+ <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
55
+ <ul class="form-list">
56
+ <li class="fields">
57
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
58
+ </li>
59
+ <li>
60
+ <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
61
+ <div class="input-box">
62
+ <input type="text" name="email" id="email_address" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
63
+ </div>
64
+ </li>
65
+ <?php if ($this->isNewsletterEnabled()): ?>
66
+ <li class="control">
67
+ <div class="input-box">
68
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed"<?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" />
69
+ </div>
70
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
71
+ </li>
72
+ <?php endif ?>
73
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
74
+ <?php if ($_dob->isEnabled()): ?>
75
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
76
+ <?php endif ?>
77
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
78
+ <?php if ($_taxvat->isEnabled()): ?>
79
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
80
+ <?php endif ?>
81
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
82
+ <?php if ($_gender->isEnabled()): ?>
83
+ <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
84
+ <?php endif ?>
85
+ </ul>
86
+ </div>
87
+ <?php if($this->getShowAddressFields()): ?>
88
+ <div class="fieldset">
89
+ <input type="hidden" name="create_address" value="1" />
90
+ <h2 class="legend"><?php echo $this->__('Address Information') ?></h2>
91
+ <ul class="form-list">
92
+ <li class="fields">
93
+ <div class="field">
94
+ <label for="company"><?php echo $this->__('Company') ?></label>
95
+ <div class="input-box">
96
+ <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
97
+ </div>
98
+ </div>
99
+ <div class="field">
100
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
101
+ <div class="input-box">
102
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->htmlEscape($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" />
103
+ </div>
104
+ </div>
105
+ </li>
106
+
107
+
108
+
109
+ <li class="fields"><div class="field">
110
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
111
+ <div class="input-box">
112
+ <?php echo $this->getCountryHtmlSelect() ?>
113
+ </div>
114
+ </div> </li> <li>
115
+ <div class="field">
116
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
117
+ <div class="input-box">
118
+ <input type="text" name="postcode" style="width:200px;" value="<?php echo $this->htmlEscape($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international required-entry" />
119
+ </div>
120
+ </div>
121
+ </li>
122
+
123
+ <li class="wide">
124
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
125
+ <div class="input-box">
126
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text required-entry" />
127
+ </div>
128
+ </li>
129
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
130
+ <li class="wide">
131
+ <div class="input-box">
132
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
133
+ </div>
134
+ </li>
135
+ <?php endfor ?>
136
+ <li class="fields">
137
+ <div class="field">
138
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
139
+ <div class="input-box">
140
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text required-entry" id="city" />
141
+ </div>
142
+ </div>
143
+ <div class="field">
144
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
145
+ <div class="input-box">
146
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
147
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
148
+ </select>
149
+ <script type="text/javascript">
150
+ //<![CDATA[
151
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
152
+ //]]>
153
+ </script>
154
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
155
+ </div>
156
+ </div>
157
+ </li>
158
+ </ul>
159
+ <input type="hidden" name="default_billing" value="1" />
160
+ <input type="hidden" name="default_shipping" value="1" />
161
+ </div>
162
+ <?php endif; ?>
163
+ <div class="fieldset">
164
+ <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
165
+ <ul class="form-list">
166
+ <li class="fields">
167
+ <div class="field">
168
+ <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
169
+ <div class="input-box">
170
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
171
+ </div>
172
+ </div>
173
+ <div class="field">
174
+ <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
175
+ <div class="input-box">
176
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" />
177
+ </div>
178
+ </div>
179
+ </li>
180
+ </ul>
181
+ </div>
182
+ <div class="buttons-set">
183
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
184
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
185
+ <button type="submit" title="<?php echo $this->__('Submit') ?>" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
186
+ </div>
187
+ </form>
188
+ <script type="text/javascript">
189
+ //<![CDATA[
190
+ var dataForm = new VarienForm('form-validate', true);
191
+ <?php if($this->getShowAddressFields()): ?>
192
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
193
+ <?php endif; ?>
194
+ //]]>
195
+
196
+
197
+ document.getElementById("zip").parentNode.appendChild(new pca.Button("Find", search).element);
198
+
199
+ var RoyalMail_Data = true;
200
+
201
+ if(<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_rmdata',Mage::app()->getStore()); ?> == 0)
202
+ {
203
+ RoyalMail_Data = false;
204
+ }
205
+
206
+
207
+
208
+ var _fieldList = [
209
+ { element: "company", field: "Company" },
210
+ { element: "street_1", field: "Line1" },
211
+ { element: "street_2", field: "Line2" },
212
+ { element: "city", field: "City" },
213
+ { element: "region_id", field: "STATENAME" },
214
+ { element: "region", field: "State" },
215
+ { element: "zip", field: "PostalCode" },
216
+ { element: "country", field: "Country" }
217
+ ],
218
+ _options = {
219
+ key: '<?php echo Mage::getStoreConfig('PostcodeAnywhere/PostcodeAnywhere_group/PostcodeAnywhere_key',Mage::app()->getStore()); ?>',
220
+ dataSourceOptions: { international: true, royalMail: RoyalMail_Data, usps: true }
221
+ };
222
+ _control = new pca.Address(_fieldList, _options);
223
+
224
+ function search() {
225
+ var _line1 = pca.getValue("street_1"),
226
+ _city = pca.getValue("city"),
227
+ _state = pca.getValue("region_id"),
228
+ _locality = _city + (_city && _state ? "," : "") + _state,
229
+ _postcode = pca.getValue("zip"),
230
+ _country = pca.getValue("country");
231
+
232
+ _control.search(_line1, _locality, _postcode, _country);
233
+ }
234
+
235
+ function clearFields() {
236
+ _control.clear();
237
+ }
238
+
239
+
240
+ var _stateData = {
241
+ "USA": { "AL": "Alabama", "AK": "Alaska", "AZ": "Arizona", "AR": "Arkansas",
242
+ "CA": "California", "CO": "Colorado", "CT": "Connecticut", "DE": "Delaware",
243
+ "DC": "District Of Columbia", "FL": "Florida", "GA": "Georgia", "HI": "Hawaii",
244
+ "ID": "Idaho", "IL": "Illinois", "IN": "Indiana", "IA": "Iowa", "KS": "Kansas",
245
+ "KY": "Kentucky", "LA": "Louisiana", "ME": "Maine", "MD": "Maryland",
246
+ "MA": "Massachusetts", "MI": "Michigan", "MN": "Minnesota", "MS": "Mississippi",
247
+ "MO": "Missouri", "MT": "Montana", "NE": "Nebraska", "NV": "Nevada",
248
+ "NH": "New Hampshire", "NJ": "New Jersey", "NM": "New Mexico", "NY": "New York",
249
+ "NC": "North Carolina", "ND": "North Dakota", "OH": "Ohio", "OK": "Oklahoma",
250
+ "OR": "Oregon", "PA": "Pennsylvania", "PR": "Puerto Rico", "RI": "Rhode Island",
251
+ "SC": "South Carolina", "SD": "South Dakota", "TN": "Tennessee", "TX": "Texas",
252
+ "UT": "Utah", "VT": "Vermont", "VI": "Virgin Islands", "VA": "Virginia",
253
+ "WA": "Washington", "WV": "West Virginia", "WI": "Wisconsin", "WY": "Wyoming"
254
+ },
255
+ "CAN": { "AB": "Alberta", "BC": "British Columbia", "MB": "Alabama", "NL": "Newfoundland and Labrador",
256
+ "NB": "New Brunswick", "NS": "Nova Scotia", "NT": "Northwest Territories", "NU": "Nunavut",
257
+ "ON": "Ontario", "PE": "Prince Edward Island", "QC": "Quebec", "SK": "Saskatchewan",
258
+ "YT": "Yukon Territory"
259
+ }
260
+ };
261
+
262
+
263
+
264
+ _control.listen("select", function (address) {
265
+ if (address.State)
266
+ address.State = ((_stateData[address.CountryCode] || {})[address.State] || address.State);
267
+ pca.setValue("region_id", address.State);
268
+
269
+ });
270
+
271
+
272
+ _control.listen("error", function (error) { alert(error) });
273
+
274
+
275
+ </script>
276
+ </div>
app/etc/modules/PostcodeAnywhere_AddressLookup.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <PostcodeAnywhere_AddressLookup>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </PostcodeAnywhere_AddressLookup>
8
+ </modules>
9
+ </config>
js/PostcodeAnywhere/address.css ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! Copyright � 2009-2011 Postcode Anywhere (Holdings) Ltd. (http://www.postcodeanywhere.co.uk)
2
+ * Toolkit v1.00
3
+ */
4
+
5
+ .pcatext { font:9pt arial;color:#455f70; }
6
+ .pcalist { list-style-type:none;list-style-position:outside;margin:0;padding:0;overflow-y:scroll;overflow-x:hidden;background-color:#fff;border:1px solid #000; }
7
+ .pcaautocomplete { margin:0;padding:0;border:0;width:inherit; }
8
+ .pcaautocomplete .pcalist { position:absolute;height:200px;width:auto; }
9
+ .pcamodal { position:absolute; }
10
+ .pcamodal .pcalist { height:250px;width:300px; }
11
+ .pcalistitem { text-align:left;cursor:pointer;margin:0;padding:3px 25px 3px 10px; }
12
+ .pcaselected { background-color:#ddeffd;color:#213d4f; }
13
+ .pcadisableselect {-moz-user-select:none;-webkit-user-select:none;}
14
+ .pcafullscreen { position:fixed;top:0;left:0;height:100%;width:100%; }
15
+ .pcamask { background-color:#000;opacity:.1;filter:alpha(opacity=10); }
16
+ .pcaborder { position:absolute;width:100%;height:100%;top:0;left:0;background-color:#444;border-radius:3px;opacity:.3;filter:alpha(opacity=30); }
17
+ .pcabackground { position:relative;margin:12px;padding:12px;background-color:#ddeffd;border-radius:3px;border:solid 1px #98b4c9; }
18
+ .pcabutton { font-weight:bold;border:1px solid #9fb9d0;border-radius:5px;padding:2px 9px;cursor:pointer; }
19
+ .pcabutton:hover { color:#213d4f; }
20
+ .pcagradient { background:#96cdf6;background:-moz-linear-gradient(top, #96cdf6 0%, #85bae4 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#96cdf6), color-stop(100%,#85bae4));filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#96cdf6',endColorstr='#85bae4',GradientType=0); }
21
+ .pcalink { font-weight:bold;cursor:pointer; }
22
+ .pcasidebar { position:fixed;top:0;right:0;margin:0;padding:0;height:100%;width:250px; }
23
+ .pcasidebarlist { margin:0;padding:0;list-style-type:none;list-style-position:outside; }
24
+ .pcadraggable { position:relative;margin:8px;padding:8px;background-color:#ddeffd;border-radius:3px;border:solid 1px #98b4c9;cursor:move; }
25
+ .pcadragselected { border:solid 2px green; }
26
+ .pcadraghover { border:solid 2px red; }
js/PostcodeAnywhere/address.js ADDED
@@ -0,0 +1,1615 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! Copyright © 2009-2011 Postcode Anywhere (Holdings) Ltd. (http://www.postcodeanywhere.co.uk)
2
+ *
3
+ * Address v1.00
4
+ * Component for address lookup integrations.
5
+ */
6
+
7
+ (function (window, undefined) {
8
+ var _pca = window.pca = window.pca || {},
9
+ _protocol = window.parent.location.protocol == "https:" ? "https:" : "http:",
10
+ _host = "services.postcodeanywhere.co.uk",
11
+ _endpoint = "json2.ws",
12
+ _document = window.document;
13
+
14
+ //Temp store for services repsonses
15
+ _pca.response = "";
16
+
17
+ //Types
18
+ _pca.CountryNameType = { Iso2: "Iso2", Iso3: "Iso3", Name: "Name" };
19
+ _pca.ListType = { Select: "Select", AutoComplete: "AutoComplete", Modal: "Modal" };
20
+
21
+ //Local Data
22
+ _pca.synonyms = [
23
+ { r: " N ", w: " NORTH " },
24
+ { r: " NE ", w: " NORTH EAST " },
25
+ { r: " NORTHEAST ", w: " NORTH EAST " },
26
+ { r: " NW ", w: " NORTH WEST " },
27
+ { r: " NORTHWEST ", w: " NORTH WEST " },
28
+ { r: " S ", w: " SOUTH " },
29
+ { r: " SE ", w: " SOUTH EAST " },
30
+ { r: " SOUTHEAST ", w: " SOUTH EAST " },
31
+ { r: " SW ", w: " SOUTH WEST " },
32
+ { r: " SOUTHWEST ", w: " SOUTH WEST " },
33
+ { r: " E ", w: " EAST " },
34
+ { r: " W ", w: " WEST " },
35
+ { r: " ST ", w: " SAINT " }
36
+ ];
37
+ _pca.diacritics = [
38
+ { r: /[ÀÁÂÃàáâã]/g, w: "A" },
39
+ { r: /[Åå]/g, w: "AA" },
40
+ { r: /[ÆæÄä]/g, w: "AE" },
41
+ { r: /[Çç]/g, w: "C" },
42
+ { r: /[Cc]/g, w: "CH" },
43
+ { r: /[dÐ]/g, w: "DJ" },
44
+ { r: /[ÈÉÊËèéêë]/g, w: "E" },
45
+ { r: /[ÌÍÏìíîï]/g, w: "I" },
46
+ { r: /[Ññ]/g, w: "N" },
47
+ { r: /[ÒÓÔÕOòóôõo]/g, w: "O" },
48
+ { r: /[ŒœØøÖö]/g, w: "OE" },
49
+ { r: /[Šš]/g, w: "SH" },
50
+ { r: /ß/g, w: "SS" },
51
+ { r: /[ÙÚÛUùúûu]/g, w: "U" },
52
+ { r: /[Üü]/g, w: "UE" },
53
+ { r: /[Üü]/g, w: "Y" },
54
+ { r: /[ŸÝýÿ]/g, w: "ZH" },
55
+ { r: /-/g, w: " " },
56
+ { r: /[.,]/g, w: "" }
57
+ ];
58
+ _pca.countries = [
59
+ { Iso2: "AF", Iso3: "AFG", Name: "Afghanistan" },
60
+ { Iso2: "AX", Iso3: "ALA", Name: "Åland Islands" },
61
+ { Iso2: "AL", Iso3: "ALB", Name: "Albania" },
62
+ { Iso2: "DZ", Iso3: "DZA", Name: "Algeria" },
63
+ { Iso2: "AS", Iso3: "ASM", Name: "American Samoa" },
64
+ { Iso2: "AD", Iso3: "AND", Name: "Andorra" },
65
+ { Iso2: "AO", Iso3: "AGO", Name: "Angola" },
66
+ { Iso2: "AI", Iso3: "AIA", Name: "Anguilla" },
67
+ { Iso2: "AQ", Iso3: "ATA", Name: "Antarctica" },
68
+ { Iso2: "AG", Iso3: "ATG", Name: "Antigua and Barbuda" },
69
+ { Iso2: "AR", Iso3: "ARG", Name: "Argentina" },
70
+ { Iso2: "AM", Iso3: "ARM", Name: "Armenia" },
71
+ { Iso2: "AW", Iso3: "ABW", Name: "Aruba" },
72
+ { Iso2: "AU", Iso3: "AUS", Name: "Australia" },
73
+ { Iso2: "AT", Iso3: "AUT", Name: "Austria" },
74
+ { Iso2: "AZ", Iso3: "AZE", Name: "Azerbaijan" },
75
+ { Iso2: "BS", Iso3: "BHS", Name: "Bahamas" },
76
+ { Iso2: "BH", Iso3: "BHR", Name: "Bahrain" },
77
+ { Iso2: "BD", Iso3: "BGD", Name: "Bangladesh" },
78
+ { Iso2: "BB", Iso3: "BRB", Name: "Barbados" },
79
+ { Iso2: "BY", Iso3: "BLR", Name: "Belarus" },
80
+ { Iso2: "BE", Iso3: "BEL", Name: "Belgium" },
81
+ { Iso2: "BZ", Iso3: "BLZ", Name: "Belize" },
82
+ { Iso2: "BJ", Iso3: "BEN", Name: "Benin" },
83
+ { Iso2: "BM", Iso3: "BMU", Name: "Bermuda" },
84
+ { Iso2: "BT", Iso3: "BTN", Name: "Bhutan" },
85
+ { Iso2: "BO", Iso3: "BOL", Name: "Bolivia, Plurinational State Of" },
86
+ { Iso2: "BQ", Iso3: "BES", Name: "Bonaire, Saint Eustatius and Saba" },
87
+ { Iso2: "BA", Iso3: "BIH", Name: "Bosnia and Herzegovina" },
88
+ { Iso2: "BW", Iso3: "BWA", Name: "Botswana" },
89
+ { Iso2: "BV", Iso3: "BVT", Name: "Bouvet Island" },
90
+ { Iso2: "BR", Iso3: "BRA", Name: "Brazil" },
91
+ { Iso2: "IO", Iso3: "IOT", Name: "British Indian Ocean Territory" },
92
+ { Iso2: "BN", Iso3: "BRN", Name: "Brunei Darussalam" },
93
+ { Iso2: "BG", Iso3: "BGR", Name: "Bulgaria" },
94
+ { Iso2: "BF", Iso3: "BFA", Name: "Burkina Faso" },
95
+ { Iso2: "BI", Iso3: "BDI", Name: "Burundi" },
96
+ { Iso2: "KH", Iso3: "KHM", Name: "Cambodia" },
97
+ { Iso2: "CM", Iso3: "CMR", Name: "Cameroon" },
98
+ { Iso2: "CA", Iso3: "CAN", Name: "Canada" },
99
+ { Iso2: "CV", Iso3: "CPV", Name: "Cape Verde" },
100
+ { Iso2: "KY", Iso3: "CYM", Name: "Cayman Islands" },
101
+ { Iso2: "CF", Iso3: "CAF", Name: "Central African Republic" },
102
+ { Iso2: "TD", Iso3: "TCD", Name: "Chad" },
103
+ { Iso2: "CL", Iso3: "CHL", Name: "Chile" },
104
+ { Iso2: "CN", Iso3: "CHN", Name: "China" },
105
+ { Iso2: "CX", Iso3: "CXR", Name: "Christmas Island" },
106
+ { Iso2: "CC", Iso3: "CCK", Name: "Cocos (Keeling) Islands" },
107
+ { Iso2: "CO", Iso3: "COL", Name: "Colombia" },
108
+ { Iso2: "KM", Iso3: "COM", Name: "Comoros" },
109
+ { Iso2: "CG", Iso3: "COG", Name: "Congo" },
110
+ { Iso2: "CD", Iso3: "COD", Name: "Congo, the Democratic Republic of the" },
111
+ { Iso2: "CK", Iso3: "COK", Name: "Cook Islands" },
112
+ { Iso2: "CR", Iso3: "CRI", Name: "Costa Rica" },
113
+ { Iso2: "CI", Iso3: "CIV", Name: "Côte D\'ivoire" },
114
+ { Iso2: "HR", Iso3: "HRV", Name: "Croatia" },
115
+ { Iso2: "CU", Iso3: "CUB", Name: "Cuba" },
116
+ { Iso2: "CW", Iso3: "CUW", Name: "Curaçao" },
117
+ { Iso2: "CY", Iso3: "CYP", Name: "Cyprus" },
118
+ { Iso2: "CZ", Iso3: "CZE", Name: "Czech Republic" },
119
+ { Iso2: "DK", Iso3: "DNK", Name: "Denmark" },
120
+ { Iso2: "DJ", Iso3: "DJI", Name: "Djibouti" },
121
+ { Iso2: "DM", Iso3: "DMA", Name: "Dominica" },
122
+ { Iso2: "DO", Iso3: "DOM", Name: "Dominican Republic" },
123
+ { Iso2: "EC", Iso3: "ECU", Name: "Ecuador" },
124
+ { Iso2: "EG", Iso3: "EGY", Name: "Egypt" },
125
+ { Iso2: "SV", Iso3: "SLV", Name: "El Salvador" },
126
+ { Iso2: "GQ", Iso3: "GNQ", Name: "Equatorial Guinea" },
127
+ { Iso2: "ER", Iso3: "ERI", Name: "Eritrea" },
128
+ { Iso2: "EE", Iso3: "EST", Name: "Estonia" },
129
+ { Iso2: "ET", Iso3: "ETH", Name: "Ethiopia" },
130
+ { Iso2: "FK", Iso3: "FLK", Name: "Falkland Islands (Malvinas)" },
131
+ { Iso2: "FO", Iso3: "FRO", Name: "Faroe Islands" },
132
+ { Iso2: "FJ", Iso3: "FJI", Name: "Fiji" },
133
+ { Iso2: "FI", Iso3: "FIN", Name: "Finland" },
134
+ { Iso2: "FR", Iso3: "FRA", Name: "France" },
135
+ { Iso2: "GF", Iso3: "GUF", Name: "French Guiana" },
136
+ { Iso2: "PF", Iso3: "PYF", Name: "French Polynesia" },
137
+ { Iso2: "TF", Iso3: "ATF", Name: "French Southern Territories" },
138
+ { Iso2: "GA", Iso3: "GAB", Name: "Gabon" },
139
+ { Iso2: "GM", Iso3: "GMB", Name: "Gambia" },
140
+ { Iso2: "GE", Iso3: "GEO", Name: "Georgia" },
141
+ { Iso2: "DE", Iso3: "DEU", Name: "Germany" },
142
+ { Iso2: "GH", Iso3: "GHA", Name: "Ghana" },
143
+ { Iso2: "GI", Iso3: "GIB", Name: "Gibraltar" },
144
+ { Iso2: "GR", Iso3: "GRC", Name: "Greece" },
145
+ { Iso2: "GL", Iso3: "GRL", Name: "Greenland" },
146
+ { Iso2: "GD", Iso3: "GRD", Name: "Grenada" },
147
+ { Iso2: "GP", Iso3: "GLP", Name: "Guadeloupe" },
148
+ { Iso2: "GU", Iso3: "GUM", Name: "Guam" },
149
+ { Iso2: "GT", Iso3: "GTM", Name: "Guatemala" },
150
+ { Iso2: "GG", Iso3: "GGY", Name: "Guernsey" },
151
+ { Iso2: "GN", Iso3: "GIN", Name: "Guinea" },
152
+ { Iso2: "GW", Iso3: "GNB", Name: "Guinea-Bissau" },
153
+ { Iso2: "GY", Iso3: "GUY", Name: "Guyana" },
154
+ { Iso2: "HT", Iso3: "HTI", Name: "Haiti" },
155
+ { Iso2: "HM", Iso3: "HMD", Name: "Heard Island and Mcdonald Islands" },
156
+ { Iso2: "VA", Iso3: "VAT", Name: "Holy See (Vatican City State)" },
157
+ { Iso2: "HN", Iso3: "HND", Name: "Honduras" },
158
+ { Iso2: "HK", Iso3: "HKG", Name: "Hong Kong" },
159
+ { Iso2: "HU", Iso3: "HUN", Name: "Hungary" },
160
+ { Iso2: "IS", Iso3: "ISL", Name: "Iceland" },
161
+ { Iso2: "IN", Iso3: "IND", Name: "India" },
162
+ { Iso2: "ID", Iso3: "IDN", Name: "Indonesia" },
163
+ { Iso2: "IR", Iso3: "IRN", Name: "Iran, Islamic Republic Of" },
164
+ { Iso2: "IQ", Iso3: "IRQ", Name: "Iraq" },
165
+ { Iso2: "IE", Iso3: "IRL", Name: "Ireland" },
166
+ { Iso2: "IM", Iso3: "IMN", Name: "Isle of Man" },
167
+ { Iso2: "IL", Iso3: "ISR", Name: "Israel" },
168
+ { Iso2: "IT", Iso3: "ITA", Name: "Italy" },
169
+ { Iso2: "JM", Iso3: "JAM", Name: "Jamaica" },
170
+ { Iso2: "JP", Iso3: "JPN", Name: "Japan" },
171
+ { Iso2: "JE", Iso3: "JEY", Name: "Jersey" },
172
+ { Iso2: "JO", Iso3: "JOR", Name: "Jordan" },
173
+ { Iso2: "KZ", Iso3: "KAZ", Name: "Kazakhstan" },
174
+ { Iso2: "KE", Iso3: "KEN", Name: "Kenya" },
175
+ { Iso2: "KI", Iso3: "KIR", Name: "Kiribati" },
176
+ { Iso2: "KP", Iso3: "PRK", Name: "Korea, Democratic People\'s Republic of" },
177
+ { Iso2: "KR", Iso3: "KOR", Name: "Korea, Republic of" },
178
+ { Iso2: "KW", Iso3: "KWT", Name: "Kuwait" },
179
+ { Iso2: "KG", Iso3: "KGZ", Name: "Kyrgyzstan" },
180
+ { Iso2: "LA", Iso3: "LAO", Name: "Lao people\'s Democratic Republic" },
181
+ { Iso2: "LV", Iso3: "LVA", Name: "Latvia" },
182
+ { Iso2: "LB", Iso3: "LBN", Name: "Lebanon" },
183
+ { Iso2: "LS", Iso3: "LSO", Name: "Lesotho" },
184
+ { Iso2: "LR", Iso3: "LBR", Name: "Liberia" },
185
+ { Iso2: "LY", Iso3: "LBY", Name: "Libya" },
186
+ { Iso2: "LI", Iso3: "LIE", Name: "Liechtenstein" },
187
+ { Iso2: "LT", Iso3: "LTU", Name: "Lithuania" },
188
+ { Iso2: "LU", Iso3: "LUX", Name: "Luxembourg" },
189
+ { Iso2: "MO", Iso3: "MAC", Name: "Macao" },
190
+ { Iso2: "MK", Iso3: "MKD", Name: "Macedonia, the Former Yugoslav Republic of" },
191
+ { Iso2: "MG", Iso3: "MDG", Name: "Madagascar" },
192
+ { Iso2: "MW", Iso3: "MWI", Name: "Malawi" },
193
+ { Iso2: "MY", Iso3: "MYS", Name: "Malaysia" },
194
+ { Iso2: "MV", Iso3: "MDV", Name: "Maldives" },
195
+ { Iso2: "ML", Iso3: "MLI", Name: "Mali" },
196
+ { Iso2: "MT", Iso3: "MLT", Name: "Malta" },
197
+ { Iso2: "MH", Iso3: "MHL", Name: "Marshall Islands" },
198
+ { Iso2: "MQ", Iso3: "MTQ", Name: "Martinique" },
199
+ { Iso2: "MR", Iso3: "MRT", Name: "Mauritania" },
200
+ { Iso2: "MU", Iso3: "MUS", Name: "Mauritius" },
201
+ { Iso2: "YT", Iso3: "MYT", Name: "Mayotte" },
202
+ { Iso2: "MX", Iso3: "MEX", Name: "Mexico" },
203
+ { Iso2: "FM", Iso3: "FSM", Name: "Micronesia, Federated States of" },
204
+ { Iso2: "MD", Iso3: "MDA", Name: "Moldova, Republic of" },
205
+ { Iso2: "MC", Iso3: "MCO", Name: "Monaco" },
206
+ { Iso2: "MN", Iso3: "MNG", Name: "Mongolia" },
207
+ { Iso2: "ME", Iso3: "MNE", Name: "Montenegro" },
208
+ { Iso2: "MS", Iso3: "MSR", Name: "Montserrat" },
209
+ { Iso2: "MA", Iso3: "MAR", Name: "Morocco" },
210
+ { Iso2: "MZ", Iso3: "MOZ", Name: "Mozambique" },
211
+ { Iso2: "MM", Iso3: "MMR", Name: "Myanmar" },
212
+ { Iso2: "NA", Iso3: "NAM", Name: "Namibia" },
213
+ { Iso2: "NR", Iso3: "NRU", Name: "Nauru" },
214
+ { Iso2: "NP", Iso3: "NPL", Name: "Nepal" },
215
+ { Iso2: "NL", Iso3: "NLD", Name: "Netherlands" },
216
+ { Iso2: "NC", Iso3: "NCL", Name: "New Caledonia" },
217
+ { Iso2: "NZ", Iso3: "NZL", Name: "New Zealand" },
218
+ { Iso2: "NI", Iso3: "NIC", Name: "Nicaragua" },
219
+ { Iso2: "NE", Iso3: "NER", Name: "Niger" },
220
+ { Iso2: "NG", Iso3: "NGA", Name: "Nigeria" },
221
+ { Iso2: "NU", Iso3: "NIU", Name: "Niue" },
222
+ { Iso2: "NF", Iso3: "NFK", Name: "Norfolk Island" },
223
+ { Iso2: "MP", Iso3: "MNP", Name: "Northern Mariana Islands" },
224
+ { Iso2: "NO", Iso3: "NOR", Name: "Norway" },
225
+ { Iso2: "OM", Iso3: "OMN", Name: "Oman" },
226
+ { Iso2: "PK", Iso3: "PAK", Name: "Pakistan" },
227
+ { Iso2: "PW", Iso3: "PLW", Name: "Palau" },
228
+ { Iso2: "PS", Iso3: "PSE", Name: "Palestinian Territory, Occupied" },
229
+ { Iso2: "PA", Iso3: "PAN", Name: "Panama" },
230
+ { Iso2: "PG", Iso3: "PNG", Name: "Papua New Guinea" },
231
+ { Iso2: "PY", Iso3: "PRY", Name: "Paraguay" },
232
+ { Iso2: "PE", Iso3: "PER", Name: "Peru" },
233
+ { Iso2: "PH", Iso3: "PHL", Name: "Philippines" },
234
+ { Iso2: "PN", Iso3: "PCN", Name: "Pitcairn" },
235
+ { Iso2: "PL", Iso3: "POL", Name: "Poland" },
236
+ { Iso2: "PT", Iso3: "PRT", Name: "Portugal" },
237
+ { Iso2: "PR", Iso3: "PRI", Name: "Puerto Rico" },
238
+ { Iso2: "QA", Iso3: "QAT", Name: "Qatar" },
239
+ { Iso2: "RE", Iso3: "REU", Name: "Réunion" },
240
+ { Iso2: "RO", Iso3: "ROU", Name: "Romania" },
241
+ { Iso2: "RU", Iso3: "RUS", Name: "Russian Federation" },
242
+ { Iso2: "RW", Iso3: "RWA", Name: "Rwanda" },
243
+ { Iso2: "BL", Iso3: "BLM", Name: "Saint Barthélemy" },
244
+ { Iso2: "SH", Iso3: "SHN", Name: "Saint Helena, Ascension and Tristan da Cunha" },
245
+ { Iso2: "KN", Iso3: "KNA", Name: "Saint Kitts and Nevis" },
246
+ { Iso2: "LC", Iso3: "LCA", Name: "Saint Lucia" },
247
+ { Iso2: "MF", Iso3: "MAF", Name: "Saint Martin (French part)" },
248
+ { Iso2: "PM", Iso3: "SPM", Name: "Saint Pierre and Miquelon" },
249
+ { Iso2: "VC", Iso3: "VCT", Name: "Saint Vincent and the Grenadines" },
250
+ { Iso2: "WS", Iso3: "WSM", Name: "Samoa" },
251
+ { Iso2: "SM", Iso3: "SMR", Name: "San Marino" },
252
+ { Iso2: "ST", Iso3: "STP", Name: "Sao Tome and Principe" },
253
+ { Iso2: "SA", Iso3: "SAU", Name: "Saudi Arabia" },
254
+ { Iso2: "SN", Iso3: "SEN", Name: "Senegal" },
255
+ { Iso2: "RS", Iso3: "SRB", Name: "Serbia" },
256
+ { Iso2: "SC", Iso3: "SYC", Name: "Seychelles" },
257
+ { Iso2: "SL", Iso3: "SLE", Name: "Sierra Leone" },
258
+ { Iso2: "SG", Iso3: "SGP", Name: "Singapore" },
259
+ { Iso2: "SX", Iso3: "SXM", Name: "Sint Maarten (Dutch part)" },
260
+ { Iso2: "SK", Iso3: "SVK", Name: "Slovakia" },
261
+ { Iso2: "SI", Iso3: "SVN", Name: "Slovenia" },
262
+ { Iso2: "SB", Iso3: "SLB", Name: "Solomon Islands" },
263
+ { Iso2: "SO", Iso3: "SOM", Name: "Somalia" },
264
+ { Iso2: "ZA", Iso3: "ZAF", Name: "South Africa" },
265
+ { Iso2: "GS", Iso3: "SGS", Name: "South Georgia and the South Sandwich Islands" },
266
+ { Iso2: "SS", Iso3: "SSD", Name: "South Sudan" },
267
+ { Iso2: "ES", Iso3: "ESP", Name: "Spain" },
268
+ { Iso2: "LK", Iso3: "LKA", Name: "Sri Lanka" },
269
+ { Iso2: "SD", Iso3: "SDN", Name: "Sudan" },
270
+ { Iso2: "SR", Iso3: "SUR", Name: "Suriname" },
271
+ { Iso2: "SJ", Iso3: "SJM", Name: "Svalbard and Jan Mayen" },
272
+ { Iso2: "SZ", Iso3: "SWZ", Name: "Swaziland" },
273
+ { Iso2: "SE", Iso3: "SWE", Name: "Sweden" },
274
+ { Iso2: "CH", Iso3: "CHE", Name: "Switzerland" },
275
+ { Iso2: "SY", Iso3: "SYR", Name: "Syrian Arab Republic" },
276
+ { Iso2: "TW", Iso3: "TWN", Name: "Taiwan, Province Of China" },
277
+ { Iso2: "TJ", Iso3: "TJK", Name: "Tajikistan" },
278
+ { Iso2: "TZ", Iso3: "TZA", Name: "Tanzania, United Republic Of" },
279
+ { Iso2: "TH", Iso3: "THA", Name: "Thailand" },
280
+ { Iso2: "TL", Iso3: "TLS", Name: "Timor-Leste" },
281
+ { Iso2: "TG", Iso3: "TGO", Name: "Togo" },
282
+ { Iso2: "TK", Iso3: "TKL", Name: "Tokelau" },
283
+ { Iso2: "TO", Iso3: "TON", Name: "Tonga" },
284
+ { Iso2: "TT", Iso3: "TTO", Name: "Trinidad and Tobago" },
285
+ { Iso2: "TN", Iso3: "TUN", Name: "Tunisia" },
286
+ { Iso2: "TR", Iso3: "TUR", Name: "Turkey" },
287
+ { Iso2: "TM", Iso3: "TKM", Name: "Turkmenistan" },
288
+ { Iso2: "TC", Iso3: "TCA", Name: "Turks and Caicos Islands" },
289
+ { Iso2: "TV", Iso3: "TUV", Name: "Tuvalu" },
290
+ { Iso2: "UG", Iso3: "UGA", Name: "Uganda" },
291
+ { Iso2: "UA", Iso3: "UKR", Name: "Ukraine" },
292
+ { Iso2: "AE", Iso3: "ARE", Name: "United Arab Emirates", Alternates: ["UAE"] },
293
+ { Iso2: "GB", Iso3: "GBR", Name: "United Kingdom", Alternates: ["England", "Wales", "Scotland", "Northern Ireland", "Great Britain", "Britain", "UK"] },
294
+ { Iso2: "US", Iso3: "USA", Name: "United States", Alternates: ["United States of America", "America"] },
295
+ { Iso2: "UM", Iso3: "UMI", Name: "United States Minor Outlying Islands" },
296
+ { Iso2: "UY", Iso3: "URY", Name: "Uruguay" },
297
+ { Iso2: "UZ", Iso3: "UZB", Name: "Uzbekistan" },
298
+ { Iso2: "VU", Iso3: "VUT", Name: "Vanuatu" },
299
+ { Iso2: "VE", Iso3: "VEN", Name: "Venezuela, Bolivarian Republic Of" },
300
+ { Iso2: "VN", Iso3: "VNM", Name: "Viet Nam" },
301
+ { Iso2: "VG", Iso3: "VGB", Name: "Virgin Islands, British" },
302
+ { Iso2: "VI", Iso3: "VIR", Name: "Virgin Islands, U.S." },
303
+ { Iso2: "WF", Iso3: "WLF", Name: "Wallis and Futuna" },
304
+ { Iso2: "EH", Iso3: "ESH", Name: "Western Sahara" },
305
+ { Iso2: "YE", Iso3: "YEM", Name: "Yemen" },
306
+ { Iso2: "ZM", Iso3: "ZMB", Name: "Zambia" },
307
+ { Iso2: "ZW", Iso3: "ZWE", Name: "Zimbabwe" }
308
+ ];
309
+
310
+ //Simplified service call method takes service name as a string, params as an object, success as callback function(response) and error as callback function(message)
311
+ _pca.fetch = function (service, params, success, error) {
312
+ var _script = _pca.create("script"),
313
+ _head = _document.getElementsByTagName("head")[0],
314
+ _url = _protocol + "//" + _host + "/" + service + "/" + _endpoint,
315
+ _params = "";
316
+
317
+ params = params || {};
318
+ success = success || function () { };
319
+ error = error || function () { };
320
+
321
+ for (var i in params)
322
+ _params += (_params ? "&" : "?") + i + "=" + encodeURIComponent(params[i]);
323
+
324
+ _params += "&CallbackVariable=pca.response";
325
+
326
+ _script.src = _url + _params;
327
+
328
+ _script.onload = _script.onreadystatechange = function () {
329
+ if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") {
330
+ _script.onload = _script.onreadystatechange = null;
331
+ if (_head && _script.parentNode)
332
+ _head.removeChild(_script);
333
+
334
+ //Handle the response
335
+ if (_pca.serviceResponse.length === 1 && _pca.serviceResponse[0].Error !== undefined)
336
+ error(_pca.response[0].Description);
337
+ else
338
+ success(_pca.response);
339
+ }
340
+ }
341
+
342
+ _pca.serviceResponse = "";
343
+ _head.insertBefore(_script, _head.firstChild);
344
+ }
345
+
346
+ _pca.Object = function (source) {
347
+ var _this = source || this;
348
+
349
+ _this.listeners = {};
350
+
351
+ //Listens to a PCA event
352
+ _this.listen = function (event, action) {
353
+ _this.listeners[event] = _this.listeners[event] || [];
354
+ _this.listeners[event].push(action);
355
+ }
356
+
357
+ //Fires an event
358
+ _this.fire = function (event, data) {
359
+ if (_this.listeners[event]) {
360
+ for (var i = 0; i < _this.listeners[event].length; i++)
361
+ _this.listeners[event][i](data);
362
+ }
363
+ }
364
+
365
+ return _this;
366
+ }
367
+
368
+ //A list object to display multiple results and select with filtering and sorting
369
+ _pca.List = function () {
370
+ var _list = new _pca.Object();
371
+
372
+ _list.element = _pca.create("div", { className: "pcalist" });
373
+ _list.defaultClass = "pcalistitem pcadisableselect";
374
+ _list.items = [];
375
+ _list.count = 0;
376
+ _list.selected = null;
377
+ _list.scroll = {
378
+ held: false,
379
+ moved: false,
380
+ origin: 0,
381
+ position: 0,
382
+ x: 0,
383
+ y: 0,
384
+ dx: 0,
385
+ dy: 0
386
+ }
387
+
388
+ //Add a single item to the list
389
+ _list.add = function (data, format, callback) {
390
+
391
+ function addItem(item) {
392
+ var _item = new _pca.Object(),
393
+ _text = _pca.formatLine(item, format);
394
+
395
+ _item.element = _pca.create("li", { innerHTML: _text, className: _list.defaultClass });
396
+ _item.data = item;
397
+ _item.text = _text;
398
+ _item.tag = _pca.formatTag(_text);
399
+ _item.filter = false;
400
+
401
+ _item.select = function () {
402
+ if (!_list.scroll.moved) _list.select(_item.data, callback);
403
+ }
404
+
405
+ _item.highlight = function () {
406
+ _list.highlight(_item.element);
407
+ }
408
+
409
+ _pca.listen(_item.element, "mouseover", _item.highlight);
410
+ _pca.listen(_item.element, "click", _item.select);
411
+ _pca.listen(_item.element, "mousedown", _list.mouseDown);
412
+
413
+ _list.element.appendChild(_item.element);
414
+ _list.items.push(_item);
415
+
416
+ return _item;
417
+ }
418
+
419
+ //If the object is an array then add all of the items, otherwise just add the item
420
+ if (data.constructor == Array) {
421
+ for (var i = 0; i < data.length; i++)
422
+ addItem(data[i]);
423
+ }
424
+ else
425
+ addItem(data);
426
+
427
+ _list.count = _list.element.childNodes.length;
428
+
429
+ return _list;
430
+ }
431
+
432
+ //Clears the list and then populates the item(s)
433
+ _list.populate = function (data, format, callback) {
434
+ _list.clear();
435
+ _list.add(data, format, callback);
436
+ return _list;
437
+ }
438
+
439
+ //Redraws the list, usually done when items have changed, been sorted or filtered
440
+ _list.draw = function () {
441
+ while (_list.element.childNodes.length)
442
+ _list.element.removeChild(_list.element.childNodes[0]);
443
+
444
+ _list.count = 0;
445
+ _list.selectedItem = null;
446
+
447
+ for (var i = 0; i < _list.items.length; i++) {
448
+ if (!_list.items[i].filter) {
449
+ _list.element.appendChild(_list.items[i].element);
450
+ _list.count++;
451
+ }
452
+ }
453
+
454
+ return _list;
455
+ }
456
+
457
+ _list.select = function (item, callback) {
458
+ callback(item);
459
+
460
+ return _list;
461
+ }
462
+
463
+ _list.filter = function (pattern, beginning) {
464
+ var _pattern = _pca.formatTag(pattern);
465
+
466
+ for (var i = 0; i < _list.items.length; i++)
467
+ _list.items[i].filter = beginning ? _list.items[i].tag.substring(0, _pattern.length) != _pattern : ! ~_list.items[i].tag.indexOf(_pattern);
468
+
469
+ _list.fire("filter", pattern);
470
+
471
+ return _list;
472
+ }
473
+
474
+ _list.sort = function (reverse, field) {
475
+ var _field = field || "Text";
476
+
477
+ if (_list[_field])
478
+ _list.items.sort(function (a, b) { return (reverse ? a[_field] > b[_field] : a[_field] < b[_field]) });
479
+ else
480
+ _list.items.sort(function (a, b) { return (reverse ? a.data[_field] > b.data[_field] : a.data[_field] < b.data[_field]) });
481
+
482
+ _list.fire("sort");
483
+
484
+ return _list;
485
+ }
486
+
487
+ _list.clear = function () {
488
+ _list.items = [];
489
+ _list.selectedItem = null;
490
+
491
+ while (_list.element.childNodes.length)
492
+ _list.element.removeChild(_list.element.childNodes[0]);
493
+
494
+ _list.count = 0;
495
+ _list.hide();
496
+ _list.fire("clear");
497
+
498
+ return _list;
499
+ }
500
+
501
+ _list.setScroll = function (position) {
502
+ _list.element.scrollTop = position;
503
+ }
504
+
505
+ //Mouse events
506
+ _list.mouseDown = function (event) {
507
+ var _event = event || window.event;
508
+
509
+ _list.scroll.held = true;
510
+ _list.scroll.moved = false;
511
+ _list.scroll.origin = parseInt(_list.element.scrollTop);
512
+ _list.scroll.y = parseInt(_event.screenY);
513
+ }
514
+
515
+ _list.mouseOut = function () {
516
+ _list.scroll.held = false;
517
+ }
518
+
519
+ _list.mouseUp = function () {
520
+ _list.scroll.held = false;
521
+ }
522
+
523
+ _list.mouseMove = function (event) {
524
+ if (_list.scroll.held) {
525
+ var _event = event || window.event;
526
+
527
+ _list.scroll.dy = _list.scroll.y - parseInt(_event.screenY);
528
+ _list.scroll.position = _list.scroll.origin + _list.scroll.dy;
529
+ _list.setScroll(_list.scroll.position);
530
+ _list.scroll.moved = true;
531
+ _event.returnValue = false;
532
+ }
533
+ }
534
+
535
+ //Touch events
536
+ _list.touchStart = function (event) {
537
+ var _event = event || window.event;
538
+
539
+ _list.scroll.held = true;
540
+ _list.scroll.moved = false;
541
+ _list.scroll.origin = parseInt(_list.scrollTop);
542
+ _list.scroll.y = parseInt(_event.touches[0].pageY);
543
+ }
544
+
545
+ _list.touchEnd = function () {
546
+ _list.scroll.held = false;
547
+ }
548
+
549
+ _list.touchCancel = function () {
550
+ _list.scroll.held = false;
551
+ }
552
+
553
+ _list.touchMove = function (event) {
554
+ if (_list.scroll.held) {
555
+ var _event = event || window.event;
556
+
557
+ //Disable Gecko and Webkit image drag
558
+ if (_event.preventDefault)
559
+ _event.preventDefault();
560
+
561
+ _list.scroll.dy = _list.scroll.y - parseInt(_event.touches[0].pageY);
562
+ _list.scroll.position = _list.scroll.origin + _list.scroll.dy;
563
+ _list.setScroll(_list.scroll.position);
564
+ _list.scroll.moved = true;
565
+ _event.returnValue = false;
566
+ }
567
+ }
568
+
569
+ //Keyboard events
570
+ _list.keySelect = function (key) {
571
+ switch (key) {
572
+ case 40: //Down
573
+ if (!_list.selectedItem)
574
+ _list.selectFirst();
575
+ else
576
+ _list.selectNext();
577
+ return true;
578
+ case 38: //Up
579
+ if (!_list.selectedItem)
580
+ _list.selectLast();
581
+ else
582
+ _list.selectPrevious();
583
+ return true;
584
+ case 13: //Enter/Return
585
+ if (_list.selectedItem) {
586
+ for (var i = 0; i < _list.items.length; i++) {
587
+ if (_list.items[i].element == _list.selectedItem) {
588
+ _list.items[i].select();
589
+ break;
590
+ }
591
+ }
592
+ }
593
+ return true;
594
+ case 27: //Escape
595
+ _list.hide();
596
+ return true;
597
+ }
598
+
599
+ return false;
600
+ }
601
+
602
+ _list.selectFirst = function () {
603
+ if (_list.element.childNodes.length)
604
+ _list.highlight(_list.element.childNodes[0], true);
605
+ }
606
+
607
+ _list.selectLast = function () {
608
+ if (_list.element.childNodes.length)
609
+ _list.highlight(_list.element.childNodes[_list.element.childNodes.length - 1], true);
610
+ }
611
+
612
+ _list.selectNext = function () {
613
+ if (_list.selectedItem && _list.selectedItem.nextSibling)
614
+ _list.highlight(_list.selectedItem.nextSibling, true);
615
+ else
616
+ _list.selectFirst();
617
+ }
618
+
619
+ _list.selectPrevious = function () {
620
+ if (_list.selectedItem && _list.selectedItem.previousSibling)
621
+ _list.highlight(_list.selectedItem.previousSibling, true);
622
+ else
623
+ _list.selectLast();
624
+ }
625
+
626
+ _list.highlight = function (element, scrollTo) {
627
+ if (_list.selectedItem)
628
+ _list.selectedItem.className = _list.defaultClass;
629
+
630
+ element.className = _list.defaultClass + " pcaselected";
631
+ _list.selectedItem = element;
632
+
633
+ if (scrollTo) _list.scrollToItem(element);
634
+
635
+ return _list;
636
+ }
637
+
638
+ _list.scrollToItem = function (element) {
639
+ _list.scroll.position = _list.element.scrollTop;
640
+
641
+ if (element.offsetTop < _list.scroll.position) {
642
+ _list.scroll.position = element.offsetTop;
643
+ _list.setScroll(_list.scroll.position);
644
+ }
645
+ else {
646
+ if (element.offsetTop + element.offsetHeight > _list.scroll.position + _list.element.offsetHeight) {
647
+ _list.scroll.position = element.offsetTop + element.offsetHeight - _list.element.offsetHeight;
648
+ _list.setScroll(_list.scroll.position);
649
+ }
650
+ }
651
+
652
+ return _list;
653
+ }
654
+
655
+ _pca.listen(_document, "mouseup", _list.mouseUp);
656
+ _pca.listen(_document, "mousemove", _list.mouseMove);
657
+
658
+ _pca.listen(_list.element, "touchstart", _list.touchStart);
659
+ _pca.listen(_list.element, "touchmove", _list.touchMove);
660
+ _pca.listen(_list.element, "touchend", _list.touchEnd);
661
+ _pca.listen(_list.element, "touchcancel", _list.touchCancel);
662
+
663
+ return _list;
664
+ }
665
+
666
+ //Creates an autocomplete which filters on the field value
667
+ //Inherits from list
668
+ _pca.AutoComplete = function (field, filterBeginning) {
669
+ var _autocomplete = new _pca.List(),
670
+ _anchor = _pca.create("table", { className: "pcaautocomplete pcatext", cellPadding: 0, cellSpacing: 0 }),
671
+ _chain = [_anchor.insertRow(0).insertCell(0), _anchor.insertRow(1).insertCell(0)];
672
+
673
+ _autocomplete.field = null;
674
+ _autocomplete.visible = false;
675
+ _autocomplete.mouseover = false;
676
+ _autocomplete.focus = false;
677
+
678
+ _autocomplete.anchor = function (field) {
679
+ _autocomplete.field = _pca.getInput(field);
680
+
681
+ _autocomplete.field.parentNode.insertBefore(_anchor, _autocomplete.field);
682
+ _chain[0].appendChild(_autocomplete.field);
683
+ _chain[1].appendChild(_autocomplete.element);
684
+
685
+ _pca.listen(_autocomplete.field, "keyup", _autocomplete.keyup);
686
+ _pca.listen(_autocomplete.field, "focus", _autocomplete.focused);
687
+ _pca.listen(_autocomplete.field, "blur", _autocomplete.blurred);
688
+
689
+ return _autocomplete;
690
+ }
691
+
692
+ _autocomplete.show = function () {
693
+ if (_autocomplete.count) {
694
+ _autocomplete.visible = true;
695
+ _autocomplete.element.style.display = "";
696
+ _autocomplete.setScroll(0);
697
+ }
698
+ return _autocomplete;
699
+ }
700
+
701
+ _autocomplete.hide = function () {
702
+ _autocomplete.visible = false;
703
+ _autocomplete.element.style.display = "none";
704
+ return _autocomplete;
705
+ }
706
+
707
+ _autocomplete.focused = function () {
708
+ _autocomplete.focus = true;
709
+ _autocomplete.show();
710
+ }
711
+
712
+ _autocomplete.blurred = function () {
713
+ _autocomplete.focus = false;
714
+
715
+ if (!_autocomplete.mouseover)
716
+ _autocomplete.hide();
717
+ }
718
+
719
+ _autocomplete.select = function (item, callback) {
720
+ callback(item);
721
+ return _autocomplete;
722
+ }
723
+
724
+ _autocomplete.keyup = function (event) {
725
+ var _key = window.event ? window.event.keyCode : event.which;
726
+
727
+ if (_autocomplete.visible) {
728
+ if (!_autocomplete.keySelect(_key)) {
729
+ _autocomplete.filter(_pca.getValue(_autocomplete.field), filterBeginning).draw();
730
+ if (!_autocomplete.count) _autocomplete.hide();
731
+ _autocomplete.fire("keyup", _key);
732
+ }
733
+ }
734
+ else if (_key == 40) //Key down to show list
735
+ _autocomplete.show();
736
+ else if (_key == 8 || _key == 46) //Backspace or Delete
737
+ _autocomplete.filter(_pca.getValue(_autocomplete.field), filterBeginning).draw().show();
738
+ else
739
+ _autocomplete.fire("keyup", _key);
740
+ }
741
+
742
+ if (field) _autocomplete.anchor(field);
743
+ _pca.listen(_anchor, "mouseover", function () { _autocomplete.mouseover = true });
744
+ _pca.listen(_anchor, "mouseout", function () { _autocomplete.mouseover = false });
745
+ _autocomplete.hide();
746
+
747
+ return _autocomplete;
748
+ }
749
+
750
+ //Creates a modal popup window to display results
751
+ //Inherits from list
752
+ _pca.Modal = function () {
753
+ var _modal = new _pca.List(),
754
+ _mask = _pca.create("div", { className: "pcamask pcafullscreen" }),
755
+ _container = _pca.create("div", { className: "pcamodal pcatext" }),
756
+ _border = _pca.create("div", { className: "pcaborder" }),
757
+ _background = _pca.create("div", { className: "pcabackground" });
758
+
759
+ _modal.visible = false;
760
+
761
+ _modal.show = function () {
762
+ _mask.style.display = "";
763
+ _container.style.display = "";
764
+ _container.visible = true;
765
+ _modal.centre();
766
+ _modal.setScroll(0);
767
+ return _modal;
768
+ }
769
+
770
+ _modal.hide = function () {
771
+ _mask.style.display = "none";
772
+ _container.style.display = "none";
773
+ _container.visible = false;
774
+ return _modal;
775
+ }
776
+
777
+ //position the modal popup in the centre of the window
778
+ _modal.centre = function () {
779
+ _container.style.left = (Math.max(_document.documentElement.clientWidth, _document.body.scrollWidth, _document.body.offsetWidth) / 2) - (_container.offsetWidth / 2) + "px";
780
+ _container.style.top = (Math.max(_document.documentElement.clientHeight, _document.body.scrollHeight, _document.body.offsetHeight) / 2) - (_container.offsetHeight / 2) + "px";
781
+ return _modal;
782
+ }
783
+
784
+ _modal.select = function (item, callback) {
785
+ callback(item);
786
+ return _modal;
787
+ }
788
+
789
+ _document.body.appendChild(_mask);
790
+ _document.body.appendChild(_container);
791
+ _container.appendChild(_border);
792
+ _container.appendChild(_background);
793
+ _background.appendChild(_modal.element);
794
+
795
+ _pca.listen(_mask, "click", _modal.hide);
796
+ _modal.hide();
797
+
798
+ return _modal;
799
+ }
800
+
801
+ //Creates a select list with countries in
802
+ _pca.CountryAutoComplete = function (options) {
803
+ var _countryAutoComplete = new _pca.AutoComplete(options.field, true);
804
+
805
+ _countryAutoComplete.select = function (country) {
806
+ pca.setValue(pca.getInput(_countryAutoComplete.field), country.Name);
807
+ _countryAutoComplete.hide();
808
+ }
809
+
810
+ _countryAutoComplete.populate = function (filter) {
811
+ var _filter = typeof (filter) == "string" && filter ? filter.split(",") : filter || [];
812
+
813
+ if (_filter.length) {
814
+ for (var i = 0; i < _filter.length; i++) {
815
+ for (var c = 0; c < _pca.countries.length; c++) {
816
+ if (_filter[i] == _pca.countries[c].Iso3)
817
+ _countryAutoComplete.add(_pca.countries[c], "{Name}", _countryAutoComplete.select);
818
+ }
819
+ }
820
+ }
821
+ else {
822
+ for (var c = 0; c < _pca.countries.length; c++)
823
+ _countryAutoComplete.add(_pca.countries[c], "{Name}", _countryAutoComplete.select);
824
+ }
825
+
826
+ return _countryAutoComplete;
827
+ }
828
+
829
+ _countryAutoComplete.populate(options.filter);
830
+
831
+ return _countryAutoComplete;
832
+ }
833
+
834
+ //Creates a select list, can be used to select country or address options
835
+ _pca.Select = function () {
836
+ var _select = new _pca.Object();
837
+
838
+ _select.element = _pca.create("select", { className: "pcaselect" });
839
+ _select.callback = typeof callback == 'function' ? callback : function () { };
840
+
841
+ _select.populate = function (data, textFormat, valueFormat) {
842
+ for (var i = 0; i < data.length; i++)
843
+ _select.add(data[i], textFormat, valueFormat);
844
+
845
+ return _select;
846
+ }
847
+
848
+ _select.add = function (item, textFormat, valueFormat) {
849
+ _select.element.options.add(new Option(_pca.formatLine(item, textFormat), _pca.formatLine(item, valueFormat)));
850
+ return _select;
851
+ }
852
+
853
+ _select.clear = function () {
854
+ _select.element.options.length = 0;
855
+ return _select;
856
+ }
857
+
858
+ _select.select = function (value) {
859
+ for (var i = 0; i < _select.element.options.length; i++) {
860
+ if (_select.element.options[i].value == value || _select.element.options[i].text == value) {
861
+ _select.element.selectedIndex = i;
862
+ break;
863
+ }
864
+ }
865
+
866
+ return _select;
867
+ }
868
+
869
+ _select.reset = function () {
870
+ _select.element.selectedIndex = 0;
871
+ return _select;
872
+ }
873
+
874
+ _select.selectedValue = function () {
875
+ return _select.element.options[_select.element.selectedIndex].value;
876
+ }
877
+
878
+ _select.selectedText = function () {
879
+ return _select.element.options[_select.element.selectedIndex].text;
880
+ }
881
+
882
+ _pca.listen(_select.element, 'change', function () { _select.fire("change", _select.selectedValue); });
883
+
884
+ return _select;
885
+ }
886
+
887
+ //Creates a select list with countries in
888
+ _pca.CountrySelect = function (options) {
889
+ var _countrySelect = new _pca.Select();
890
+
891
+ _countrySelect.field = null;
892
+ _countrySelect.format = options.format || _pca.CountryNameType.FullName;
893
+
894
+ _countrySelect.selectedCountry = function () {
895
+ return _pca.getCountry(_countrySelect.selectedValue());
896
+ }
897
+
898
+ _countrySelect.updateField = function () {
899
+ _pca.setValue(_countrySelect.field, _countrySelect.selectedCountry()[_countrySelect.format]);
900
+
901
+ return _countrySelect;
902
+ }
903
+
904
+ _countrySelect.syncCountry = function (value) {
905
+ _countrySelect.select(_pca.getCountry(value).Iso3);
906
+ _countrySelect.updateField();
907
+
908
+ return _countrySelect;
909
+ }
910
+
911
+ _countrySelect.populate = function (filter) {
912
+ var _filter = typeof (filter) == "string" && filter ? filter.split(",") : filter || [];
913
+
914
+ if (_filter.length) {
915
+ for (var i = 0; i < _filter.length; i++) {
916
+ for (var c = 0; c < _pca.countries.length; c++) {
917
+ if (_filter[i] == _pca.countries[c].Iso3)
918
+ _countrySelect.add(_pca.countries[c], "{Name}", "{Iso3}");
919
+ }
920
+ }
921
+ }
922
+ else {
923
+ for (var c = 0; c < _pca.countries.length; c++)
924
+ _countrySelect.add(_pca.countries[c], "{Name}", "{Iso3}");
925
+ }
926
+
927
+ return _countrySelect;
928
+ }
929
+
930
+ _countrySelect.replace = function (field) {
931
+ _countrySelect.field = _pca.getInput(field);
932
+ _countrySelect.field.parentNode.insertBefore(_countrySelect.element, _countrySelect.field);
933
+ _countrySelect.field.style.display = "none";
934
+
935
+ _countrySelect.syncCountry(_pca.getValue(_countrySelect.field))
936
+
937
+ _countrySelect.listen('change', _countrySelect.updateField)
938
+
939
+ return _countrySelect;
940
+ }
941
+
942
+ _countrySelect.populate(options.filter);
943
+ if (options.field) _countrySelect.replace(options.field);
944
+
945
+ return _countrySelect;
946
+ }
947
+
948
+ //Draw an advanced search form with the given fields, calls the callback with the field values
949
+ _pca.Advanced = function (fields, callback) {
950
+ var _form = new _pca.Object();
951
+
952
+ _form.element = _pca.create("div", { className: "pcaform" });
953
+
954
+ //draw fields
955
+
956
+ //add button for search
957
+ }
958
+
959
+ //Draw a confirmation window, calls the callback upon confirmation
960
+ _pca.Confirm = function (html, callback) {
961
+ var _confirm = new _pca.Object();
962
+
963
+ _confirm.element = _pca.create("div", { className: "pcaconfirm" });
964
+
965
+ //draw the html
966
+
967
+ //add button for confirm and cancel
968
+ }
969
+
970
+ //Create a command button
971
+ _pca.Button = function (text, func) {
972
+ var _button = new _pca.Object();
973
+
974
+ _button.element = _pca.create("input", { type: "button", value: text, className: "pcatext pcabutton pcagradient", onclick: func });
975
+
976
+ return _button;
977
+ }
978
+
979
+ //Create a command link
980
+ _pca.Link = function (text, func) {
981
+ var _link = new _pca.Object();
982
+
983
+ _link.element = _pca.create("a", { innerHTML: text, onclick: func, className: "pcatext pcalink" });
984
+
985
+ return _link;
986
+ }
987
+
988
+ //Formats a line by replacing tags in the form {Property} with the corresponding property value or method result from the item object
989
+ _pca.formatLine = function (item, format) {
990
+ return format.replace(/\{(\w+)\}/g, function (m, c) { return (typeof item[c] == 'function' ? item[c]() : item[c]) || ""; });
991
+ }
992
+
993
+ //Formats a line into a simplified tag for filtering
994
+ _pca.formatTag = function (line) {
995
+ return _pca.replaceList(_pca.replaceList((line || "").toUpperCase(), _pca.diacritics), _pca.synonyms);
996
+ }
997
+
998
+ //Performs all replacements in a list
999
+ _pca.replaceList = function (line, list) {
1000
+ for (var i = 0; i < list.length; i++)
1001
+ line = line.replace(list[i].r, list[i].w);
1002
+ return line;
1003
+ }
1004
+
1005
+ //Gets the first words from a string
1006
+ _pca.getText = function (line) {
1007
+ return /[a-zA-Z][a-zA-Z\s]+[a-zA-Z]/.exec(line);
1008
+ }
1009
+
1010
+ //Gets the first number from a string
1011
+ _pca.getNumber = function (line) {
1012
+ return /\d+/.exec(line);
1013
+ }
1014
+
1015
+ //Merges one objects properties into another
1016
+ _pca.merge = function (source, destination) {
1017
+ for (var i in source)
1018
+ if (!destination[i]) destination[i] = source[i];
1019
+ }
1020
+
1021
+ //Gets the country name from
1022
+ _pca.getCountry = function (reference) {
1023
+ if (!reference || typeof reference != 'string')
1024
+ return "";
1025
+
1026
+ reference = reference.toUpperCase();
1027
+
1028
+ for (var i = 0; i < _pca.countries.length; i++) {
1029
+ var country = _pca.countries[i];
1030
+
1031
+ if (reference == country.Iso2.toUpperCase() || reference == country.Iso3.toUpperCase() || reference == country.Name.toUpperCase())
1032
+ return country;
1033
+ else if (country.Alternates) {
1034
+ for (var a = 0; a < country.Alternates.length; a++) {
1035
+ if (reference == country.Alternates[a].toUpperCase())
1036
+ return country;
1037
+ }
1038
+ }
1039
+ }
1040
+ }
1041
+
1042
+ //Find a DOM element from a pca reference
1043
+ _pca.getInput = function (reference, base) {
1044
+ var _tags = ['input', 'textarea', 'select'],
1045
+ _matches = [],
1046
+ _base = base || _document,
1047
+ _exact = null;
1048
+
1049
+ if (!reference || reference == "")
1050
+ return null;
1051
+
1052
+ if (reference.tagName) {
1053
+ for (var t = 0; t < _tags.length; t++) {
1054
+ if (reference.tagName == _tags[t].toUpperCase())
1055
+ return reference;
1056
+ }
1057
+ }
1058
+
1059
+ _exact = _base.getElementById(reference);
1060
+
1061
+ if (_exact)
1062
+ return _exact;
1063
+
1064
+ for (var t = 0; t < _tags.length; t++) {
1065
+ var _fields = _base.getElementsByTagName(_tags[t]);
1066
+
1067
+ for (var f in _fields) {
1068
+ var _id = _fields[f].id || "",
1069
+ _name = _fields[f].name || "";
1070
+
1071
+ if (_fields[f] == reference)
1072
+ return _fields[f];
1073
+ else if (typeof (reference) == 'string' && _id) {
1074
+ if (_id == reference)
1075
+ return _fields[f];
1076
+
1077
+ if (_id.indexOf(reference) > 0)
1078
+ _matches.push(_fields[f]);
1079
+ }
1080
+ else if (typeof (reference) == 'string' && _name) {
1081
+ if (_name == reference)
1082
+ return _fields[f];
1083
+ }
1084
+ }
1085
+ }
1086
+
1087
+ if (_matches.length > 0)
1088
+ return _matches[0];
1089
+ else
1090
+ return null;
1091
+ }
1092
+
1093
+ //Get the value of a DOM element
1094
+ _pca.getValue = function (element) {
1095
+ if (element) {
1096
+ if (!element.tagName)
1097
+ element = _pca.getInput(element);
1098
+
1099
+ if (element.tagName == "INPUT" || element.tagName == "TEXTAREA") {
1100
+ if (element.type == "text" || element.type == "textarea")
1101
+ return element.value;
1102
+ if (element.type == "checkbox")
1103
+ return element.checked;
1104
+ }
1105
+ if (element.tagName == "SELECT")
1106
+ return element.options[element.selectedIndex].value;
1107
+ }
1108
+
1109
+ return "";
1110
+ }
1111
+
1112
+ //Set the value of a DOM element
1113
+ _pca.setValue = function (element, value) {
1114
+
1115
+ _pca.debug(element + " - " + value);
1116
+
1117
+ if (element && (value || value == '')) {
1118
+ if (!element.tagName)
1119
+ element = _pca.getInput(element);
1120
+
1121
+ if (element.tagName == "INPUT" || element.tagName == "TEXTAREA") {
1122
+ if (element.type == "text" || element.type == "textarea")
1123
+ element.value = value;
1124
+ if (element.type == "checkbox")
1125
+ element.checked = ((typeof (value) == "boolean" && value) || value == "True");
1126
+ }
1127
+ if (element.tagName == "SELECT") {
1128
+ for (var s = 0; s < element.options.length; s++) {
1129
+ if (element.options[s].value == value || element.options[s].text == value) {
1130
+ element.selectedIndex = s;
1131
+ break;
1132
+ }
1133
+ }
1134
+ }
1135
+ }
1136
+ }
1137
+
1138
+ //Simple function to create an element
1139
+ _pca.create = function (tag, properties, cssText) {
1140
+ var _elem = _document.createElement(tag)
1141
+ for (var i in properties || {})
1142
+ _elem[i] = properties[i];
1143
+ if (cssText) _elem.style.cssText = cssText;
1144
+ return _elem;
1145
+ }
1146
+
1147
+ //Listens to an event with standard DOM event handling
1148
+ _pca.listen = function (target, event, action) {
1149
+ if (window.addEventListener)
1150
+ target.addEventListener(event, action, false);
1151
+ else
1152
+ target.attachEvent('on' + event, action);
1153
+ }
1154
+
1155
+ //PCA debug messages. Just add a div with an id of "pcadebug"
1156
+ _pca.debug = function (message) {
1157
+ var _degbug = document.getElementById("pcadebug");
1158
+
1159
+ if (_degbug)
1160
+ _degbug.innerHTML = message;
1161
+ }
1162
+ })(window);
1163
+
1164
+ (function (window, undefined) {
1165
+ var _pca = window.pca,
1166
+ _document = window.document;
1167
+
1168
+ _pca.Addresses = _pca.Addresses || [];
1169
+
1170
+ //Main address component
1171
+ _pca.Address = function (fields, options) {
1172
+ var _uid = _pca.Addresses.length,
1173
+ _this = _pca.Addresses[_uid] = new _pca.Object(this);
1174
+
1175
+ //options
1176
+ _this.key = options.key || "";
1177
+ _this.countryFormat = options.countryFormat || _pca.CountryNameType.Name;
1178
+
1179
+ _this.dataSourceOptions = options.dataSourceOptions || {};
1180
+ _this.dataSourceOptions.international = typeof _this.dataSourceOptions.international == 'boolean' ? _this.dataSourceOptions.international : true;
1181
+ _this.dataSourceOptions.royalMail = typeof _this.dataSourceOptions.royalMail == 'boolean' ? _this.dataSourceOptions.royalMail : false;
1182
+ _this.dataSourceOptions.usps = typeof _this.dataSourceOptions.usps == 'boolean' ? _this.dataSourceOptions.usps : false;
1183
+
1184
+ _this.resultsListOptions = options.resultsListOptions || {};
1185
+ _this.resultsListOptions.type = _this.resultsListOptions.type || _pca.ListType.Modal;
1186
+ _this.resultsListOptions.field = _this.resultsListOptions.field || "";
1187
+
1188
+ _this.countryListOptions = options.countryListOptions || {};
1189
+ _this.countryListOptions.type = "Country" + (_this.countryListOptions.type || _pca.ListType.Select);
1190
+ _this.countryListOptions.field = _this.countryListOptions.field || "";
1191
+ _this.countryListOptions.filter = _this.countryListOptions.filter || "";
1192
+ _this.countryListOptions.callback = _this.countryListOptions.callback || function () { };
1193
+ _this.countryListOptions.format = _this.countryFormat;
1194
+
1195
+ //local objects
1196
+ _this.resultsList = null;
1197
+ _this.countryList = null;
1198
+ _this.listeners = {};
1199
+
1200
+ //initialises the control
1201
+ _this.setup = function () {
1202
+ _this.resultsList = new pca[_this.resultsListOptions.type]();
1203
+
1204
+ if (_this.resultsList.anchor && _this.resultsListOptions.field) {
1205
+ _this.resultsList.anchor(_pca.getInput(_this.resultsListOptions.field));
1206
+ _this.resultsList.listen("keyup", _this.checkForBuildingNumber);
1207
+ }
1208
+
1209
+ if (_this.countryListOptions.field)
1210
+ _this.countryList = new _pca[_this.countryListOptions.type](_this.countryListOptions);
1211
+ }
1212
+
1213
+ //Calculate the value of an address line
1214
+ _this.getAddressValue = function (reference, address) {
1215
+ var _addrLine;
1216
+
1217
+ //Formats an address line using the PCA format
1218
+ function formatLine(format, address) {
1219
+ var _formatNumber = parseInt(format.substring(9, 10)),
1220
+ _formatCount = parseInt(format.substring(11, 12)),
1221
+ _seperateCompany = format.length < 15 || !address.Company,
1222
+ _lineCount = 0,
1223
+ _result = "";
1224
+
1225
+ if (!address.Line1)
1226
+ _lineCount = 0
1227
+ else if (!address.Line2)
1228
+ _lineCount = 1
1229
+ else if (!address.Line3)
1230
+ _lineCount = 2
1231
+ else if (!address.Line4)
1232
+ _lineCount = 3
1233
+ else if (!address.Line5)
1234
+ _lineCount = 4
1235
+ else
1236
+ _lineCount = 5;
1237
+
1238
+ if (!_seperateCompany)
1239
+ _lineCount++;
1240
+
1241
+ //work out the current line number and how many address elements should appear on it
1242
+ var _start = Math.floor((_lineCount / _formatCount) * (_formatNumber - 1)) + 1,
1243
+ _lines = (Math.floor((_lineCount / _formatCount) * _formatNumber)) - (_start - 1);
1244
+
1245
+ if (!_seperateCompany)
1246
+ _start--;
1247
+
1248
+ //concatenate the address elements to make the address line
1249
+ for (var a = 0; a < _lines; a++) {
1250
+ if (!(a + _start))
1251
+ _result += address.Company || "";
1252
+ else
1253
+ _result += (_result ? ", " : "") + (address["Line" + (a + _start)] || "");
1254
+ }
1255
+
1256
+ return _result;
1257
+ }
1258
+
1259
+ //Work out which values to use
1260
+ switch (reference.toUpperCase()) {
1261
+ case "ID":
1262
+ case "PAF-ID":
1263
+ case "UDPRN":
1264
+ _addrLine = address.Udprn;
1265
+ break;
1266
+ case "COMPANY":
1267
+ case "PAF-COMPANY":
1268
+ _addrLine = address.Company;
1269
+ break;
1270
+ case "BUILDINGNUMBER":
1271
+ case "PAF-BUILDING-NUMBER":
1272
+ _addrLine = address.BuildingNumber || address.Building;
1273
+ break;
1274
+ case "BUILDINGNAME":
1275
+ case "PAF-BUILDING-NAME":
1276
+ _addrLine = address.BuildingName;
1277
+ break;
1278
+ case "BUILDING":
1279
+ case "PAF-BUILDING":
1280
+ _addrLine = (address.SubBuilding + ' ' + address.BuildingName + ' ' + address.BuildingNumber).replace(/^\s+/, '') || address.Building;
1281
+ break;
1282
+ case "PAF-FLAT":
1283
+ _addrLine = address.SubBuilding;
1284
+ break;
1285
+ case "PAF-BUILDING-NAME-NUMBER":
1286
+ _addrLine = (address.BuildingName + ' ' + address.BuildingNumber).replace(/^\s+/, '') || address.Building;
1287
+ break;
1288
+ case "STREET":
1289
+ _addrLine = address.Description || address.Street || address.PrimaryStreet;
1290
+ break;
1291
+ case "PAF-STREET":
1292
+ _addrLine = (address.SecondaryStreet == "" ? address.PrimaryStreet : (address.SecondaryStreet + ", " + address.PrimaryStreet).replace(/^\s+/, '')) || address.Street;
1293
+ break;
1294
+ case "DISTRICT":
1295
+ case "PAF-DISTRICT":
1296
+ _addrLine = address.DependentLocality || address.District;
1297
+ break;
1298
+ case "CITY":
1299
+ case "TOWN":
1300
+ case "PAF-TOWN":
1301
+ _addrLine = address.City || address.PostTown;
1302
+ break;
1303
+ case "STATE":
1304
+ case "STATECODE":
1305
+ case "COUNTY":
1306
+ case "PAF-COUNTY":
1307
+ _addrLine = address.State || address.StateCode || address.County;
1308
+ break;
1309
+ case "STATENAME":
1310
+ _addrLine = address.State || address.StateName || address.County;
1311
+ break;
1312
+ case "ADMIN":
1313
+ case "ADMINAREA":
1314
+ case "US-COUNTY":
1315
+ _addrLine = address.AdminArea || address.CountyName;
1316
+ break;
1317
+ case "POSTALCODE":
1318
+ case "POSTCODE":
1319
+ case "ZIP":
1320
+ case "ZIP4":
1321
+ case "PAF-POSTCODE":
1322
+ _addrLine = address.PostalCode || address.Postcode || address.Zip;
1323
+ break;
1324
+ case "COUNTRY":
1325
+ case "PAF-COUNTRY":
1326
+ _addrLine = _pca.getCountry(address.CountryIso3 || address.Country || address.CountryName)[_this.countryFormat];
1327
+ break;
1328
+ case "COUNTRYNAME":
1329
+ _addrLine = _pca.getCountry(address.CountryIso3 || address.Country || address.CountryName).Name;
1330
+ break;
1331
+ case "COUNTRYCODE":
1332
+ case "COUNTRYISO3":
1333
+ _addrLine = _pca.getCountry(address.CountryIso3 || address.Country || address.CountryName).Iso3;
1334
+ break;
1335
+ case "COUNTRYISO2":
1336
+ _addrLine = _pca.getCountry(address.CountryIso3 || address.Country || address.CountryName).Iso2;
1337
+ break;
1338
+ default:
1339
+ if (/^PAF-LINE-[\d]-[\d]/.test(reference))
1340
+ _addrLine = formatLine(reference, address);
1341
+ else
1342
+ _addrLine = address[reference];
1343
+ break;
1344
+ }
1345
+
1346
+ return _addrLine;
1347
+ }
1348
+
1349
+ //Adds Line1, Line2 to international address
1350
+ _this.addAddressLines = function (addresses) {
1351
+ for (var i = 0; i < addresses.length; i++) {
1352
+ var address = addresses[i];
1353
+ address.Line1 = address.Description || address.Street;
1354
+ address.Line2 = address.District;
1355
+ }
1356
+ }
1357
+
1358
+ //Waits for a building number to be entered into the street/line1 field
1359
+ _this.checkForBuildingNumber = function () {
1360
+ var _building = /^\d+(?=\s$)/.exec(_pca.getValue(_this.resultsList.field).toString());
1361
+ if (_building) _this.fire("building", _building);
1362
+ }
1363
+
1364
+ //Search using generic find services
1365
+ _this.search = function (line1, locality, postcode, country) {
1366
+ var _line1 = line1 || "",
1367
+ _building = _pca.getNumber(_line1) || "",
1368
+ _street = _pca.getText(_line1) || "",
1369
+ _locality = locality || "",
1370
+ _postcode = postcode || "",
1371
+ _country = _pca.getCountry(country || _pca.getValue(_this.countryList)).Iso3 || "";
1372
+
1373
+ if (_postcode && (!_street || (_country != "GBR" && _country != "USA"))) //Temp fix for lack of international by address
1374
+ _this.searchByPostcode(_country, _postcode, _building);
1375
+ else if ((_street && !(_postcode || _locality)) || (_country != "GBR" && _country != "USA")) //Temp fix for lack of international by address
1376
+ _this.searchByStreet(_country, _street, _building);
1377
+ else if (_line1 && (_postcode || _locality)) {
1378
+ var _terms = [_line1];
1379
+ if (_locality) _terms.push(_locality);
1380
+ if (_postcode) _terms.push(_postcode);
1381
+ _this.searchByAddress(_country, _terms.join(","));
1382
+ }
1383
+ }
1384
+
1385
+ //Searches for a whole address
1386
+ _this.searchByAddress = function (country, address) {
1387
+ var _country = _pca.getCountry(country || _pca.getValue(_this.countryList)).Iso3 || "",
1388
+ _address = address || "";
1389
+
1390
+ function royalMailCleanseResult(response) {
1391
+ if (response.length == 1)
1392
+ _this.select(response[0]);
1393
+
1394
+ _this.resultsList.clear();
1395
+ }
1396
+
1397
+ function uspsAddressResult(response) {
1398
+ if (response.length == 1)
1399
+ _this.select(response[0]);
1400
+
1401
+ _this.resultsList.clear();
1402
+ }
1403
+
1404
+ if (_country == "GBR" && _this.dataSourceOptions.royalMail)
1405
+ _pca.fetch("CleansePlus/Interactive/Cleanse/v1.00", { Key: _this.key, Address: _address }, royalMailCleanseResult);
1406
+ else if (_country == "USA" && _this.dataSourceOptions.usps)
1407
+ _pca.fetch("PostcodeAnywhereInternational/InteractiveUSA/RetrieveByAddress/v1.00", { Key: _this.key, Address: _address }, uspsAddressResult);
1408
+ }
1409
+
1410
+ //Searches for an address by postcode using building information
1411
+ _this.searchByPostcode = function (country, postcode, building) {
1412
+ var _country = _pca.getCountry(country || _pca.getValue(_this.countryList)).Iso3 || "",
1413
+ _postcode = postcode || "",
1414
+ _building = building || "";
1415
+
1416
+ if (_country == "" || _postcode == "")
1417
+ return;
1418
+
1419
+ function internationalSelectStreet(address) {
1420
+ _this.select(address);
1421
+
1422
+ //If the description does not contain building numbers then search for them
1423
+ if (address.Street == address.Description)
1424
+ _this.searchBuildings(address.StreetId, address);
1425
+ else {
1426
+ //Append the Zip+4 if not present
1427
+ if (_country == "USA" && _this.dataSourceOptions.usps && /^[0-9]{5}$/.test(address.PostalCode))
1428
+ _this.searchByAddress(_country, _pca.formatLine(address, "{Description}, {City}, {State}, {PostalCode}"));
1429
+ else
1430
+ _this.resultsList.clear();
1431
+ }
1432
+ }
1433
+
1434
+ function internationalStreetResults(response) {
1435
+ _this.addAddressLines(response);
1436
+
1437
+ if (response.length > 1)
1438
+ _this.resultsList.populate(response, "<b>{Description}</b> {District} {City} {State}", internationalSelectStreet).show();
1439
+ else if (response.length == 1)
1440
+ internationalSelectStreet(response[0]);
1441
+ else
1442
+ _this.resultsList.clear();
1443
+ }
1444
+
1445
+ function royalMailRetrieveResult(response) {
1446
+ _this.select(response[0]);
1447
+ }
1448
+
1449
+ function royalMailSelectBuilding(item) {
1450
+ _pca.fetch("PostcodeAnywhere/Interactive/RetrieveById/v1.20", { Key: _this.key, Id: item.Id }, royalMailRetrieveResult);
1451
+ _this.resultsList.clear();
1452
+ }
1453
+
1454
+ function royalMailStreetResults(response) {
1455
+ if (response.length > 1)
1456
+ _this.resultsList.populate(response, "<b>{StreetAddress}</b> {Place}", royalMailSelectBuilding).sort().draw().show();
1457
+ else if (response.length == 1)
1458
+ royalMailSelectAddress(response[0]);
1459
+ else
1460
+ _this.resultsList.clear();
1461
+ }
1462
+
1463
+ function uspsZipResult(response) {
1464
+ if (response.length > 1)
1465
+ _this.resultsList.populate(response, "<b>{Company} {Line1}</b> {City} {StateCode}", uspsSelectAddress).show();
1466
+ else if (response.length == 1)
1467
+ uspsSelectAddress(response[0]);
1468
+ else
1469
+ _this.resultsList.clear();
1470
+ }
1471
+
1472
+ function uspsSelectAddress(address) {
1473
+ _this.select(address);
1474
+ _this.resultsList.clear();
1475
+ }
1476
+
1477
+ if (_country == "GBR" && _this.dataSourceOptions.royalMail)
1478
+ _pca.fetch("PostcodeAnywhere/Interactive/FindByPostcode/v1.00", { Key: _this.key, Postcode: _postcode }, royalMailStreetResults);
1479
+ else if (_country == "USA" && _this.dataSourceOptions.usps && /[0-9]{5}-[0-9]{4}/.test(_postcode))
1480
+ _pca.fetch("PostcodeAnywhereInternational/InteractiveUSA/RetrieveByZip4/v1.00", { Key: _this.key, Country: _country, Zip4: _postcode }, uspsZipResult);
1481
+ else if (_this.dataSourceOptions.international)
1482
+ _pca.fetch("PostcodeAnywhereInternational/Interactive/RetrieveByPostalCode/v2.10", { Key: _this.key, Country: _country, PostalCode: _postcode, Building: _building }, internationalStreetResults);
1483
+ }
1484
+
1485
+ //Searches for an address by street using building and city information
1486
+ _this.searchByStreet = function (country, street, building) {
1487
+ var _country = _pca.getCountry(country || _pca.getValue(_this.countryList)).Iso3 || "",
1488
+ _street = street || "",
1489
+ _building = building || "";
1490
+
1491
+ if (_country == "" || _street == "")
1492
+ return;
1493
+
1494
+ function internationalSelectStreet(address) {
1495
+ _this.select(address);
1496
+
1497
+ //If the description does not contain building numbers then search for them
1498
+ if (address.Street == address.Description)
1499
+ _this.searchBuildings(address.StreetId, address);
1500
+ else {
1501
+ //Append the Zip+4 if not present
1502
+ if (_country == "USA" && _this.dataSourceOptions.usps && /^[0-9]{5}$/.test(address.PostalCode))
1503
+ _this.searchByAddress(_country, _pca.formatLine(address, "{Description}, {City}, {State}, {PostalCode}"));
1504
+ else
1505
+ _this.resultsList.clear();
1506
+ }
1507
+ }
1508
+
1509
+ function internationalStreetResults(response) {
1510
+ _this.addAddressLines(response);
1511
+
1512
+ if (response.length > 1)
1513
+ _this.resultsList.populate(response, "<b>{Street}</b> {District} {City} {State} {PostalCode}", internationalSelectStreet).show();
1514
+ else if (response.length == 1)
1515
+ internationalSelectStreet(response[0]);
1516
+ else
1517
+ _this.resultsList.clear();
1518
+ }
1519
+
1520
+ function royalMailSelectStreet(address) {
1521
+ _this.searchBuildings(address.StreetId);
1522
+ _this.resultsList.clear();
1523
+ }
1524
+
1525
+ function royalMailStreetResults(response) {
1526
+ if (response.length > 1)
1527
+ _this.resultsList.populate(response, "<b>{Street}</b> {Place}", royalMailSelectStreet).show();
1528
+ else if (response.length == 1)
1529
+ royalMailSelectStreet(response[0]);
1530
+ else
1531
+ _this.resultsList.clear();
1532
+ }
1533
+
1534
+ if (_country == "GBR" && _this.dataSourceOptions.royalMail)
1535
+ _pca.fetch("PostcodeAnywhere/Interactive/FindStreets/v1.00", { Key: _this.key, Street: _street }, royalMailStreetResults);
1536
+ else if (_this.dataSourceOptions.international)
1537
+ _pca.fetch("PostcodeAnywhereInternational/Interactive/RetrieveByStreet/v1.40", { Key: _this.key, Country: _country, Street: _street, Building: _building }, internationalStreetResults);
1538
+ }
1539
+
1540
+ //Gets a list of buildings from a street Id
1541
+ _this.searchBuildings = function (streetId, address) {
1542
+ var _country = (/^\d+\|\d+\|\d+\|\d+$/.test(streetId) ? "GBR" : /^[A-Z]{3}(?=\|)/.exec(streetId).toString()) || "",
1543
+ _address = address || {};
1544
+
1545
+ function internationalSelectBuilding(building) {
1546
+ _pca.merge(_address, building);
1547
+ _this.select(building);
1548
+ _this.resultsList.clear();
1549
+
1550
+ //Append the Zip+4 if not present
1551
+ if (_country == "USA" && _this.dataSourceOptions.usps && /^[0-9]{5}$/.test(building.PostalCode))
1552
+ _this.searchByAddress(_country, _pca.formatLine(building, "{Description}, {City}, {State}, {PostalCode}"));
1553
+ }
1554
+
1555
+ function internationalBuildingResults(response) {
1556
+ _this.addAddressLines(response);
1557
+
1558
+ if (response.length > 1)
1559
+ _this.resultsList.populate(response, "{Description}", internationalSelectBuilding).show();
1560
+ else if (response.length == 1)
1561
+ internationalSelectBuilding(response[0]);
1562
+ else
1563
+ _this.resultsList.clear();
1564
+ }
1565
+
1566
+ function royalMailRetrieveResult(response) {
1567
+ _this.select(response[0]);
1568
+ }
1569
+
1570
+ function royalMailSelectBuilding(item) {
1571
+ _pca.fetch("PostcodeAnywhere/Interactive/RetrieveById/v1.20", { Key: _this.key, Id: item.Id }, royalMailRetrieveResult);
1572
+ _this.resultsList.clear();
1573
+ }
1574
+
1575
+ function royalMailBuildingResults(response) {
1576
+ if (response.length > 1)
1577
+ _this.resultsList.populate(response, "{StreetAddress}", royalMailSelectBuilding).show();
1578
+ else if (response.length == 1)
1579
+ royalMailSelectBuilding(response[0]);
1580
+ else
1581
+ _this.resultsList.clear();
1582
+ }
1583
+
1584
+ if (/^\d\|\d{5}\|\d{4}\|\d/.test(streetId))
1585
+ _pca.fetch("PostcodeAnywhere/Interactive/FindByStreetId/v1.00", { Key: _this.key, StreetId: streetId }, royalMailBuildingResults);
1586
+ else
1587
+ _pca.fetch("PostcodeAnywhereInternational/Interactive/ListBuildings/v1.10", { Key: _this.key, StreetId: streetId }, internationalBuildingResults);
1588
+ }
1589
+
1590
+ //Clears all fields
1591
+ _this.clear = function () {
1592
+ for (var i = 0; i < fields.length; i++)
1593
+ _pca.setValue(_pca.getInput(fields[i].element), '');
1594
+
1595
+ _this.resultsList.clear();
1596
+
1597
+ _this.fire("clear");
1598
+ }
1599
+
1600
+ //Populates the field map with values
1601
+ _this.select = function (address) {
1602
+ for (var i = 0; i < fields.length; i++)
1603
+ _pca.setValue(_pca.getInput(fields[i].element), _this.getAddressValue(fields[i].field, address));
1604
+
1605
+ if (_this.countryList && _this.countryList.syncCountry)
1606
+ _this.countryList.syncCountry(_this.getAddressValue("Country", address));
1607
+
1608
+ _this.fire("select", address);
1609
+ }
1610
+
1611
+ //Run setup
1612
+ _this.setup();
1613
+ }
1614
+ })(window);
1615
+
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>UK_and_International_Address_Auto-Fill_from_Postcode_Anywhere</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>UK and International Adderess Auto-Fill from Postcode Anywhere.</summary>
10
+ <description>UK and International Address Auto-Fill from Postcode Anywhere.</description>
11
+ <notes>Stable Release</notes>
12
+ <authors><author><name>PCA_Tom</name><user>PCA_Tom</user><email>tomg@Postcodeanywhere.com</email></author></authors>
13
+ <date>2011-12-13</date>
14
+ <time>10:42:06</time>
15
+ <contents><target name="magecommunity"><dir name="PostcodeAnywhere"><dir name="AddressLookup"><dir name="controllers"><file name="IndexController.php" hash="c7cf3785ae9017b0a868d4354dc5e0af"/></dir><dir name="etc"><file name="config.xml" hash="c4d0f8eaadf03f9d8e68c4155a7e2b0c"/><file name="system.xml" hash="61fed79d02a7c523e2af8fe488d5be1b"/></dir><dir name="Helper"><file name="Data.php" hash="daa24af2b8e4e27a4a67304f47f04ee0"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="AddressLookup.xml" hash="49a3df0dc7fa4835adf3222399bfcf16"/><file name="GuestAddressLookup.xml" hash="1496bd505cc8259318536eba18aab030"/><file name="PCAPersistent.xml" hash="ca6783de25b5c2a2b919c5a5a7242aff"/></dir><dir name="template"><dir name="checkout"><dir name="onepage"><file name="pca_billing.phtml" hash="02bdf3c2538b6338d4a7b7d96ae5c054"/><file name="pca_shipping.phtml" hash="e3e0e1b20de82f4bcfcedb9a87e9ab13"/></dir></dir><dir name="customer"><dir name="address"><file name="pca_edit.phtml" hash="d2be6cd0730ddf8a9de4134b95eb6432"/><file name="pca_register.phtml" hash="4cdfe4d71d84ee47ebe6bcfa59d56341"/></dir><dir name="form"><file name="pca_register.phtml" hash="4079eff78aeee939e09ac0f1c523de8c"/></dir></dir><dir name="persistent"><dir name="checkout"><dir name="onepage"><file name="pca_billing.phtml" hash="a37906eaca80d48718fdb27ba83d4393"/></dir></dir><dir name="customer"><dir name="form"><file name="pca_register.phtml" hash="004222495fd1bf39e69251c38fea5026"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PostcodeAnywhere_AddressLookup.xml" hash="25d0ee21fb0785c1a52c8b9966c073a8"/></dir></target><target name="mage"><dir name="js"><dir name="PostcodeAnywhere"><file name="address.css" hash="09ae321e1f77e04a1b8283b70546b9c4"/><file name="address.js" hash="17157992f064c3c639740b8657e7badf"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>