AbservetechShoestore - Version 0.0.3

Version Notes

Shoe store has the following Features.
1. Ajax add to cart, wishlist and Compare Products.
2. Responsive Mega menu.
3. Ajax One step Checkout
4. Back end Settings Option
5. Animation Effects

Download this release

Release Info

Developer AbserveTech
Extension AbservetechShoestore
Version 0.0.3
Comparing to
See all releases


Code changes from version 0.0.2 to 0.0.3

Files changed (71) hide show
  1. app/code/community/Abserve/CustomMenu/Block/Navigation.php +1 -1
  2. app/code/community/Abserve/New folder/adminhtml.xml +75 -0
  3. app/code/community/Abserve/New folder/config.xml +452 -0
  4. app/code/community/Abserve/Opc/Block/Braintree/Datajs.php +12 -0
  5. app/code/community/Abserve/Opc/Block/Braintree/Form.php +12 -0
  6. app/code/community/Abserve/Opc/Block/Customer/Account/Asklink.php +12 -0
  7. app/code/community/Abserve/Opc/Block/Customer/Account/Dashboard/Info.php +53 -0
  8. app/code/community/Abserve/Opc/Block/Links.php +24 -0
  9. app/code/community/Abserve/Opc/Block/Lipp.php +23 -0
  10. app/code/community/Abserve/Opc/Block/Onepage/Billing.php +28 -0
  11. app/code/community/Abserve/Opc/Block/Onepage/Comment.php +8 -0
  12. app/code/community/Abserve/Opc/Block/Onepage/Link.php +20 -0
  13. app/code/community/Abserve/Opc/Block/Onepage/Login.php +4 -0
  14. app/code/community/Abserve/Opc/Block/Onepage/Shipping.php +23 -0
  15. app/code/community/Abserve/Opc/Block/Onepage/Subscribed.php +21 -0
  16. app/code/community/Abserve/Opc/Block/Paypal/Express/Form.php +62 -0
  17. app/code/community/Abserve/Opc/Block/Paypal/Login.php +17 -0
  18. app/code/community/Abserve/Opc/Block/Paypal/Standard/Form.php +29 -0
  19. app/code/community/Abserve/Opc/Block/System/Config/Form/Fieldset/Extensions.php +18 -0
  20. app/code/community/Abserve/Opc/Block/Wrapper.php +197 -0
  21. app/code/community/Abserve/Opc/Helper/City.php +5098 -0
  22. app/code/community/Abserve/Opc/Helper/Country.php +897 -0
  23. app/code/community/Abserve/Opc/Helper/Data.php +176 -0
  24. app/code/community/Abserve/Opc/Helper/Paypal.php +408 -0
  25. app/code/community/Abserve/Opc/Helper/Url.php +30 -0
  26. app/code/community/Abserve/Opc/Model/Api/Nvp.php +65 -0
  27. app/code/community/Abserve/Opc/Model/Braintree/Paymentmethod.php +18 -0
  28. app/code/community/Abserve/Opc/Model/Observer.php +62 -0
  29. app/code/community/Abserve/Opc/Model/Paypal/Config.php +20 -0
  30. app/code/community/Abserve/Opc/Model/Paypal/Customer.php +57 -0
  31. app/code/community/Abserve/Opc/Model/Paypal/Express.php +22 -0
  32. app/code/community/Abserve/Opc/Model/Resource/Paypal/Customer.php +50 -0
  33. app/code/community/Abserve/Opc/Model/Resource/Paypal/Customer/Collection.php +12 -0
  34. app/code/community/Abserve/Opc/Model/System/Config/Source/Shipping/Allmethods.php +42 -0
  35. app/code/community/Abserve/Opc/Model/System/Config/Source/Terms.php +19 -0
  36. app/code/community/Abserve/Opc/controllers/Checkout/OnepageController.php +46 -0
  37. app/code/community/Abserve/Opc/controllers/CouponController.php +135 -0
  38. app/code/community/Abserve/Opc/controllers/ExpressController.php +348 -0
  39. app/code/community/Abserve/Opc/controllers/IndexController.php +154 -0
  40. app/code/community/Abserve/Opc/controllers/JsonController.php +752 -0
  41. app/code/community/Abserve/Opc/controllers/PaypalController.php +271 -0
  42. app/code/community/Abserve/Opc/controllers/VersionController.php +9 -0
  43. app/code/community/Abserve/Opc/etc/adminhtml.xml +23 -0
  44. app/code/community/Abserve/Opc/etc/config.xml +225 -0
  45. app/code/community/Abserve/Opc/etc/system.xml +377 -0
  46. app/code/community/Abserve/Opc/sql/opc_setup/mysql4-install-0.1.0.php +21 -0
  47. app/code/community/Abserve/Settings/controllers/IndexController.php +81 -0
  48. app/design/adminhtml/default/default/layout/magenotification.xml +0 -16
  49. app/design/adminhtml/default/default/layout/onestepcheckout.xml +0 -98
  50. app/design/adminhtml/default/default/template/magenotification/feedback/files.phtml +0 -17
  51. app/design/adminhtml/default/default/template/magenotification/feedback/history.phtml +0 -31
  52. app/design/adminhtml/default/default/template/magenotification/license/licenseinfo.phtml +0 -68
  53. app/design/adminhtml/default/default/template/magenotification/license/purchaseform.phtml +0 -7
  54. app/design/adminhtml/default/default/template/magenotification/license/updateform.phtml +0 -41
  55. app/design/adminhtml/default/default/template/onestepcheckout/country.phtml +0 -183
  56. app/design/adminhtml/default/default/template/onestepcheckout/geoip.phtml +0 -171
  57. app/design/adminhtml/default/default/template/onestepcheckout/geoipgrid.phtml +0 -74
  58. app/design/adminhtml/default/default/template/onestepcheckout/info.phtml +0 -162
  59. app/design/adminhtml/default/default/template/onestepcheckout/sales/order/view/tab/delivery.phtml +0 -36
  60. app/design/adminhtml/default/default/template/onestepcheckout/sales/order/view/tab/survey.phtml +0 -69
  61. app/design/frontend/abserve/shoestore/layout/abserve_opc.xml +184 -0
  62. app/design/frontend/abserve/shoestore/layout/onestepcheckout.xml +0 -328
  63. app/design/frontend/abserve/shoestore/template/onestepcheckout/geoip/postcode.phtml +0 -33
  64. app/design/frontend/abserve/shoestore/template/onestepcheckout/giftmessage/inline.phtml +0 -70
  65. app/design/frontend/abserve/shoestore/template/onestepcheckout/head.phtml +0 -12
  66. app/design/frontend/abserve/shoestore/template/onestepcheckout/link.phtml +0 -17
  67. app/design/frontend/abserve/shoestore/template/onestepcheckout/login_popup.phtml +0 -139
  68. app/design/frontend/abserve/shoestore/template/onestepcheckout/onestepcheckout.phtml +0 -1018
  69. app/design/frontend/abserve/shoestore/template/onestepcheckout/onestepcheckout/billing.backup-Justin.phtml +0 -336
  70. app/design/frontend/abserve/shoestore/template/onestepcheckout/onestepcheckout/billing.backup_19_05.phtml +0 -4453
  71. app/design/frontend/abserve/shoestore/template/onestepcheckout/onestepcheckout/billing.backup_20_05.phtml +0 -256
app/code/community/Abserve/CustomMenu/Block/Navigation.php CHANGED
@@ -102,7 +102,7 @@ class Abserve_CustomMenu_Block_Navigation extends Mage_Catalog_Block_Navigation
102
  if ($drawPopup) {
103
  $htmlPopup = array();
104
  // --- Popup function for hide ---
105
- $htmlPopup[] = '<div id="popup' . $id . '" class="abserve-custom-menu-popup animated zoomIn" onmouseout="abserveHideMenuPopup(this, event, \'popup' . $id . '\', \'menu' . $id . '\')" onmouseover="abservePopupOver(this, event, \'popup' . $id . '\', \'menu' . $id . '\')">';
106
  // --- draw Sub Categories ---
107
  if (count($activeChildren)) {
108
  $columns = (int)Mage::getStoreConfig('custom_menu/columns/count');
102
  if ($drawPopup) {
103
  $htmlPopup = array();
104
  // --- Popup function for hide ---
105
+ $htmlPopup[] = '<div id="popup' . $id . '" class="abserve-custom-menu-popup animated pulse" onmouseout="abserveHideMenuPopup(this, event, \'popup' . $id . '\', \'menu' . $id . '\')" onmouseover="abservePopupOver(this, event, \'popup' . $id . '\', \'menu' . $id . '\')">';
106
  // --- draw Sub Categories ---
107
  if (count($activeChildren)) {
108
  $columns = (int)Mage::getStoreConfig('custom_menu/columns/count');
app/code/community/Abserve/New folder/adminhtml.xml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Abserve
5
+ * @package Abserve_Module
6
+ * @author Abserve Developer
7
+ * @license http://abservetech.com/license-agreement/
8
+ * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
9
+ */
10
+ -->
11
+ <config>
12
+ <menu>
13
+ <settings module="settings">
14
+ <children>
15
+ <onestepcheckout module="onestepcheckout">
16
+ <title>Onestepcheckout</title>
17
+ <sort_order>4</sort_order>
18
+ <action>adminhtml/system_config/edit/section/onestepcheckout</action>
19
+ </onestepcheckout>
20
+ </children>
21
+ </settings>
22
+ </menu>
23
+ <acl>
24
+ <resources>
25
+ <all>
26
+ <title>Allow Everything</title>
27
+ </all>
28
+ <admin>
29
+ <children>
30
+ <system>
31
+ <children>
32
+ <config>
33
+ <children>
34
+ <onestepcheckout translate="title" >
35
+ <title>Abserve</title>
36
+ <sort_order>50</sort_order>
37
+ </onestepcheckout>
38
+ </children>
39
+ </config>
40
+ </children>
41
+ </system>
42
+ <onestepcheckout module="onestepcheckout" translate="title">
43
+ <title>Onestepcheckout</title>
44
+ <sort_order>71</sort_order>
45
+ <children>
46
+ <!-- <country module="onestepcheckout" translate="title">
47
+ <title>Update GeoIP Database</title>
48
+ <sort_order>0</sort_order>
49
+ <action>onestepcheckoutadmin/adminhtml_geoip</action>
50
+ </country>
51
+ <geoip module="onestepcheckout" translate="title">
52
+ <title>Update Country Postcode Database</title>
53
+ <sort_order>10</sort_order>
54
+ <action>onestepcheckoutadmin/adminhtml_country</action>
55
+ </geoip> -->
56
+ <settings module="onestepcheckout" translate="title">
57
+ <title>Settings</title>
58
+ <sort_order>1000</sort_order>
59
+ </settings>
60
+ </children>
61
+ </onestepcheckout>
62
+ </children>
63
+ </admin>
64
+ </resources>
65
+ </acl>
66
+ <translate>
67
+ <modules>
68
+ <Abserve_Onestepcheckout>
69
+ <files>
70
+ <default>Abserve_Onestepcheckout.csv</default>
71
+ </files>
72
+ </Abserve_Onestepcheckout>
73
+ </modules>
74
+ </translate>
75
+ </config>
app/code/community/Abserve/New folder/config.xml ADDED
@@ -0,0 +1,452 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Abserve
5
+ * @package Abserve_Module
6
+ * @author Abserve Developer
7
+ * @license http://abservetech.com/license-agreement/
8
+ * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
9
+ */
10
+ -->
11
+ <config>
12
+ <modules>
13
+ <Abserve_Onestepcheckout>
14
+ <version>3.1.0</version>
15
+ </Abserve_Onestepcheckout>
16
+ </modules>
17
+ <frontend>
18
+ <secure_url>
19
+ <onestepcheckout>/onestepcheckout/</onestepcheckout>
20
+ </secure_url>
21
+ <routers>
22
+ <onestepcheckout>
23
+ <use>standard</use>
24
+ <args>
25
+ <module>Abserve_Onestepcheckout</module>
26
+ <frontName>onestepcheckout</frontName>
27
+ </args>
28
+ </onestepcheckout>
29
+ </routers>
30
+ <translate>
31
+ <modules>
32
+ <Abserve_Onestepcheckout>
33
+ <files>
34
+ <default>Abserve_Onestepcheckout.csv</default>
35
+ </files>
36
+ </Abserve_Onestepcheckout>
37
+ </modules>
38
+ </translate>
39
+ <layout>
40
+ <updates>
41
+ <onestepcheckout>
42
+ <file>onestepcheckout.xml</file>
43
+ </onestepcheckout>
44
+ </updates>
45
+ </layout>
46
+ <events>
47
+ <sales_order_place_after>
48
+ <observers>
49
+ <abserve_onestepcheckout_observer>
50
+ <type>singleton</type>
51
+ <class>onestepcheckout/observer</class>
52
+ <method>orderPlaceAfter</method>
53
+ </abserve_onestepcheckout_observer>
54
+ </observers>
55
+ </sales_order_place_after>
56
+ <paypal_prepare_line_items>
57
+ <observers>
58
+ <abserve_onstepcheckout_paypal_prepare_line_items>
59
+ <type>singleton</type>
60
+ <class>onestepcheckout/giftwrap</class>
61
+ <method>paypal_prepare_line_items</method>
62
+ </abserve_onstepcheckout_paypal_prepare_line_items>
63
+ </observers>
64
+ </paypal_prepare_line_items>
65
+ </events>
66
+ </frontend>
67
+ <admin>
68
+ <routers>
69
+ <onestepcheckoutadmin>
70
+ <use>admin</use>
71
+ <args>
72
+ <module>Abserve_Onestepcheckout</module>
73
+ <frontName>onestepcheckoutadmin</frontName>
74
+ </args>
75
+ </onestepcheckoutadmin>
76
+ </routers>
77
+ </admin>
78
+ <adminhtml>
79
+ <layout>
80
+ <updates>
81
+ <onestepcheckout>
82
+ <file>onestepcheckout.xml</file>
83
+ </onestepcheckout>
84
+ </updates>
85
+ </layout>
86
+ <events>
87
+ <controller_action_predispatch_adminhtml>
88
+ <observers>
89
+ <abserve_onestepcheckout_observer>
90
+ <type>singleton</type>
91
+ <class>onestepcheckout/observer</class>
92
+ <method>controller_action_predispatch_adminhtml</method>
93
+ </abserve_onestepcheckout_observer>
94
+ </observers>
95
+ </controller_action_predispatch_adminhtml>
96
+ <admin_system_config_changed_section_onestepcheckout>
97
+ <observers>
98
+ <onestepcheckout>
99
+ <type>singleton</type>
100
+ <class>onestepcheckout/observer</class>
101
+ <method>changeFieldPosition</method>
102
+ </onestepcheckout>
103
+ </observers>
104
+ </admin_system_config_changed_section_onestepcheckout>
105
+ </events>
106
+ <blocks>
107
+ <adminhtml>
108
+ <rewrite>
109
+ <system_config_edit>Abserve_Onestepcheckout_Block_Adminhtml_Config_Edit</system_config_edit>
110
+ </rewrite>
111
+ </adminhtml>
112
+ </blocks>
113
+ </adminhtml>
114
+ <global>
115
+ <routers>
116
+ <sagepaysuite>
117
+ <rewrite>
118
+ <payment>
119
+ <to>onestepcheckout/payment</to>
120
+ <override_actions>true</override_actions>
121
+ <actions>
122
+ <onepageSaveOrder>
123
+ <to>onestepcheckout/payment/onepageSaveOrder</to>
124
+ </onepageSaveOrder>
125
+ </actions>
126
+ </payment>
127
+ </rewrite>
128
+ </sagepaysuite>
129
+ </routers>
130
+ <models>
131
+ <onestepcheckout>
132
+ <class>Abserve_Onestepcheckout_Model</class>
133
+ <resourceModel>onestepcheckout_mysql4</resourceModel>
134
+ </onestepcheckout>
135
+ <onestepcheckout_mysql4>
136
+ <class>Abserve_Onestepcheckout_Model_Mysql4</class>
137
+ <entities>
138
+ <onestepcheckout>
139
+ <table>onestepcheckout</table>
140
+ </onestepcheckout>
141
+ <config>
142
+ <table>onestepcheckout_config_data</table>
143
+ </config>
144
+ <survey>
145
+ <table>onestepcheckout_survey</table>
146
+ </survey>
147
+ <delivery>
148
+ <table>onestepcheckout_delivery</table>
149
+ </delivery>
150
+ <geoip>
151
+ <table>geoip</table>
152
+ </geoip>
153
+ <country>
154
+ <table>geoip_country</table>
155
+ </country>
156
+ <countrylist>
157
+ <table>geoip_countrylist</table>
158
+ </countrylist>
159
+ </entities>
160
+ </onestepcheckout_mysql4>
161
+ <customer>
162
+ <rewrite>
163
+ <form>Abserve_Onestepcheckout_Model_Customer_Form</form>
164
+ <customer>Abserve_Onestepcheckout_Model_Customer_Customer</customer>
165
+ </rewrite>
166
+ </customer>
167
+ </models>
168
+ <resources>
169
+ <onestepcheckout_setup>
170
+ <setup>
171
+ <module>Abserve_Onestepcheckout</module>
172
+ </setup>
173
+ <connection>
174
+ <use>core_setup</use>
175
+ </connection>
176
+ </onestepcheckout_setup>
177
+ <onestepcheckout_write>
178
+ <connection>
179
+ <use>core_write</use>
180
+ </connection>
181
+ </onestepcheckout_write>
182
+ <onestepcheckout_read>
183
+ <connection>
184
+ <use>core_read</use>
185
+ </connection>
186
+ </onestepcheckout_read>
187
+ </resources>
188
+ <blocks>
189
+ <onestepcheckout>
190
+ <class>Abserve_Onestepcheckout_Block</class>
191
+ </onestepcheckout>
192
+ <adminhtml>
193
+ <rewrite>
194
+ <system_config_edit>Abserve_Onestepcheckout_Block_Adminhtml_Config_Edit</system_config_edit>
195
+ </rewrite>
196
+ </adminhtml>
197
+ <checkout>
198
+ <rewrite>
199
+ <onepage_link>Abserve_Onestepcheckout_Block_Onepage_Link</onepage_link>
200
+ <links>Abserve_Onestepcheckout_Block_Checkout_Links</links>
201
+ </rewrite>
202
+ </checkout>
203
+ </blocks>
204
+ <helpers>
205
+ <onestepcheckout>
206
+ <class>Abserve_Onestepcheckout_Helper</class>
207
+ </onestepcheckout>
208
+ <checkout>
209
+ <rewrite>
210
+ <url>Abserve_Onestepcheckout_Helper_Rewrite_Checkout_Url</url>
211
+ </rewrite>
212
+ </checkout>
213
+ </helpers>
214
+ <events>
215
+ <controller_action_predispatch_checkout_onepage_index>
216
+ <observers>
217
+ <abserve_onestepcheckout_observer>
218
+ <type>singleton</type>
219
+ <class>onestepcheckout/observer</class>
220
+ <method>initController</method>
221
+ </abserve_onestepcheckout_observer>
222
+ </observers>
223
+ </controller_action_predispatch_checkout_onepage_index>
224
+ <checkout_cart_add_product_complete>
225
+ <observers>
226
+ <checkout_cart_index>
227
+ <type>singleton</type>
228
+ <class>onestepcheckout/observer</class>
229
+ <method>initCartController</method>
230
+ </checkout_cart_index>
231
+ </observers>
232
+ </checkout_cart_add_product_complete>
233
+ <controller_action_predispatch_checkout_cart_index>
234
+ <observers>
235
+ <abserve_onestepcheckout_observer>
236
+ <type>singleton</type>
237
+ <class>onestepcheckout/observer</class>
238
+ <method>controllerActionPredispatchCheckoutCartIndex</method>
239
+ </abserve_onestepcheckout_observer>
240
+ </observers>
241
+ </controller_action_predispatch_checkout_cart_index>
242
+ <controller_action_predispatch_icepay_processing_result>
243
+ <observers>
244
+ <abserve_onestepcheckout_observer>
245
+ <type>singleton</type>
246
+ <class>onestepcheckout/observer</class>
247
+ <method>controllerActionPredispatchIcepayProcessingResult</method>
248
+ </abserve_onestepcheckout_observer>
249
+ </observers>
250
+ </controller_action_predispatch_icepay_processing_result>
251
+ <controller_action_predispatch_wirecard_checkout_page_processing_checkresponse>
252
+ <observers>
253
+ <abserve_onestepcheckout_observer>
254
+ <type>singleton</type>
255
+ <class>onestepcheckout/observer</class>
256
+ <method>controllerActionPredispatchWirecardCheckoutPageProcessingCheckresponse</method>
257
+ </abserve_onestepcheckout_observer>
258
+ </observers>
259
+ </controller_action_predispatch_wirecard_checkout_page_processing_checkresponse>
260
+ <controller_action_predispatch_onestepcheckout_index_index>
261
+ <observers>
262
+ <abserve_onestepcheckout_observer>
263
+ <type>singleton</type>
264
+ <class>onestepcheckout/observer</class>
265
+ <method>controllerActionPredispatchOnestepcheckoutIndex</method>
266
+ </abserve_onestepcheckout_observer>
267
+ </observers>
268
+ </controller_action_predispatch_onestepcheckout_index_index>
269
+ <checkout_type_onepage_save_order>
270
+ <observers>
271
+ <abserve_onestepcheckout_observer>
272
+ <type>model</type>
273
+ <class>Abserve_Onestepcheckout_Helper_Data</class>
274
+ <method>saveOrderComment</method>
275
+ </abserve_onestepcheckout_observer>
276
+ </observers>
277
+ </checkout_type_onepage_save_order>
278
+ <checkout_type_onepage_save_order_after>
279
+ <observers>
280
+ <abserve_onestepcheckout_observer>
281
+ <type>singleton</type>
282
+ <class>onestepcheckout/observer</class>
283
+ <method>notifyAdmin</method>
284
+ </abserve_onestepcheckout_observer>
285
+ </observers>
286
+ </checkout_type_onepage_save_order_after>
287
+ </events>
288
+ <template>
289
+ <email>
290
+ <onestepcheckout_order_notification_template translate="label" module="onestepcheckout">
291
+ <label>New Order Notification</label>
292
+ <file>sales/new_order_notification.html</file>
293
+ <type>html</type>
294
+ </onestepcheckout_order_notification_template>
295
+ </email>
296
+ </template>
297
+ <sales>
298
+ <quote>
299
+ <totals>
300
+ <giftwrap>
301
+ <class>onestepcheckout/sales_quote_address_total_giftwrap</class>
302
+ <after>wee,discount,tax,tax_subtotal,grand_total</after>
303
+ </giftwrap>
304
+ </totals>
305
+ </quote>
306
+ <order_invoice>
307
+ <totals>
308
+ <giftwrap>
309
+ <class>onestepcheckout/sales_order_invoice_total_giftwrap</class>
310
+ </giftwrap>
311
+ </totals>
312
+ </order_invoice>
313
+ <order_creditmemo>
314
+ <totals>
315
+ <giftwrap>
316
+ <class>onestepcheckout/sales_order_creditmemo_total_giftwrap</class>
317
+ </giftwrap>
318
+ </totals>
319
+ </order_creditmemo>
320
+ </sales>
321
+ <fieldsets>
322
+ <sales_convert_quote_address>
323
+ <onestepcheckout_giftwrap_amount>
324
+ <to_order>*</to_order>
325
+ </onestepcheckout_giftwrap_amount>
326
+ </sales_convert_quote_address>
327
+ <sales_convert_quote_address>
328
+ <onestepcheckout_order_comment>
329
+ <to_order>*</to_order>
330
+ </onestepcheckout_order_comment>
331
+ </sales_convert_quote_address>
332
+ </fieldsets>
333
+ <pdf>
334
+ <totals>
335
+ <giftwrap translate="title">
336
+ <title>Giftwrap</title>
337
+ <source_field>giftwrap_amount</source_field>
338
+ <model>onestepcheckout/order_pdf_amount</model>
339
+ <font_size>7</font_size>
340
+ <display_zero>0</display_zero>
341
+ <sort_order>450</sort_order>
342
+ </giftwrap>
343
+ </totals>
344
+ </pdf>
345
+ </global>
346
+ <default>
347
+ <onestepcheckout>
348
+ <general>
349
+ <active>1</active>
350
+ <show_shipping_address>1</show_shipping_address>
351
+ <country_id>US</country_id>
352
+ <postcode>90034</postcode>
353
+ <region_id>12</region_id>
354
+ <use_for_disabled_fields>1</use_for_disabled_fields>
355
+ <checkout_title>One step checkout</checkout_title>
356
+ <checkout_description>Please fill in the fields below and click Place order to complete your purchase!</checkout_description>
357
+ <page_layout>3columns</page_layout>
358
+ </general>
359
+ <field_management>
360
+ <show_city>1</show_city>
361
+ <show_zipcode>1</show_zipcode>
362
+ <show_company>0</show_company>
363
+ <show_fax>0</show_fax>
364
+ <show_telephone>1</show_telephone>
365
+ <show_region>1</show_region>
366
+ <show_comment>0</show_comment>
367
+ <show_newsletter>0</show_newsletter>
368
+ <show_discount>0</show_discount>
369
+ <redirect_to_checkout>0</redirect_to_checkout>
370
+ <suggest_address>0</suggest_address>
371
+ <enable_giftmessage>0</enable_giftmessage>
372
+ </field_management>
373
+ <field_position_management>
374
+ <position>test</position>
375
+ <row_0>firstname</row_0>
376
+ <row_1>lastname</row_1>
377
+ <row_2>email</row_2>
378
+ <row_3>telephone</row_3>
379
+ <row_4>street</row_4>
380
+ <row_5>0</row_5>
381
+ <row_6>country</row_6>
382
+ <row_7>0</row_7>
383
+ <row_8>city</row_8>
384
+ <row_9>0</row_9>
385
+ <row_10>postcode</row_10>
386
+ <row_11>region</row_11>
387
+ <row_12>company</row_12>
388
+ <row_13>fax</row_13>
389
+ <row_14>0</row_14>
390
+ </field_position_management>
391
+ <field_require_management>
392
+ <firstname>1</firstname>
393
+ <lastname>1</lastname>
394
+ <email>1</email>
395
+ <company>0</company>
396
+ <street>1</street>
397
+ <country>1</country>
398
+ <region>0</region>
399
+ <city>1</city>
400
+ <postcode>1</postcode>
401
+ <telephone>1</telephone>
402
+ <fax>0</fax>
403
+ </field_require_management>
404
+ <checkout_mode>
405
+ <show_login_link>1</show_login_link>
406
+ <enable_registration>1</enable_registration>
407
+ <allow_guest>1</allow_guest>
408
+ <login_link_title>Already have an account? Click here to login</login_link_title>
409
+ </checkout_mode>
410
+ <ajax_update>
411
+ <enable_ajax>1</enable_ajax>
412
+ <ajax_fields>country,postcode,state/region,city</ajax_fields>
413
+ <update_payment>1</update_payment>
414
+ <reload_payment>1</reload_payment>
415
+
416
+ <address_shipping>1</address_shipping>
417
+ <address_payment>0</address_payment>
418
+ <address_review>1</address_review>
419
+
420
+ <shipping_payment>0</shipping_payment>
421
+ <shipping_review>1</shipping_review>
422
+
423
+ <payment_review>0</payment_review>
424
+ </ajax_update>
425
+ <terms_conditions>
426
+ <enable_terms>0</enable_terms>
427
+ <term_width>400</term_width>
428
+ <term_height>250</term_height>
429
+ </terms_conditions>
430
+ <order_notification>
431
+ <enable_notification>0</enable_notification>
432
+ <template>onestepcheckout_order_notification_template</template>
433
+ </order_notification>
434
+ <geoip>
435
+ <enable>0</enable>
436
+ <!-- <postcode_characters>3</postcode_characters>
437
+ <city_characters>3</city_characters>
438
+ <rows>100</rows> -->
439
+ </geoip>
440
+ </onestepcheckout>
441
+ </default>
442
+ <!-- <websites>
443
+ <admin>
444
+ <dev>
445
+ <debug>
446
+ <template_hints>1</template_hints>
447
+ <template_hints_blocks>1</template_hints_blocks>
448
+ </debug>
449
+ </dev>
450
+ </admin>
451
+ </websites> -->
452
+ </config>
app/code/community/Abserve/Opc/Block/Braintree/Datajs.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $file = Mage::getBaseDir('code').'/local/Braintree/Payments/Block/Datajs.php';
3
+ if(file_exists($file)){
4
+ if(!class_exists('Braintree_Payments_Block_Datajs', false))
5
+ include_once($file);
6
+ class Abserve_Opc_Block_Braintree_Datajs extends Braintree_Payments_Block_Datajs{
7
+ }
8
+ }
9
+ else{
10
+ class Abserve_Opc_Block_Braintree_Datajs extends Mage_Core_Block_Template{
11
+ }
12
+ }
app/code/community/Abserve/Opc/Block/Braintree/Form.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $file = Mage::getBaseDir('code').'/local/Braintree/Payments/Block/Form.php';
3
+ if(file_exists($file)){
4
+ if(!class_exists('Braintree_Payments_Block_Form', false))
5
+ include_once($file);
6
+ class Abserve_Opc_Block_Braintree_Form extends Braintree_Payments_Block_Form{
7
+ }
8
+ }
9
+ else{
10
+ class Abserve_Opc_Block_Braintree_Form extends Mage_Core_Block_Template{
11
+ }
12
+ }
app/code/community/Abserve/Opc/Block/Customer/Account/Asklink.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Customer_Account_Asklink extends Mage_Customer_Block_Form_Login{
3
+ /**
4
+ * Retrieve form posting url
5
+ *
6
+ * @return string
7
+ */
8
+ public function getAskLinkPostActionUrl()
9
+ {
10
+ return $this->helper('opc/paypal')->getAskLinkPostActionUrl();
11
+ }
12
+ }
app/code/community/Abserve/Opc/Block/Customer/Account/Dashboard/Info.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Customer_Account_Dashboard_Info extends Mage_Customer_Block_Account_Dashboard_Info{
3
+
4
+
5
+ /**
6
+ * Add paypalauth block to the customer dashboard
7
+ *
8
+ * @return string
9
+ */
10
+ protected function _toHtml(){
11
+ $isExtensionEnabled = Mage::getStoreConfigFlag('opc/paypallogin/status');
12
+
13
+ $html = $this->getChildHtml('paypalauth_dashboard');
14
+ if (!$isExtensionEnabled) {
15
+ return parent::_toHtml();
16
+ }
17
+ $html .= parent::_toHtml();
18
+ return $html;
19
+ }
20
+
21
+ /**
22
+ * Check if this customer account linked with PayPal account
23
+ *
24
+ * @return bool
25
+ */
26
+ public function getPaypalCustomerEmail(){
27
+ $customerId = $this->getCustomer()->getId();
28
+ $paypalCustomerData = Mage::getModel('opc/paypal_customer')-> getPaypalCustomerDataByField('customer_id', $customerId);
29
+
30
+ if ($paypalCustomerData['email']) {
31
+ return $paypalCustomerData['email'];
32
+ }
33
+ return false;
34
+ }
35
+
36
+ /**
37
+ * Return action url for unlinking (native magento customer entity and paypal customer entity)
38
+ *
39
+ * @return string
40
+ */
41
+ public function getUnlinkUrl(){
42
+ return Mage::getUrl('onepage/paypal/unlink');
43
+ }
44
+
45
+ /**
46
+ * Return action url for authorized magento customer
47
+ *
48
+ * @return string
49
+ */
50
+ public function getAuthLoginUrl(){
51
+ return Mage::getUrl('onepage/paypal/login');
52
+ }
53
+ }
app/code/community/Abserve/Opc/Block/Links.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Links extends Mage_Core_Block_Template{
3
+
4
+
5
+ /**
6
+ * Add link on checkout page to parent block
7
+ *
8
+ * @return Mage_Checkout_Block_Links
9
+ */
10
+ public function addCheckoutLink(){
11
+
12
+
13
+
14
+ $parentBlock = $this->getParentBlock();
15
+ $text = $this->__('Checkout');
16
+ if (Mage::helper('opc')->isEnable()){
17
+ $parentBlock->addLink($text, 'onepage', $text, true, array('_secure'=>true), 60, null, 'class="top-link-checkout"');
18
+ }else{
19
+ $parentBlock->addLink($text, 'checkout', $text, true, array('_secure'=>true), 60, null, 'class="top-link-checkout"');
20
+ }
21
+
22
+ return $this;
23
+ }
24
+ }
app/code/community/Abserve/Opc/Block/Lipp.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Lipp extends Mage_Core_Block_Template{
3
+
4
+ public function getJsonConfig() {
5
+
6
+ $config = array ();
7
+
8
+ $scheme = Mage::app()->getRequest()->getScheme();
9
+ if ($scheme == 'http'){
10
+ $secure = false;
11
+ }else{
12
+ $secure = true;
13
+ }
14
+ $config['baseUrl'] = Mage::getBaseUrl('link', $secure);
15
+ $config['paypalexpress'] = Mage::getUrl('opses/express/start',array('_secure'=>$secure));
16
+ $config['paypalLightBoxEnabled'] = Mage::helper('opc')->getPayPalLightboxEnabled();
17
+ return Mage::helper ( 'core' )->jsonEncode ( $config );
18
+ }
19
+
20
+
21
+
22
+
23
+ }
app/code/community/Abserve/Opc/Block/Onepage/Billing.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Abserve_Opc_Block_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing
4
+ {
5
+ public function getAddress()
6
+ {
7
+ if (is_null($this->_address)) {
8
+ if ($this->isCustomerLoggedIn()) {
9
+ $this->_address = $this->getQuote()->getBillingAddress();
10
+ if(!$this->_address->getFirstname()) {
11
+ $this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
12
+ }
13
+ if(!$this->_address->getLastname()) {
14
+ $this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
15
+ }
16
+ } else {
17
+ $bill = $this->getQuote()->getBillingAddress();
18
+ $bill_country = $bill->getCountryId();
19
+ if(!empty($bill_country))
20
+ $this->_address = $bill;
21
+ else
22
+ $this->_address = Mage::getModel('sales/quote_address');
23
+ }
24
+ }
25
+
26
+ return $this->_address;
27
+ }
28
+ }
app/code/community/Abserve/Opc/Block/Onepage/Comment.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Onepage_Comment extends Mage_Core_Block_Template{
3
+
4
+ public function _construct(){
5
+ $this->setTemplate('opc/onepage/comment.phtml');
6
+ }
7
+
8
+ }
app/code/community/Abserve/Opc/Block/Onepage/Link.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Onepage_Link extends Mage_Core_Block_Template{
3
+
4
+ public function getCheckoutUrl(){
5
+ if (Mage::helper('opc')->isEnable()){
6
+ return $this->getUrl('onepage', array('_secure'=>true));
7
+ }else{
8
+ return $this->getUrl('checkout/onepage', array('_secure'=>true));
9
+ }
10
+ }
11
+
12
+ public function isDisabled(){
13
+ return !Mage::getSingleton('checkout/session')->getQuote()->validateMinimumAmount();
14
+ }
15
+
16
+ public function isPossibleOnepageCheckout()
17
+ {
18
+ return $this->helper('checkout')->canOnepageCheckout();
19
+ }
20
+ }
app/code/community/Abserve/Opc/Block/Onepage/Login.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Onepage_Login extends Mage_Customer_Block_Form_Login{
3
+
4
+ }
app/code/community/Abserve/Opc/Block/Onepage/Shipping.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Abserve_Opc_Block_Onepage_Shipping extends Mage_Checkout_Block_Onepage_Shipping
4
+ {
5
+ public function getAddress()
6
+ {
7
+ if (is_null($this->_address)) {
8
+ if ($this->isCustomerLoggedIn()) {
9
+ $this->_address = $this->getQuote()->getShippingAddress();
10
+ } else {
11
+ $ship = $this->getQuote()->getShippingAddress();
12
+ $ship_country = $ship->getCountryId();
13
+ if(!empty($ship_country))
14
+ $this->_address = $ship;
15
+ else
16
+ $this->_address = Mage::getModel('sales/quote_address');
17
+ }
18
+ }
19
+
20
+ return $this->_address;
21
+ }
22
+
23
+ }
app/code/community/Abserve/Opc/Block/Onepage/Subscribed.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Onepage_Subscribed extends Mage_Core_Block_Template{
3
+
4
+ const XML_PATH_NEWSLETTER = 'opc/default/subscribe';
5
+ const XML_PATH_NEWSLETTER_DEFAULT = 'opc/default/subscribe_default';
6
+
7
+ public function getCheckByDefault(){
8
+ return (bool) Mage::getStoreConfig(self::XML_PATH_NEWSLETTER_DEFAULT);
9
+ }
10
+
11
+
12
+ public function isNewsletterEnabled(){
13
+ $enable = Mage::helper('core')->isModuleOutputEnabled('Mage_Newsletter');
14
+ $show = (bool) Mage::getStoreConfig(self::XML_PATH_NEWSLETTER);
15
+ if ($enable && $show && !Mage::getSingleton('customer/session')->isLoggedIn()){
16
+ return true;
17
+ }
18
+
19
+ return false;
20
+ }
21
+ }
app/code/community/Abserve/Opc/Block/Paypal/Express/Form.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-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 Mage
22
+ * @package Mage_Paypal
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * PayPal Standard payment "form"
29
+ */
30
+ class Abserve_Opc_Block_Paypal_Express_Form extends Abserve_Opc_Block_Paypal_Standard_Form
31
+ {
32
+ /**
33
+ * Payment method code
34
+ * @var string
35
+ */
36
+ protected $_methodCode = Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS;
37
+
38
+ /**
39
+ * Set template and redirect message
40
+ */
41
+ protected function _construct()
42
+ {
43
+ $result = parent::_construct();
44
+ $this->setRedirectMessage(Mage::helper('paypal')->__('You will be redirected to the PayPal website.'));
45
+ return $result;
46
+ }
47
+
48
+ /**
49
+ * Set data to block
50
+ *
51
+ * @return Mage_Core_Block_Abstract
52
+ */
53
+ protected function _beforeToHtml()
54
+ {
55
+ $customerId = Mage::getSingleton('customer/session')->getCustomerId();
56
+ if (Mage::helper('paypal')->shouldAskToCreateBillingAgreement($this->_config, $customerId)
57
+ && $this->canCreateBillingAgreement()) {
58
+ $this->setCreateBACode(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
59
+ }
60
+ return parent::_beforeToHtml();
61
+ }
62
+ }
app/code/community/Abserve/Opc/Block/Paypal/Login.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Paypal_login extends Mage_Core_Block_Template{
3
+
4
+
5
+ protected function _toHtml(){
6
+ $isExtensionEnabled = Mage::getStoreConfigFlag('opc/paypallogin/status');
7
+ if ($isExtensionEnabled) {
8
+ return parent::_toHtml();
9
+ }
10
+ return '';
11
+ }
12
+
13
+ public function getPayPalButtonUrl(){
14
+ return Mage::helper('opc/paypal')->getPayPalButtonUrl();
15
+ }
16
+
17
+ }
app/code/community/Abserve/Opc/Block/Paypal/Standard/Form.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Abserve_Opc_Block_Paypal_Standard_Form extends Mage_Paypal_Block_Standard_Form{
4
+
5
+
6
+ protected function _construct(){
7
+
8
+ $this->_config = Mage::getModel('paypal/config')->setMethod($this->getMethodCode());
9
+ $locale = Mage::app()->getLocale();
10
+ $mark = Mage::getConfig()->getBlockClassName('core/template');
11
+ $mark = new $mark;
12
+ $mark->setTemplate('paypal/payment/mark.phtml')
13
+ ->setPaymentAcceptanceMarkHref($this->_config->getPaymentMarkWhatIsPaypalUrl($locale))
14
+ ->setPaymentAcceptanceMarkSrc($this->_config->getPaymentMarkImageUrl($locale->getLocaleCode()))
15
+ ; // known issue: code above will render only static mark image
16
+
17
+
18
+
19
+
20
+ $this->setTemplate('paypal/payment/redirect.phtml')
21
+ ->setRedirectMessage(
22
+ Mage::helper('paypal')->__('You will be redirected to the PayPal website when you place an order.')
23
+ )
24
+ ->setMethodTitle(Mage::helper('paypal')->__('PayPal')) // Output PayPal mark, omit title
25
+ ->setMethodLabelAfterHtml($mark->toHtml())
26
+ ;
27
+ //return parent::_construct();
28
+ }
29
+ }
app/code/community/Abserve/Opc/Block/System/Config/Form/Fieldset/Extensions.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_System_Config_Form_Fieldset_Extensions extends Mage_Adminhtml_Block_System_Config_Form_Field
3
+ {
4
+
5
+
6
+
7
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
8
+ {
9
+
10
+ $version = Mage::getConfig()->getModuleConfig("Abserve_Opc")->version;
11
+ return '<span class="notice">' . $version . '</span>';
12
+
13
+ }
14
+
15
+
16
+
17
+
18
+ }
app/code/community/Abserve/Opc/Block/Wrapper.php ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Block_Wrapper extends Mage_Core_Block_Template{
3
+
4
+
5
+ const XML_PATH_DEFAULT_SHIPPING = 'opc/default/shipping';
6
+
7
+ const XML_PATH_GEO_COUNTRY = 'opc/geo/country';
8
+
9
+ const XML_PATH_GEO_CITY = 'opc/geo/city';
10
+
11
+
12
+
13
+ /**
14
+ * Get one page checkout model
15
+ *
16
+ * @return Mage_Checkout_Model_Type_Onepage
17
+ */
18
+ public function getOnepage(){
19
+ return Mage::getSingleton('checkout/type_onepage');
20
+ }
21
+
22
+ protected function _getReviewHtml(){
23
+ //clear cache aftr change collection - if no magento can't find product in review block
24
+ Mage::app()->getCacheInstance()->cleanType('layout');
25
+
26
+ $layout = $this->getLayout();
27
+ $update = $layout->getUpdate();
28
+ $update->load('checkout_onepage_review');
29
+ $layout->generateXml();
30
+ $layout->generateBlocks();
31
+ $review = $layout->getBlock('root');
32
+ $review->setTemplate('opc/onepage/review/info.phtml');
33
+
34
+ return $review->toHtml();
35
+ }
36
+
37
+ protected function _getCart(){
38
+ return Mage::getSingleton('checkout/cart');
39
+ }
40
+
41
+
42
+ public function getJsonConfig() {
43
+
44
+ $config = array ();
45
+ $params = array (
46
+ '_secure' => true
47
+ );
48
+
49
+ $base_url = Mage::getBaseUrl('link', true);
50
+
51
+ // protocol for ajax urls should be the same as for current page
52
+ $http_protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on')?'https':'http';
53
+ if ($http_protocol == 'https')
54
+ $base_url = str_replace('http:', 'https:', $base_url);
55
+ else
56
+ $base_url = str_replace('https:', 'http:', $base_url);
57
+ //////
58
+
59
+ $config['baseUrl'] = $base_url;
60
+ $config['isLoggedIn'] = (int) Mage::getSingleton('customer/session')->isLoggedIn();
61
+ $config['comment'] = Mage::helper('opc')->isShowComment();
62
+ $config['paypalLightBoxEnabled'] = Mage::helper('opc')->getPayPalLightboxEnabled();
63
+
64
+ return Mage::helper ( 'core' )->jsonEncode ( $config );
65
+ }
66
+
67
+ protected function validate_color($color){
68
+ $correct_color = '';
69
+
70
+ $pattern = "/([^0-9abcdef])/";
71
+ if(!empty($color)){
72
+ $color = str_replace('#', '', $color);
73
+ if(!preg_match($pattern, $color)){
74
+ if(strlen($color) == 3 || strlen($color) == 6){
75
+ $correct_color = '#'.$color;
76
+ }
77
+ }
78
+ }
79
+ return $correct_color;
80
+ }
81
+
82
+ public function getDesignStyles(){
83
+ $color1 = Mage::getStoreConfig('opc/design/plbgcolor');
84
+ $color2 = Mage::getStoreConfig('opc/design/plovercolor');
85
+ $color3 = Mage::getStoreConfig('opc/design/pltextcolor');
86
+ $color4 = Mage::getStoreConfig('opc/design/btnbgcolor');
87
+ $color5 = Mage::getStoreConfig('opc/design/btnovercolor');
88
+ $color6 = Mage::getStoreConfig('opc/design/btntextcolor');
89
+
90
+ $color7 = Mage::getStoreConfig('opc/design/plhovertextcolor');
91
+ $color8 = Mage::getStoreConfig('opc/design/btnhovertextcolor');
92
+
93
+ $color1 = $this->validate_color($color1);
94
+ $color2 = $this->validate_color($color2);
95
+ $color3 = $this->validate_color($color3);
96
+ $color4 = $this->validate_color($color4);
97
+ $color5 = $this->validate_color($color5);
98
+ $color6 = $this->validate_color($color6);
99
+ $color7 = $this->validate_color($color7);
100
+ $color8 = $this->validate_color($color8);
101
+
102
+ $styles = '';
103
+ if(!empty($color4)){
104
+ $styles.=".opc-wrapper-opc .btn span, .opc-wrapper-opc .btn span span,";
105
+ $styles.=".opc-wrapper-opc .discount-block .button span, .opc-wrapper-opc .discount-block .button span span,";
106
+ $styles.=".opc-wrapper-opc .payment-block dt,";
107
+ $styles.=".opc-wrapper-opc .giftcard .button span, .opc-wrapper-opc .giftcard .button span span,";
108
+ $styles.=".opc-messages-action .button span, .opc-messages-action .button span span,";
109
+ $styles.=".review-menu-block a.review-total, .expand_plus";
110
+ $styles.="{background-color:{$color4} !important;}";
111
+ $styles.=".opc-wrapper-opc .opc-review-actions .view-agreement:hover{color:{$color4} !important;}";
112
+ }
113
+ if(!empty($color5)){
114
+ $styles.=".opc-wrapper-opc .btn:hover span, .opc-wrapper-opc .btn:hover span span,";
115
+ $styles.=".opc-wrapper-opc .discount-block .button:hover span, .opc-wrapper-opc .discount-block .button:hover span span,";
116
+ $styles.=".opc-wrapper-opc .payment-block dt:hover, .opc-wrapper-opc .payment-block dt.active,";
117
+ $styles.=".opc-messages-action .button:hover span, .opc-messages-action .button:hover span span,";
118
+ $styles.=".discount-block h3:hover .expand_plus, .signature-block h3:hover .expand_plus, .comment-block h3:hover .expand_plus, .giftcard h3:hover .expand_plus,";
119
+ $styles.=".discount-block h3.open-block .expand_plus, .signature-block h3.open-block .expand_plus, .comment-block h3.open-block .expand_plus, .giftcard h3.open-block .expand_plus";
120
+ $styles.="{background-color:{$color5} !important;}";
121
+ $styles.=".review-menu-block a.review-total:hover, .review-menu-block a.review-total.open";
122
+ $styles.="{background-color:{$color5} !important;}";
123
+ $styles.=".review-menu-block .polygon{border-top-color:{$color5} !important;}";
124
+ }
125
+ if(!empty($color6)){
126
+ $styles.=".opc-wrapper-opc .discount-block .button span span,";
127
+ $styles.=".opc-wrapper-opc .payment-block dt label,";
128
+ $styles.=".opc-wrapper-opc .btn span span,";
129
+ $styles.=".opc-wrapper-opc a:hover,";
130
+ $styles.=".opc-wrapper-opc .giftcard .button span span,";
131
+ $styles.=".opc-wrapper-opc .giftcard .check-gc-status span,";
132
+ $styles.=".opc-messages-action .button span span,";
133
+ $styles.=".review-menu-block a.review-total span, .review-menu-block a.review-total.open span,";
134
+ $styles.=".expand_plus";
135
+ $styles.="{color:{$color6} !important;}";
136
+ }
137
+ if(!empty($color8)){
138
+ $styles.=".opc-wrapper-opc .discount-block .button:hover span span,";
139
+ $styles.=".opc-wrapper-opc .payment-block dt:hover label, .opc-wrapper-opc .payment-block dt.active label,";
140
+ $styles.=".opc-wrapper-opc .btn:hover span span,";
141
+ $styles.=".opc-messages-action .button:hover span, .opc-messages-action .button:hover span span,";
142
+ $styles.=".review-menu-block a.review-total:hover span, .review-menu-block a.review-total.open span,";
143
+ $styles.=".opc-wrapper-opc a:hover,";
144
+ $styles.="h3:hover .expand_plus,";
145
+ $styles.="h3.open-block .expand_plus";
146
+ $styles.="{color:{$color8} !important;}";
147
+ }
148
+
149
+ if(!empty($color1)){
150
+ $styles.=".opc-wrapper-opc .btn-checkout span, .opc-wrapper-opc .btn-checkout span span,";
151
+ $styles.=".opc-wrapper-opc .login-trigger";
152
+ $styles.="{background-color:{$color1} !important;}";
153
+ // setup color for disabled place order.
154
+ $hex = str_replace('#', '', $color1);
155
+ if(strlen($hex)==3){
156
+ $p1=substr($hex, 0, 1);
157
+ $p1 = $p1.$p1;
158
+ $p2=substr($hex, 1, 1);
159
+ $p2 = $p2.$p2;
160
+ $p3=substr($hex, 2, 1);
161
+ $p3 = $p3.$p3;
162
+ }
163
+ else{
164
+ $p1=substr($hex, 0, 2);
165
+ $p2=substr($hex, 2, 2);
166
+ $p3=substr($hex, 4, 2);
167
+ }
168
+ $p1 = ceil(hexdec($p1)/2);
169
+ $p2 = ceil(hexdec($p2)/2);
170
+ $p3 = ceil(hexdec($p3)/2);
171
+ $styles.=".opc-wrapper-opc .btn-checkout.button-disabled span{background-color:rgba({$p1},{$p2},{$p3}, .8) !important;}";
172
+ }
173
+ if(!empty($color2)){
174
+ $styles.=".opc-wrapper-opc .btn-checkout:hover span, .opc-wrapper-opc .btn-checkout:hover span span";
175
+ $styles.="{background-color:{$color2} !important;}";
176
+ $styles.=".opc-wrapper-opc .login-trigger:hover";
177
+ $styles.="{background-color:{$color2} !important;}";
178
+ }
179
+ if(!empty($color3)){
180
+ $styles.=".opc-wrapper-opc .login-trigger, .opc-wrapper-opc .btn-checkout span span";
181
+ $styles.="{color:{$color3};}";
182
+ $styles.=".opc-wrapper-opc .login-trigger:hover";
183
+ $styles.="{color:{$color3} !important;}";
184
+ }
185
+ if(!empty($color7)){
186
+ $styles.=".opc-wrapper-opc .btn-checkout:hover span span";
187
+ $styles.="{color:{$color7} !important;}";
188
+ $styles.=".opc-wrapper-opc .login-trigger:hover";
189
+ $styles.="{color:{$color7} !important;}";
190
+ }
191
+
192
+ if(!empty($styles))
193
+ $styles = "<style>{$styles}</style>";
194
+
195
+ return $styles;
196
+ }
197
+ }
app/code/community/Abserve/Opc/Helper/City.php ADDED
@@ -0,0 +1,5098 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class GeoIpRecord{
4
+ var $country_code;
5
+ var $country_code3;
6
+ var $country_name;
7
+ var $region;
8
+ var $city;
9
+ var $postal_code;
10
+ var $latitude;
11
+ var $longitude;
12
+ var $area_code;
13
+ var $dma_code; # metro and dma code are the same. use metro_code
14
+ var $metro_code;
15
+ var $continent_code;
16
+ };
17
+
18
+
19
+ class GeoIpRegionVars
20
+ {
21
+ public static $GEOIP_REGION_NAME = array(
22
+ "AD" => array(
23
+ "02" => "Canillo",
24
+ "03" => "Encamp",
25
+ "04" => "La Massana",
26
+ "05" => "Ordino",
27
+ "06" => "Sant Julia de Loria",
28
+ "07" => "Andorra la Vella",
29
+ "08" => "Escaldes-Engordany"),
30
+ "AE" => array(
31
+ "01" => "Abu Dhabi",
32
+ "02" => "Ajman",
33
+ "03" => "Dubai",
34
+ "04" => "Fujairah",
35
+ "05" => "Ras Al Khaimah",
36
+ "06" => "Sharjah",
37
+ "07" => "Umm Al Quwain"),
38
+ "AF" => array(
39
+ "01" => "Badakhshan",
40
+ "02" => "Badghis",
41
+ "03" => "Baghlan",
42
+ "05" => "Bamian",
43
+ "06" => "Farah",
44
+ "07" => "Faryab",
45
+ "08" => "Ghazni",
46
+ "09" => "Ghowr",
47
+ "10" => "Helmand",
48
+ "11" => "Herat",
49
+ "13" => "Kabol",
50
+ "14" => "Kapisa",
51
+ "17" => "Lowgar",
52
+ "18" => "Nangarhar",
53
+ "19" => "Nimruz",
54
+ "23" => "Kandahar",
55
+ "24" => "Kondoz",
56
+ "26" => "Takhar",
57
+ "27" => "Vardak",
58
+ "28" => "Zabol",
59
+ "29" => "Paktika",
60
+ "30" => "Balkh",
61
+ "31" => "Jowzjan",
62
+ "32" => "Samangan",
63
+ "33" => "Sar-e Pol",
64
+ "34" => "Konar",
65
+ "35" => "Laghman",
66
+ "36" => "Paktia",
67
+ "37" => "Khowst",
68
+ "38" => "Nurestan",
69
+ "39" => "Oruzgan",
70
+ "40" => "Parvan",
71
+ "41" => "Daykondi",
72
+ "42" => "Panjshir"),
73
+ "AG" => array(
74
+ "01" => "Barbuda",
75
+ "03" => "Saint George",
76
+ "04" => "Saint John",
77
+ "05" => "Saint Mary",
78
+ "06" => "Saint Paul",
79
+ "07" => "Saint Peter",
80
+ "08" => "Saint Philip",
81
+ "09" => "Redonda"),
82
+ "AL" => array(
83
+ "40" => "Berat",
84
+ "41" => "Diber",
85
+ "42" => "Durres",
86
+ "43" => "Elbasan",
87
+ "44" => "Fier",
88
+ "45" => "Gjirokaster",
89
+ "46" => "Korce",
90
+ "47" => "Kukes",
91
+ "48" => "Lezhe",
92
+ "49" => "Shkoder",
93
+ "50" => "Tirane",
94
+ "51" => "Vlore"),
95
+ "AM" => array(
96
+ "01" => "Aragatsotn",
97
+ "02" => "Ararat",
98
+ "03" => "Armavir",
99
+ "04" => "Geghark'unik'",
100
+ "05" => "Kotayk'",
101
+ "06" => "Lorri",
102
+ "07" => "Shirak",
103
+ "08" => "Syunik'",
104
+ "09" => "Tavush",
105
+ "10" => "Vayots' Dzor",
106
+ "11" => "Yerevan"),
107
+ "AO" => array(
108
+ "01" => "Benguela",
109
+ "02" => "Bie",
110
+ "03" => "Cabinda",
111
+ "04" => "Cuando Cubango",
112
+ "05" => "Cuanza Norte",
113
+ "06" => "Cuanza Sul",
114
+ "07" => "Cunene",
115
+ "08" => "Huambo",
116
+ "09" => "Huila",
117
+ "12" => "Malanje",
118
+ "13" => "Namibe",
119
+ "14" => "Moxico",
120
+ "15" => "Uige",
121
+ "16" => "Zaire",
122
+ "17" => "Lunda Norte",
123
+ "18" => "Lunda Sul",
124
+ "19" => "Bengo",
125
+ "20" => "Luanda"),
126
+ "AR" => array(
127
+ "01" => "Buenos Aires",
128
+ "02" => "Catamarca",
129
+ "03" => "Chaco",
130
+ "04" => "Chubut",
131
+ "05" => "Cordoba",
132
+ "06" => "Corrientes",
133
+ "07" => "Distrito Federal",
134
+ "08" => "Entre Rios",
135
+ "09" => "Formosa",
136
+ "10" => "Jujuy",
137
+ "11" => "La Pampa",
138
+ "12" => "La Rioja",
139
+ "13" => "Mendoza",
140
+ "14" => "Misiones",
141
+ "15" => "Neuquen",
142
+ "16" => "Rio Negro",
143
+ "17" => "Salta",
144
+ "18" => "San Juan",
145
+ "19" => "San Luis",
146
+ "20" => "Santa Cruz",
147
+ "21" => "Santa Fe",
148
+ "22" => "Santiago del Estero",
149
+ "23" => "Tierra del Fuego",
150
+ "24" => "Tucuman"),
151
+ "AT" => array(
152
+ "01" => "Burgenland",
153
+ "02" => "Karnten",
154
+ "03" => "Niederosterreich",
155
+ "04" => "Oberosterreich",
156
+ "05" => "Salzburg",
157
+ "06" => "Steiermark",
158
+ "07" => "Tirol",
159
+ "08" => "Vorarlberg",
160
+ "09" => "Wien"),
161
+ "AU" => array(
162
+ "01" => "Australian Capital Territory",
163
+ "02" => "New South Wales",
164
+ "03" => "Northern Territory",
165
+ "04" => "Queensland",
166
+ "05" => "South Australia",
167
+ "06" => "Tasmania",
168
+ "07" => "Victoria",
169
+ "08" => "Western Australia"),
170
+ "AZ" => array(
171
+ "01" => "Abseron",
172
+ "02" => "Agcabadi",
173
+ "03" => "Agdam",
174
+ "04" => "Agdas",
175
+ "05" => "Agstafa",
176
+ "06" => "Agsu",
177
+ "07" => "Ali Bayramli",
178
+ "08" => "Astara",
179
+ "09" => "Baki",
180
+ "10" => "Balakan",
181
+ "11" => "Barda",
182
+ "12" => "Beylaqan",
183
+ "13" => "Bilasuvar",
184
+ "14" => "Cabrayil",
185
+ "15" => "Calilabad",
186
+ "16" => "Daskasan",
187
+ "17" => "Davaci",
188
+ "18" => "Fuzuli",
189
+ "19" => "Gadabay",
190
+ "20" => "Ganca",
191
+ "21" => "Goranboy",
192
+ "22" => "Goycay",
193
+ "23" => "Haciqabul",
194
+ "24" => "Imisli",
195
+ "25" => "Ismayilli",
196
+ "26" => "Kalbacar",
197
+ "27" => "Kurdamir",
198
+ "28" => "Lacin",
199
+ "29" => "Lankaran",
200
+ "30" => "Lankaran",
201
+ "31" => "Lerik",
202
+ "32" => "Masalli",
203
+ "33" => "Mingacevir",
204
+ "34" => "Naftalan",
205
+ "35" => "Naxcivan",
206
+ "36" => "Neftcala",
207
+ "37" => "Oguz",
208
+ "38" => "Qabala",
209
+ "39" => "Qax",
210
+ "40" => "Qazax",
211
+ "41" => "Qobustan",
212
+ "42" => "Quba",
213
+ "43" => "Qubadli",
214
+ "44" => "Qusar",
215
+ "45" => "Saatli",
216
+ "46" => "Sabirabad",
217
+ "47" => "Saki",
218
+ "48" => "Saki",
219
+ "49" => "Salyan",
220
+ "50" => "Samaxi",
221
+ "51" => "Samkir",
222
+ "52" => "Samux",
223
+ "53" => "Siyazan",
224
+ "54" => "Sumqayit",
225
+ "55" => "Susa",
226
+ "56" => "Susa",
227
+ "57" => "Tartar",
228
+ "58" => "Tovuz",
229
+ "59" => "Ucar",
230
+ "60" => "Xacmaz",
231
+ "61" => "Xankandi",
232
+ "62" => "Xanlar",
233
+ "63" => "Xizi",
234
+ "64" => "Xocali",
235
+ "65" => "Xocavand",
236
+ "66" => "Yardimli",
237
+ "67" => "Yevlax",
238
+ "68" => "Yevlax",
239
+ "69" => "Zangilan",
240
+ "70" => "Zaqatala",
241
+ "71" => "Zardab"),
242
+ "BA" => array(
243
+ "01" => "Federation of Bosnia and Herzegovina",
244
+ "02" => "Republika Srpska"),
245
+ "BB" => array(
246
+ "01" => "Christ Church",
247
+ "02" => "Saint Andrew",
248
+ "03" => "Saint George",
249
+ "04" => "Saint James",
250
+ "05" => "Saint John",
251
+ "06" => "Saint Joseph",
252
+ "07" => "Saint Lucy",
253
+ "08" => "Saint Michael",
254
+ "09" => "Saint Peter",
255
+ "10" => "Saint Philip",
256
+ "11" => "Saint Thomas"),
257
+ "BD" => array(
258
+ "81" => "Dhaka",
259
+ "82" => "Khulna",
260
+ "83" => "Rajshahi",
261
+ "84" => "Chittagong",
262
+ "85" => "Barisal",
263
+ "86" => "Sylhet"),
264
+ "BE" => array(
265
+ "01" => "Antwerpen",
266
+ "03" => "Hainaut",
267
+ "04" => "Liege",
268
+ "05" => "Limburg",
269
+ "06" => "Luxembourg",
270
+ "07" => "Namur",
271
+ "08" => "Oost-Vlaanderen",
272
+ "09" => "West-Vlaanderen",
273
+ "10" => "Brabant Wallon",
274
+ "11" => "Brussels Hoofdstedelijk Gewest",
275
+ "12" => "Vlaams-Brabant",
276
+ "13" => "Flanders",
277
+ "14" => "Wallonia"),
278
+ "BF" => array(
279
+ "15" => "Bam",
280
+ "19" => "Boulkiemde",
281
+ "20" => "Ganzourgou",
282
+ "21" => "Gnagna",
283
+ "28" => "Kouritenga",
284
+ "33" => "Oudalan",
285
+ "34" => "Passore",
286
+ "36" => "Sanguie",
287
+ "40" => "Soum",
288
+ "42" => "Tapoa",
289
+ "44" => "Zoundweogo",
290
+ "45" => "Bale",
291
+ "46" => "Banwa",
292
+ "47" => "Bazega",
293
+ "48" => "Bougouriba",
294
+ "49" => "Boulgou",
295
+ "50" => "Gourma",
296
+ "51" => "Houet",
297
+ "52" => "Ioba",
298
+ "53" => "Kadiogo",
299
+ "54" => "Kenedougou",
300
+ "55" => "Komoe",
301
+ "56" => "Komondjari",
302
+ "57" => "Kompienga",
303
+ "58" => "Kossi",
304
+ "59" => "Koulpelogo",
305
+ "60" => "Kourweogo",
306
+ "61" => "Leraba",
307
+ "62" => "Loroum",
308
+ "63" => "Mouhoun",
309
+ "64" => "Namentenga",
310
+ "65" => "Naouri",
311
+ "66" => "Nayala",
312
+ "67" => "Noumbiel",
313
+ "68" => "Oubritenga",
314
+ "69" => "Poni",
315
+ "70" => "Sanmatenga",
316
+ "71" => "Seno",
317
+ "72" => "Sissili",
318
+ "73" => "Sourou",
319
+ "74" => "Tuy",
320
+ "75" => "Yagha",
321
+ "76" => "Yatenga",
322
+ "77" => "Ziro",
323
+ "78" => "Zondoma"),
324
+ "BG" => array(
325
+ "33" => "Mikhaylovgrad",
326
+ "38" => "Blagoevgrad",
327
+ "39" => "Burgas",
328
+ "40" => "Dobrich",
329
+ "41" => "Gabrovo",
330
+ "42" => "Grad Sofiya",
331
+ "43" => "Khaskovo",
332
+ "44" => "Kurdzhali",
333
+ "45" => "Kyustendil",
334
+ "46" => "Lovech",
335
+ "47" => "Montana",
336
+ "48" => "Pazardzhik",
337
+ "49" => "Pernik",
338
+ "50" => "Pleven",
339
+ "51" => "Plovdiv",
340
+ "52" => "Razgrad",
341
+ "53" => "Ruse",
342
+ "54" => "Shumen",
343
+ "55" => "Silistra",
344
+ "56" => "Sliven",
345
+ "57" => "Smolyan",
346
+ "58" => "Sofiya",
347
+ "59" => "Stara Zagora",
348
+ "60" => "Turgovishte",
349
+ "61" => "Varna",
350
+ "62" => "Veliko Turnovo",
351
+ "63" => "Vidin",
352
+ "64" => "Vratsa",
353
+ "65" => "Yambol"),
354
+ "BH" => array(
355
+ "01" => "Al Hadd",
356
+ "02" => "Al Manamah",
357
+ "05" => "Jidd Hafs",
358
+ "06" => "Sitrah",
359
+ "08" => "Al Mintaqah al Gharbiyah",
360
+ "09" => "Mintaqat Juzur Hawar",
361
+ "10" => "Al Mintaqah ash Shamaliyah",
362
+ "11" => "Al Mintaqah al Wusta",
363
+ "12" => "Madinat",
364
+ "13" => "Ar Rifa",
365
+ "14" => "Madinat Hamad",
366
+ "15" => "Al Muharraq",
367
+ "16" => "Al Asimah",
368
+ "17" => "Al Janubiyah",
369
+ "18" => "Ash Shamaliyah",
370
+ "19" => "Al Wusta"),
371
+ "BI" => array(
372
+ "02" => "Bujumbura",
373
+ "09" => "Bubanza",
374
+ "10" => "Bururi",
375
+ "11" => "Cankuzo",
376
+ "12" => "Cibitoke",
377
+ "13" => "Gitega",
378
+ "14" => "Karuzi",
379
+ "15" => "Kayanza",
380
+ "16" => "Kirundo",
381
+ "17" => "Makamba",
382
+ "18" => "Muyinga",
383
+ "19" => "Ngozi",
384
+ "20" => "Rutana",
385
+ "21" => "Ruyigi",
386
+ "22" => "Muramvya",
387
+ "23" => "Mwaro"),
388
+ "BJ" => array(
389
+ "07" => "Alibori",
390
+ "08" => "Atakora",
391
+ "09" => "Atlanyique",
392
+ "10" => "Borgou",
393
+ "11" => "Collines",
394
+ "12" => "Kouffo",
395
+ "13" => "Donga",
396
+ "14" => "Littoral",
397
+ "15" => "Mono",
398
+ "16" => "Oueme",
399
+ "17" => "Plateau",
400
+ "18" => "Zou"),
401
+ "BM" => array(
402
+ "01" => "Devonshire",
403
+ "02" => "Hamilton",
404
+ "03" => "Hamilton",
405
+ "04" => "Paget",
406
+ "05" => "Pembroke",
407
+ "06" => "Saint George",
408
+ "07" => "Saint George's",
409
+ "08" => "Sandys",
410
+ "09" => "Smiths",
411
+ "10" => "Southampton",
412
+ "11" => "Warwick"),
413
+ "BN" => array(
414
+ "07" => "Alibori",
415
+ "08" => "Belait",
416
+ "09" => "Brunei and Muara",
417
+ "10" => "Temburong",
418
+ "11" => "Collines",
419
+ "12" => "Kouffo",
420
+ "13" => "Donga",
421
+ "14" => "Littoral",
422
+ "15" => "Tutong",
423
+ "16" => "Oueme",
424
+ "17" => "Plateau",
425
+ "18" => "Zou"),
426
+ "BO" => array(
427
+ "01" => "Chuquisaca",
428
+ "02" => "Cochabamba",
429
+ "03" => "El Beni",
430
+ "04" => "La Paz",
431
+ "05" => "Oruro",
432
+ "06" => "Pando",
433
+ "07" => "Potosi",
434
+ "08" => "Santa Cruz",
435
+ "09" => "Tarija"),
436
+ "BR" => array(
437
+ "01" => "Acre",
438
+ "02" => "Alagoas",
439
+ "03" => "Amapa",
440
+ "04" => "Amazonas",
441
+ "05" => "Bahia",
442
+ "06" => "Ceara",
443
+ "07" => "Distrito Federal",
444
+ "08" => "Espirito Santo",
445
+ "11" => "Mato Grosso do Sul",
446
+ "13" => "Maranhao",
447
+ "14" => "Mato Grosso",
448
+ "15" => "Minas Gerais",
449
+ "16" => "Para",
450
+ "17" => "Paraiba",
451
+ "18" => "Parana",
452
+ "20" => "Piaui",
453
+ "21" => "Rio de Janeiro",
454
+ "22" => "Rio Grande do Norte",
455
+ "23" => "Rio Grande do Sul",
456
+ "24" => "Rondonia",
457
+ "25" => "Roraima",
458
+ "26" => "Santa Catarina",
459
+ "27" => "Sao Paulo",
460
+ "28" => "Sergipe",
461
+ "29" => "Goias",
462
+ "30" => "Pernambuco",
463
+ "31" => "Tocantins"),
464
+ "BS" => array(
465
+ "05" => "Bimini",
466
+ "06" => "Cat Island",
467
+ "10" => "Exuma",
468
+ "13" => "Inagua",
469
+ "15" => "Long Island",
470
+ "16" => "Mayaguana",
471
+ "18" => "Ragged Island",
472
+ "22" => "Harbour Island",
473
+ "23" => "New Providence",
474
+ "24" => "Acklins and Crooked Islands",
475
+ "25" => "Freeport",
476
+ "26" => "Fresh Creek",
477
+ "27" => "Governor's Harbour",
478
+ "28" => "Green Turtle Cay",
479
+ "29" => "High Rock",
480
+ "30" => "Kemps Bay",
481
+ "31" => "Marsh Harbour",
482
+ "32" => "Nichollstown and Berry Islands",
483
+ "33" => "Rock Sound",
484
+ "34" => "Sandy Point",
485
+ "35" => "San Salvador and Rum Cay"),
486
+ "BT" => array(
487
+ "05" => "Bumthang",
488
+ "06" => "Chhukha",
489
+ "07" => "Chirang",
490
+ "08" => "Daga",
491
+ "09" => "Geylegphug",
492
+ "10" => "Ha",
493
+ "11" => "Lhuntshi",
494
+ "12" => "Mongar",
495
+ "13" => "Paro",
496
+ "14" => "Pemagatsel",
497
+ "15" => "Punakha",
498
+ "16" => "Samchi",
499
+ "17" => "Samdrup",
500
+ "18" => "Shemgang",
501
+ "19" => "Tashigang",
502
+ "20" => "Thimphu",
503
+ "21" => "Tongsa",
504
+ "22" => "Wangdi Phodrang"),
505
+ "BW" => array(
506
+ "01" => "Central",
507
+ "03" => "Ghanzi",
508
+ "04" => "Kgalagadi",
509
+ "05" => "Kgatleng",
510
+ "06" => "Kweneng",
511
+ "08" => "North-East",
512
+ "09" => "South-East",
513
+ "10" => "Southern",
514
+ "11" => "North-West"),
515
+ "BY" => array(
516
+ "01" => "Brestskaya Voblasts'",
517
+ "02" => "Homyel'skaya Voblasts'",
518
+ "03" => "Hrodzyenskaya Voblasts'",
519
+ "04" => "Minsk",
520
+ "05" => "Minskaya Voblasts'",
521
+ "06" => "Mahilyowskaya Voblasts'",
522
+ "07" => "Vitsyebskaya Voblasts'"),
523
+ "BZ" => array(
524
+ "01" => "Belize",
525
+ "02" => "Cayo",
526
+ "03" => "Corozal",
527
+ "04" => "Orange Walk",
528
+ "05" => "Stann Creek",
529
+ "06" => "Toledo"),
530
+ "CA" => array(
531
+ "AB" => "Alberta",
532
+ "BC" => "British Columbia",
533
+ "MB" => "Manitoba",
534
+ "NB" => "New Brunswick",
535
+ "NL" => "Newfoundland",
536
+ "NS" => "Nova Scotia",
537
+ "NT" => "Northwest Territories",
538
+ "NU" => "Nunavut",
539
+ "ON" => "Ontario",
540
+ "PE" => "Prince Edward Island",
541
+ "QC" => "Quebec",
542
+ "SK" => "Saskatchewan",
543
+ "YT" => "Yukon Territory"),
544
+ "CD" => array(
545
+ "01" => "Bandundu",
546
+ "02" => "Equateur",
547
+ "04" => "Kasai-Oriental",
548
+ "05" => "Katanga",
549
+ "06" => "Kinshasa",
550
+ "08" => "Bas-Congo",
551
+ "09" => "Orientale",
552
+ "10" => "Maniema",
553
+ "11" => "Nord-Kivu",
554
+ "12" => "Sud-Kivu"),
555
+ "CF" => array(
556
+ "01" => "Bamingui-Bangoran",
557
+ "02" => "Basse-Kotto",
558
+ "03" => "Haute-Kotto",
559
+ "04" => "Mambere-Kadei",
560
+ "05" => "Haut-Mbomou",
561
+ "06" => "Kemo",
562
+ "07" => "Lobaye",
563
+ "08" => "Mbomou",
564
+ "09" => "Nana-Mambere",
565
+ "11" => "Ouaka",
566
+ "12" => "Ouham",
567
+ "13" => "Ouham-Pende",
568
+ "14" => "Cuvette-Ouest",
569
+ "15" => "Nana-Grebizi",
570
+ "16" => "Sangha-Mbaere",
571
+ "17" => "Ombella-Mpoko",
572
+ "18" => "Bangui"),
573
+ "CG" => array(
574
+ "01" => "Bouenza",
575
+ "04" => "Kouilou",
576
+ "05" => "Lekoumou",
577
+ "06" => "Likouala",
578
+ "07" => "Niari",
579
+ "08" => "Plateaux",
580
+ "10" => "Sangha",
581
+ "11" => "Pool",
582
+ "12" => "Brazzaville",
583
+ "13" => "Cuvette",
584
+ "14" => "Cuvette-Ouest"),
585
+ "CH" => array(
586
+ "01" => "Aargau",
587
+ "02" => "Ausser-Rhoden",
588
+ "03" => "Basel-Landschaft",
589
+ "04" => "Basel-Stadt",
590
+ "05" => "Bern",
591
+ "06" => "Fribourg",
592
+ "07" => "Geneve",
593
+ "08" => "Glarus",
594
+ "09" => "Graubunden",
595
+ "10" => "Inner-Rhoden",
596
+ "11" => "Luzern",
597
+ "12" => "Neuchatel",
598
+ "13" => "Nidwalden",
599
+ "14" => "Obwalden",
600
+ "15" => "Sankt Gallen",
601
+ "16" => "Schaffhausen",
602
+ "17" => "Schwyz",
603
+ "18" => "Solothurn",
604
+ "19" => "Thurgau",
605
+ "20" => "Ticino",
606
+ "21" => "Uri",
607
+ "22" => "Valais",
608
+ "23" => "Vaud",
609
+ "24" => "Zug",
610
+ "25" => "Zurich",
611
+ "26" => "Jura"),
612
+ "CI" => array(
613
+ "74" => "Agneby",
614
+ "75" => "Bafing",
615
+ "76" => "Bas-Sassandra",
616
+ "77" => "Denguele",
617
+ "78" => "Dix-Huit Montagnes",
618
+ "79" => "Fromager",
619
+ "80" => "Haut-Sassandra",
620
+ "81" => "Lacs",
621
+ "82" => "Lagunes",
622
+ "83" => "Marahoue",
623
+ "84" => "Moyen-Cavally",
624
+ "85" => "Moyen-Comoe",
625
+ "86" => "N'zi-Comoe",
626
+ "87" => "Savanes",
627
+ "88" => "Sud-Bandama",
628
+ "89" => "Sud-Comoe",
629
+ "90" => "Vallee du Bandama",
630
+ "91" => "Worodougou",
631
+ "92" => "Zanzan"),
632
+ "CL" => array(
633
+ "01" => "Valparaiso",
634
+ "02" => "Aisen del General Carlos Ibanez del Campo",
635
+ "03" => "Antofagasta",
636
+ "04" => "Araucania",
637
+ "05" => "Atacama",
638
+ "06" => "Bio-Bio",
639
+ "07" => "Coquimbo",
640
+ "08" => "Libertador General Bernardo O'Higgins",
641
+ "09" => "Los Lagos",
642
+ "10" => "Magallanes y de la Antartica Chilena",
643
+ "11" => "Maule",
644
+ "12" => "Region Metropolitana",
645
+ "13" => "Tarapaca",
646
+ "14" => "Los Lagos",
647
+ "15" => "Tarapaca",
648
+ "16" => "Arica y Parinacota",
649
+ "17" => "Los Rios"),
650
+ "CM" => array(
651
+ "04" => "Est",
652
+ "05" => "Littoral",
653
+ "07" => "Nord-Ouest",
654
+ "08" => "Ouest",
655
+ "09" => "Sud-Ouest",
656
+ "10" => "Adamaoua",
657
+ "11" => "Centre",
658
+ "12" => "Extreme-Nord",
659
+ "13" => "Nord",
660
+ "14" => "Sud"),
661
+ "CN" => array(
662
+ "01" => "Anhui",
663
+ "02" => "Zhejiang",
664
+ "03" => "Jiangxi",
665
+ "04" => "Jiangsu",
666
+ "05" => "Jilin",
667
+ "06" => "Qinghai",
668
+ "07" => "Fujian",
669
+ "08" => "Heilongjiang",
670
+ "09" => "Henan",
671
+ "10" => "Hebei",
672
+ "11" => "Hunan",
673
+ "12" => "Hubei",
674
+ "13" => "Xinjiang",
675
+ "14" => "Xizang",
676
+ "15" => "Gansu",
677
+ "16" => "Guangxi",
678
+ "18" => "Guizhou",
679
+ "19" => "Liaoning",
680
+ "20" => "Nei Mongol",
681
+ "21" => "Ningxia",
682
+ "22" => "Beijing",
683
+ "23" => "Shanghai",
684
+ "24" => "Shanxi",
685
+ "25" => "Shandong",
686
+ "26" => "Shaanxi",
687
+ "28" => "Tianjin",
688
+ "29" => "Yunnan",
689
+ "30" => "Guangdong",
690
+ "31" => "Hainan",
691
+ "32" => "Sichuan",
692
+ "33" => "Chongqing"),
693
+ "CO" => array(
694
+ "01" => "Amazonas",
695
+ "02" => "Antioquia",
696
+ "03" => "Arauca",
697
+ "04" => "Atlantico",
698
+ "08" => "Caqueta",
699
+ "09" => "Cauca",
700
+ "10" => "Cesar",
701
+ "11" => "Choco",
702
+ "12" => "Cordoba",
703
+ "14" => "Guaviare",
704
+ "15" => "Guainia",
705
+ "16" => "Huila",
706
+ "17" => "La Guajira",
707
+ "19" => "Meta",
708
+ "20" => "Narino",
709
+ "21" => "Norte de Santander",
710
+ "22" => "Putumayo",
711
+ "23" => "Quindio",
712
+ "24" => "Risaralda",
713
+ "25" => "San Andres y Providencia",
714
+ "26" => "Santander",
715
+ "27" => "Sucre",
716
+ "28" => "Tolima",
717
+ "29" => "Valle del Cauca",
718
+ "30" => "Vaupes",
719
+ "31" => "Vichada",
720
+ "32" => "Casanare",
721
+ "33" => "Cundinamarca",
722
+ "34" => "Distrito Especial",
723
+ "35" => "Bolivar",
724
+ "36" => "Boyaca",
725
+ "37" => "Caldas",
726
+ "38" => "Magdalena"),
727
+ "CR" => array(
728
+ "01" => "Alajuela",
729
+ "02" => "Cartago",
730
+ "03" => "Guanacaste",
731
+ "04" => "Heredia",
732
+ "06" => "Limon",
733
+ "07" => "Puntarenas",
734
+ "08" => "San Jose"),
735
+ "CU" => array(
736
+ "01" => "Pinar del Rio",
737
+ "02" => "Ciudad de la Habana",
738
+ "03" => "Matanzas",
739
+ "04" => "Isla de la Juventud",
740
+ "05" => "Camaguey",
741
+ "07" => "Ciego de Avila",
742
+ "08" => "Cienfuegos",
743
+ "09" => "Granma",
744
+ "10" => "Guantanamo",
745
+ "11" => "La Habana",
746
+ "12" => "Holguin",
747
+ "13" => "Las Tunas",
748
+ "14" => "Sancti Spiritus",
749
+ "15" => "Santiago de Cuba",
750
+ "16" => "Villa Clara"),
751
+ "CV" => array(
752
+ "01" => "Boa Vista",
753
+ "02" => "Brava",
754
+ "04" => "Maio",
755
+ "05" => "Paul",
756
+ "07" => "Ribeira Grande",
757
+ "08" => "Sal",
758
+ "10" => "Sao Nicolau",
759
+ "11" => "Sao Vicente",
760
+ "13" => "Mosteiros",
761
+ "14" => "Praia",
762
+ "15" => "Santa Catarina",
763
+ "16" => "Santa Cruz",
764
+ "17" => "Sao Domingos",
765
+ "18" => "Sao Filipe",
766
+ "19" => "Sao Miguel",
767
+ "20" => "Tarrafal"),
768
+ "CY" => array(
769
+ "01" => "Famagusta",
770
+ "02" => "Kyrenia",
771
+ "03" => "Larnaca",
772
+ "04" => "Nicosia",
773
+ "05" => "Limassol",
774
+ "06" => "Paphos"),
775
+ "CZ" => array(
776
+ "52" => "Hlavni mesto Praha",
777
+ "78" => "Jihomoravsky kraj",
778
+ "79" => "Jihocesky kraj",
779
+ "80" => "Vysocina",
780
+ "81" => "Karlovarsky kraj",
781
+ "82" => "Kralovehradecky kraj",
782
+ "83" => "Liberecky kraj",
783
+ "84" => "Olomoucky kraj",
784
+ "85" => "Moravskoslezsky kraj",
785
+ "86" => "Pardubicky kraj",
786
+ "87" => "Plzensky kraj",
787
+ "88" => "Stredocesky kraj",
788
+ "89" => "Ustecky kraj",
789
+ "90" => "Zlinsky kraj"),
790
+ "DE" => array(
791
+ "01" => "Baden-Wurttemberg",
792
+ "02" => "Bayern",
793
+ "03" => "Bremen",
794
+ "04" => "Hamburg",
795
+ "05" => "Hessen",
796
+ "06" => "Niedersachsen",
797
+ "07" => "Nordrhein-Westfalen",
798
+ "08" => "Rheinland-Pfalz",
799
+ "09" => "Saarland",
800
+ "10" => "Schleswig-Holstein",
801
+ "11" => "Brandenburg",
802
+ "12" => "Mecklenburg-Vorpommern",
803
+ "13" => "Sachsen",
804
+ "14" => "Sachsen-Anhalt",
805
+ "15" => "Thuringen",
806
+ "16" => "Berlin"),
807
+ "DJ" => array(
808
+ "01" => "Ali Sabieh",
809
+ "04" => "Obock",
810
+ "05" => "Tadjoura",
811
+ "06" => "Dikhil",
812
+ "07" => "Djibouti",
813
+ "08" => "Arta"),
814
+ "DK" => array(
815
+ "17" => "Hovedstaden",
816
+ "18" => "Midtjylland",
817
+ "19" => "Nordjylland",
818
+ "20" => "Sjelland",
819
+ "21" => "Syddanmark"),
820
+ "DM" => array(
821
+ "02" => "Saint Andrew",
822
+ "03" => "Saint David",
823
+ "04" => "Saint George",
824
+ "05" => "Saint John",
825
+ "06" => "Saint Joseph",
826
+ "07" => "Saint Luke",
827
+ "08" => "Saint Mark",
828
+ "09" => "Saint Patrick",
829
+ "10" => "Saint Paul",
830
+ "11" => "Saint Peter"),
831
+ "DO" => array(
832
+ "01" => "Azua",
833
+ "02" => "Baoruco",
834
+ "03" => "Barahona",
835
+ "04" => "Dajabon",
836
+ "05" => "Distrito Nacional",
837
+ "06" => "Duarte",
838
+ "08" => "Espaillat",
839
+ "09" => "Independencia",
840
+ "10" => "La Altagracia",
841
+ "11" => "Elias Pina",
842
+ "12" => "La Romana",
843
+ "14" => "Maria Trinidad Sanchez",
844
+ "15" => "Monte Cristi",
845
+ "16" => "Pedernales",
846
+ "17" => "Peravia",
847
+ "18" => "Puerto Plata",
848
+ "19" => "Salcedo",
849
+ "20" => "Samana",
850
+ "21" => "Sanchez Ramirez",
851
+ "23" => "San Juan",
852
+ "24" => "San Pedro De Macoris",
853
+ "25" => "Santiago",
854
+ "26" => "Santiago Rodriguez",
855
+ "27" => "Valverde",
856
+ "28" => "El Seibo",
857
+ "29" => "Hato Mayor",
858
+ "30" => "La Vega",
859
+ "31" => "Monsenor Nouel",
860
+ "32" => "Monte Plata",
861
+ "33" => "San Cristobal",
862
+ "34" => "Distrito Nacional",
863
+ "35" => "Peravia",
864
+ "36" => "San Jose de Ocoa",
865
+ "37" => "Santo Domingo"),
866
+ "DZ" => array(
867
+ "01" => "Alger",
868
+ "03" => "Batna",
869
+ "04" => "Constantine",
870
+ "06" => "Medea",
871
+ "07" => "Mostaganem",
872
+ "09" => "Oran",
873
+ "10" => "Saida",
874
+ "12" => "Setif",
875
+ "13" => "Tiaret",
876
+ "14" => "Tizi Ouzou",
877
+ "15" => "Tlemcen",
878
+ "18" => "Bejaia",
879
+ "19" => "Biskra",
880
+ "20" => "Blida",
881
+ "21" => "Bouira",
882
+ "22" => "Djelfa",
883
+ "23" => "Guelma",
884
+ "24" => "Jijel",
885
+ "25" => "Laghouat",
886
+ "26" => "Mascara",
887
+ "27" => "M'sila",
888
+ "29" => "Oum el Bouaghi",
889
+ "30" => "Sidi Bel Abbes",
890
+ "31" => "Skikda",
891
+ "33" => "Tebessa",
892
+ "34" => "Adrar",
893
+ "35" => "Ain Defla",
894
+ "36" => "Ain Temouchent",
895
+ "37" => "Annaba",
896
+ "38" => "Bechar",
897
+ "39" => "Bordj Bou Arreridj",
898
+ "40" => "Boumerdes",
899
+ "41" => "Chlef",
900
+ "42" => "El Bayadh",
901
+ "43" => "El Oued",
902
+ "44" => "El Tarf",
903
+ "45" => "Ghardaia",
904
+ "46" => "Illizi",
905
+ "47" => "Khenchela",
906
+ "48" => "Mila",
907
+ "49" => "Naama",
908
+ "50" => "Ouargla",
909
+ "51" => "Relizane",
910
+ "52" => "Souk Ahras",
911
+ "53" => "Tamanghasset",
912
+ "54" => "Tindouf",
913
+ "55" => "Tipaza",
914
+ "56" => "Tissemsilt"),
915
+ "EC" => array(
916
+ "01" => "Galapagos",
917
+ "02" => "Azuay",
918
+ "03" => "Bolivar",
919
+ "04" => "Canar",
920
+ "05" => "Carchi",
921
+ "06" => "Chimborazo",
922
+ "07" => "Cotopaxi",
923
+ "08" => "El Oro",
924
+ "09" => "Esmeraldas",
925
+ "10" => "Guayas",
926
+ "11" => "Imbabura",
927
+ "12" => "Loja",
928
+ "13" => "Los Rios",
929
+ "14" => "Manabi",
930
+ "15" => "Morona-Santiago",
931
+ "17" => "Pastaza",
932
+ "18" => "Pichincha",
933
+ "19" => "Tungurahua",
934
+ "20" => "Zamora-Chinchipe",
935
+ "22" => "Sucumbios",
936
+ "23" => "Napo",
937
+ "24" => "Orellana"),
938
+ "EE" => array(
939
+ "01" => "Harjumaa",
940
+ "02" => "Hiiumaa",
941
+ "03" => "Ida-Virumaa",
942
+ "04" => "Jarvamaa",
943
+ "05" => "Jogevamaa",
944
+ "06" => "Kohtla-Jarve",
945
+ "07" => "Laanemaa",
946
+ "08" => "Laane-Virumaa",
947
+ "09" => "Narva",
948
+ "10" => "Parnu",
949
+ "11" => "Parnumaa",
950
+ "12" => "Polvamaa",
951
+ "13" => "Raplamaa",
952
+ "14" => "Saaremaa",
953
+ "15" => "Sillamae",
954
+ "16" => "Tallinn",
955
+ "17" => "Tartu",
956
+ "18" => "Tartumaa",
957
+ "19" => "Valgamaa",
958
+ "20" => "Viljandimaa",
959
+ "21" => "Vorumaa"),
960
+ "EG" => array(
961
+ "01" => "Ad Daqahliyah",
962
+ "02" => "Al Bahr al Ahmar",
963
+ "03" => "Al Buhayrah",
964
+ "04" => "Al Fayyum",
965
+ "05" => "Al Gharbiyah",
966
+ "06" => "Al Iskandariyah",
967
+ "07" => "Al Isma'iliyah",
968
+ "08" => "Al Jizah",
969
+ "09" => "Al Minufiyah",
970
+ "10" => "Al Minya",
971
+ "11" => "Al Qahirah",
972
+ "12" => "Al Qalyubiyah",
973
+ "13" => "Al Wadi al Jadid",
974
+ "14" => "Ash Sharqiyah",
975
+ "15" => "As Suways",
976
+ "16" => "Aswan",
977
+ "17" => "Asyut",
978
+ "18" => "Bani Suwayf",
979
+ "19" => "Bur Sa'id",
980
+ "20" => "Dumyat",
981
+ "21" => "Kafr ash Shaykh",
982
+ "22" => "Matruh",
983
+ "23" => "Qina",
984
+ "24" => "Suhaj",
985
+ "26" => "Janub Sina'",
986
+ "27" => "Shamal Sina'"),
987
+ "ER" => array(
988
+ "01" => "Anseba",
989
+ "02" => "Debub",
990
+ "03" => "Debubawi K'eyih Bahri",
991
+ "04" => "Gash Barka",
992
+ "05" => "Ma'akel",
993
+ "06" => "Semenawi K'eyih Bahri"),
994
+ "ES" => array(
995
+ "07" => "Islas Baleares",
996
+ "27" => "La Rioja",
997
+ "29" => "Madrid",
998
+ "31" => "Murcia",
999
+ "32" => "Navarra",
1000
+ "34" => "Asturias",
1001
+ "39" => "Cantabria",
1002
+ "51" => "Andalucia",
1003
+ "52" => "Aragon",
1004
+ "53" => "Canarias",
1005
+ "54" => "Castilla-La Mancha",
1006
+ "55" => "Castilla y Leon",
1007
+ "56" => "Catalonia",
1008
+ "57" => "Extremadura",
1009
+ "58" => "Galicia",
1010
+ "59" => "Pais Vasco",
1011
+ "60" => "Comunidad Valenciana"),
1012
+ "ET" => array(
1013
+ "44" => "Adis Abeba",
1014
+ "45" => "Afar",
1015
+ "46" => "Amara",
1016
+ "47" => "Binshangul Gumuz",
1017
+ "48" => "Dire Dawa",
1018
+ "49" => "Gambela Hizboch",
1019
+ "50" => "Hareri Hizb",
1020
+ "51" => "Oromiya",
1021
+ "52" => "Sumale",
1022
+ "53" => "Tigray",
1023
+ "54" => "YeDebub Biheroch Bihereseboch na Hizboch"),
1024
+ "FI" => array(
1025
+ "01" => "Aland",
1026
+ "06" => "Lapland",
1027
+ "08" => "Oulu",
1028
+ "13" => "Southern Finland",
1029
+ "14" => "Eastern Finland",
1030
+ "15" => "Western Finland"),
1031
+ "FJ" => array(
1032
+ "01" => "Central",
1033
+ "02" => "Eastern",
1034
+ "03" => "Northern",
1035
+ "04" => "Rotuma",
1036
+ "05" => "Western"),
1037
+ "FM" => array(
1038
+ "01" => "Kosrae",
1039
+ "02" => "Pohnpei",
1040
+ "03" => "Chuuk",
1041
+ "04" => "Yap"),
1042
+ "FR" => array(
1043
+ "97" => "Aquitaine",
1044
+ "98" => "Auvergne",
1045
+ "99" => "Basse-Normandie",
1046
+ "A1" => "Bourgogne",
1047
+ "A2" => "Bretagne",
1048
+ "A3" => "Centre",
1049
+ "A4" => "Champagne-Ardenne",
1050
+ "A5" => "Corse",
1051
+ "A6" => "Franche-Comte",
1052
+ "A7" => "Haute-Normandie",
1053
+ "A8" => "Ile-de-France",
1054
+ "A9" => "Languedoc-Roussillon",
1055
+ "B1" => "Limousin",
1056
+ "B2" => "Lorraine",
1057
+ "B3" => "Midi-Pyrenees",
1058
+ "B4" => "Nord-Pas-de-Calais",
1059
+ "B5" => "Pays de la Loire",
1060
+ "B6" => "Picardie",
1061
+ "B7" => "Poitou-Charentes",
1062
+ "B8" => "Provence-Alpes-Cote d'Azur",
1063
+ "B9" => "Rhone-Alpes",
1064
+ "C1" => "Alsace"),
1065
+ "GA" => array(
1066
+ "01" => "Estuaire",
1067
+ "02" => "Haut-Ogooue",
1068
+ "03" => "Moyen-Ogooue",
1069
+ "04" => "Ngounie",
1070
+ "05" => "Nyanga",
1071
+ "06" => "Ogooue-Ivindo",
1072
+ "07" => "Ogooue-Lolo",
1073
+ "08" => "Ogooue-Maritime",
1074
+ "09" => "Woleu-Ntem"),
1075
+ "GB" => array(
1076
+ "A1" => "Barking and Dagenham",
1077
+ "A2" => "Barnet",
1078
+ "A3" => "Barnsley",
1079
+ "A4" => "Bath and North East Somerset",
1080
+ "A5" => "Bedfordshire",
1081
+ "A6" => "Bexley",
1082
+ "A7" => "Birmingham",
1083
+ "A8" => "Blackburn with Darwen",
1084
+ "A9" => "Blackpool",
1085
+ "B1" => "Bolton",
1086
+ "B2" => "Bournemouth",
1087
+ "B3" => "Bracknell Forest",
1088
+ "B4" => "Bradford",
1089
+ "B5" => "Brent",
1090
+ "B6" => "Brighton and Hove",
1091
+ "B7" => "Bristol, City of",
1092
+ "B8" => "Bromley",
1093
+ "B9" => "Buckinghamshire",
1094
+ "C1" => "Bury",
1095
+ "C2" => "Calderdale",
1096
+ "C3" => "Cambridgeshire",
1097
+ "C4" => "Camden",
1098
+ "C5" => "Cheshire",
1099
+ "C6" => "Cornwall",
1100
+ "C7" => "Coventry",
1101
+ "C8" => "Croydon",
1102
+ "C9" => "Cumbria",
1103
+ "D1" => "Darlington",
1104
+ "D2" => "Derby",
1105
+ "D3" => "Derbyshire",
1106
+ "D4" => "Devon",
1107
+ "D5" => "Doncaster",
1108
+ "D6" => "Dorset",
1109
+ "D7" => "Dudley",
1110
+ "D8" => "Durham",
1111
+ "D9" => "Ealing",
1112
+ "E1" => "East Riding of Yorkshire",
1113
+ "E2" => "East Sussex",
1114
+ "E3" => "Enfield",
1115
+ "E4" => "Essex",
1116
+ "E5" => "Gateshead",
1117
+ "E6" => "Gloucestershire",
1118
+ "E7" => "Greenwich",
1119
+ "E8" => "Hackney",
1120
+ "E9" => "Halton",
1121
+ "F1" => "Hammersmith and Fulham",
1122
+ "F2" => "Hampshire",
1123
+ "F3" => "Haringey",
1124
+ "F4" => "Harrow",
1125
+ "F5" => "Hartlepool",
1126
+ "F6" => "Havering",
1127
+ "F7" => "Herefordshire",
1128
+ "F8" => "Hertford",
1129
+ "F9" => "Hillingdon",
1130
+ "G1" => "Hounslow",
1131
+ "G2" => "Isle of Wight",
1132
+ "G3" => "Islington",
1133
+ "G4" => "Kensington and Chelsea",
1134
+ "G5" => "Kent",
1135
+ "G6" => "Kingston upon Hull, City of",
1136
+ "G7" => "Kingston upon Thames",
1137
+ "G8" => "Kirklees",
1138
+ "G9" => "Knowsley",
1139
+ "H1" => "Lambeth",
1140
+ "H2" => "Lancashire",
1141
+ "H3" => "Leeds",
1142
+ "H4" => "Leicester",
1143
+ "H5" => "Leicestershire",
1144
+ "H6" => "Lewisham",
1145
+ "H7" => "Lincolnshire",
1146
+ "H8" => "Liverpool",
1147
+ "H9" => "London, City of",
1148
+ "I1" => "Luton",
1149
+ "I2" => "Manchester",
1150
+ "I3" => "Medway",
1151
+ "I4" => "Merton",
1152
+ "I5" => "Middlesbrough",
1153
+ "I6" => "Milton Keynes",
1154
+ "I7" => "Newcastle upon Tyne",
1155
+ "I8" => "Newham",
1156
+ "I9" => "Norfolk",
1157
+ "J1" => "Northamptonshire",
1158
+ "J2" => "North East Lincolnshire",
1159
+ "J3" => "North Lincolnshire",
1160
+ "J4" => "North Somerset",
1161
+ "J5" => "North Tyneside",
1162
+ "J6" => "Northumberland",
1163
+ "J7" => "North Yorkshire",
1164
+ "J8" => "Nottingham",
1165
+ "J9" => "Nottinghamshire",
1166
+ "K1" => "Oldham",
1167
+ "K2" => "Oxfordshire",
1168
+ "K3" => "Peterborough",
1169
+ "K4" => "Plymouth",
1170
+ "K5" => "Poole",
1171
+ "K6" => "Portsmouth",
1172
+ "K7" => "Reading",
1173
+ "K8" => "Redbridge",
1174
+ "K9" => "Redcar and Cleveland",
1175
+ "L1" => "Richmond upon Thames",
1176
+ "L2" => "Rochdale",
1177
+ "L3" => "Rotherham",
1178
+ "L4" => "Rutland",
1179
+ "L5" => "Salford",
1180
+ "L6" => "Shropshire",
1181
+ "L7" => "Sandwell",
1182
+ "L8" => "Sefton",
1183
+ "L9" => "Sheffield",
1184
+ "M1" => "Slough",
1185
+ "M2" => "Solihull",
1186
+ "M3" => "Somerset",
1187
+ "M4" => "Southampton",
1188
+ "M5" => "Southend-on-Sea",
1189
+ "M6" => "South Gloucestershire",
1190
+ "M7" => "South Tyneside",
1191
+ "M8" => "Southwark",
1192
+ "M9" => "Staffordshire",
1193
+ "N1" => "St. Helens",
1194
+ "N2" => "Stockport",
1195
+ "N3" => "Stockton-on-Tees",
1196
+ "N4" => "Stoke-on-Trent",
1197
+ "N5" => "Suffolk",
1198
+ "N6" => "Sunderland",
1199
+ "N7" => "Surrey",
1200
+ "N8" => "Sutton",
1201
+ "N9" => "Swindon",
1202
+ "O1" => "Tameside",
1203
+ "O2" => "Telford and Wrekin",
1204
+ "O3" => "Thurrock",
1205
+ "O4" => "Torbay",
1206
+ "O5" => "Tower Hamlets",
1207
+ "O6" => "Trafford",
1208
+ "O7" => "Wakefield",
1209
+ "O8" => "Walsall",
1210
+ "O9" => "Waltham Forest",
1211
+ "P1" => "Wandsworth",
1212
+ "P2" => "Warrington",
1213
+ "P3" => "Warwickshire",
1214
+ "P4" => "West Berkshire",
1215
+ "P5" => "Westminster",
1216
+ "P6" => "West Sussex",
1217
+ "P7" => "Wigan",
1218
+ "P8" => "Wiltshire",
1219
+ "P9" => "Windsor and Maidenhead",
1220
+ "Q1" => "Wirral",
1221
+ "Q2" => "Wokingham",
1222
+ "Q3" => "Wolverhampton",
1223
+ "Q4" => "Worcestershire",
1224
+ "Q5" => "York",
1225
+ "Q6" => "Antrim",
1226
+ "Q7" => "Ards",
1227
+ "Q8" => "Armagh",
1228
+ "Q9" => "Ballymena",
1229
+ "R1" => "Ballymoney",
1230
+ "R2" => "Banbridge",
1231
+ "R3" => "Belfast",
1232
+ "R4" => "Carrickfergus",
1233
+ "R5" => "Castlereagh",
1234
+ "R6" => "Coleraine",
1235
+ "R7" => "Cookstown",
1236
+ "R8" => "Craigavon",
1237
+ "R9" => "Down",
1238
+ "S1" => "Dungannon",
1239
+ "S2" => "Fermanagh",
1240
+ "S3" => "Larne",
1241
+ "S4" => "Limavady",
1242
+ "S5" => "Lisburn",
1243
+ "S6" => "Derry",
1244
+ "S7" => "Magherafelt",
1245
+ "S8" => "Moyle",
1246
+ "S9" => "Newry and Mourne",
1247
+ "T1" => "Newtownabbey",
1248
+ "T2" => "North Down",
1249
+ "T3" => "Omagh",
1250
+ "T4" => "Strabane",
1251
+ "T5" => "Aberdeen City",
1252
+ "T6" => "Aberdeenshire",
1253
+ "T7" => "Angus",
1254
+ "T8" => "Argyll and Bute",
1255
+ "T9" => "Scottish Borders, The",
1256
+ "U1" => "Clackmannanshire",
1257
+ "U2" => "Dumfries and Galloway",
1258
+ "U3" => "Dundee City",
1259
+ "U4" => "East Ayrshire",
1260
+ "U5" => "East Dunbartonshire",
1261
+ "U6" => "East Lothian",
1262
+ "U7" => "East Renfrewshire",
1263
+ "U8" => "Edinburgh, City of",
1264
+ "U9" => "Falkirk",
1265
+ "V1" => "Fife",
1266
+ "V2" => "Glasgow City",
1267
+ "V3" => "Highland",
1268
+ "V4" => "Inverclyde",
1269
+ "V5" => "Midlothian",
1270
+ "V6" => "Moray",
1271
+ "V7" => "North Ayrshire",
1272
+ "V8" => "North Lanarkshire",
1273
+ "V9" => "Orkney",
1274
+ "W1" => "Perth and Kinross",
1275
+ "W2" => "Renfrewshire",
1276
+ "W3" => "Shetland Islands",
1277
+ "W4" => "South Ayrshire",
1278
+ "W5" => "South Lanarkshire",
1279
+ "W6" => "Stirling",
1280
+ "W7" => "West Dunbartonshire",
1281
+ "W8" => "Eilean Siar",
1282
+ "W9" => "West Lothian",
1283
+ "X1" => "Isle of Anglesey",
1284
+ "X2" => "Blaenau Gwent",
1285
+ "X3" => "Bridgend",
1286
+ "X4" => "Caerphilly",
1287
+ "X5" => "Cardiff",
1288
+ "X6" => "Ceredigion",
1289
+ "X7" => "Carmarthenshire",
1290
+ "X8" => "Conwy",
1291
+ "X9" => "Denbighshire",
1292
+ "Y1" => "Flintshire",
1293
+ "Y2" => "Gwynedd",
1294
+ "Y3" => "Merthyr Tydfil",
1295
+ "Y4" => "Monmouthshire",
1296
+ "Y5" => "Neath Port Talbot",
1297
+ "Y6" => "Newport",
1298
+ "Y7" => "Pembrokeshire",
1299
+ "Y8" => "Powys",
1300
+ "Y9" => "Rhondda Cynon Taff",
1301
+ "Z1" => "Swansea",
1302
+ "Z2" => "Torfaen",
1303
+ "Z3" => "Vale of Glamorgan, The",
1304
+ "Z4" => "Wrexham"),
1305
+ "GD" => array(
1306
+ "01" => "Saint Andrew",
1307
+ "02" => "Saint David",
1308
+ "03" => "Saint George",
1309
+ "04" => "Saint John",
1310
+ "05" => "Saint Mark",
1311
+ "06" => "Saint Patrick"),
1312
+ "GE" => array(
1313
+ "01" => "Abashis Raioni",
1314
+ "02" => "Abkhazia",
1315
+ "03" => "Adigenis Raioni",
1316
+ "04" => "Ajaria",
1317
+ "05" => "Akhalgoris Raioni",
1318
+ "06" => "Akhalk'alak'is Raioni",
1319
+ "07" => "Akhalts'ikhis Raioni",
1320
+ "08" => "Akhmetis Raioni",
1321
+ "09" => "Ambrolauris Raioni",
1322
+ "10" => "Aspindzis Raioni",
1323
+ "11" => "Baghdat'is Raioni",
1324
+ "12" => "Bolnisis Raioni",
1325
+ "13" => "Borjomis Raioni",
1326
+ "14" => "Chiat'ura",
1327
+ "15" => "Ch'khorotsqus Raioni",
1328
+ "16" => "Ch'okhatauris Raioni",
1329
+ "17" => "Dedop'listsqaros Raioni",
1330
+ "18" => "Dmanisis Raioni",
1331
+ "19" => "Dushet'is Raioni",
1332
+ "20" => "Gardabanis Raioni",
1333
+ "21" => "Gori",
1334
+ "22" => "Goris Raioni",
1335
+ "23" => "Gurjaanis Raioni",
1336
+ "24" => "Javis Raioni",
1337
+ "25" => "K'arelis Raioni",
1338
+ "26" => "Kaspis Raioni",
1339
+ "27" => "Kharagaulis Raioni",
1340
+ "28" => "Khashuris Raioni",
1341
+ "29" => "Khobis Raioni",
1342
+ "30" => "Khonis Raioni",
1343
+ "31" => "K'ut'aisi",
1344
+ "32" => "Lagodekhis Raioni",
1345
+ "33" => "Lanch'khut'is Raioni",
1346
+ "34" => "Lentekhis Raioni",
1347
+ "35" => "Marneulis Raioni",
1348
+ "36" => "Martvilis Raioni",
1349
+ "37" => "Mestiis Raioni",
1350
+ "38" => "Mts'khet'is Raioni",
1351
+ "39" => "Ninotsmindis Raioni",
1352
+ "40" => "Onis Raioni",
1353
+ "41" => "Ozurget'is Raioni",
1354
+ "42" => "P'ot'i",
1355
+ "43" => "Qazbegis Raioni",
1356
+ "44" => "Qvarlis Raioni",
1357
+ "45" => "Rust'avi",
1358
+ "46" => "Sach'kheris Raioni",
1359
+ "47" => "Sagarejos Raioni",
1360
+ "48" => "Samtrediis Raioni",
1361
+ "49" => "Senakis Raioni",
1362
+ "50" => "Sighnaghis Raioni",
1363
+ "51" => "T'bilisi",
1364
+ "52" => "T'elavis Raioni",
1365
+ "53" => "T'erjolis Raioni",
1366
+ "54" => "T'et'ritsqaros Raioni",
1367
+ "55" => "T'ianet'is Raioni",
1368
+ "56" => "Tqibuli",
1369
+ "57" => "Ts'ageris Raioni",
1370
+ "58" => "Tsalenjikhis Raioni",
1371
+ "59" => "Tsalkis Raioni",
1372
+ "60" => "Tsqaltubo",
1373
+ "61" => "Vanis Raioni",
1374
+ "62" => "Zestap'onis Raioni",
1375
+ "63" => "Zugdidi",
1376
+ "64" => "Zugdidis Raioni"),
1377
+ "GH" => array(
1378
+ "01" => "Greater Accra",
1379
+ "02" => "Ashanti",
1380
+ "03" => "Brong-Ahafo",
1381
+ "04" => "Central",
1382
+ "05" => "Eastern",
1383
+ "06" => "Northern",
1384
+ "08" => "Volta",
1385
+ "09" => "Western",
1386
+ "10" => "Upper East",
1387
+ "11" => "Upper West"),
1388
+ "GL" => array(
1389
+ "01" => "Nordgronland",
1390
+ "02" => "Ostgronland",
1391
+ "03" => "Vestgronland"),
1392
+ "GM" => array(
1393
+ "01" => "Banjul",
1394
+ "02" => "Lower River",
1395
+ "03" => "Central River",
1396
+ "04" => "Upper River",
1397
+ "05" => "Western",
1398
+ "07" => "North Bank"),
1399
+ "GN" => array(
1400
+ "01" => "Beyla",
1401
+ "02" => "Boffa",
1402
+ "03" => "Boke",
1403
+ "04" => "Conakry",
1404
+ "05" => "Dabola",
1405
+ "06" => "Dalaba",
1406
+ "07" => "Dinguiraye",
1407
+ "09" => "Faranah",
1408
+ "10" => "Forecariah",
1409
+ "11" => "Fria",
1410
+ "12" => "Gaoual",
1411
+ "13" => "Gueckedou",
1412
+ "15" => "Kerouane",
1413
+ "16" => "Kindia",
1414
+ "17" => "Kissidougou",
1415
+ "18" => "Koundara",
1416
+ "19" => "Kouroussa",
1417
+ "21" => "Macenta",
1418
+ "22" => "Mali",
1419
+ "23" => "Mamou",
1420
+ "25" => "Pita",
1421
+ "27" => "Telimele",
1422
+ "28" => "Tougue",
1423
+ "29" => "Yomou",
1424
+ "30" => "Coyah",
1425
+ "31" => "Dubreka",
1426
+ "32" => "Kankan",
1427
+ "33" => "Koubia",
1428
+ "34" => "Labe",
1429
+ "35" => "Lelouma",
1430
+ "36" => "Lola",
1431
+ "37" => "Mandiana",
1432
+ "38" => "Nzerekore",
1433
+ "39" => "Siguiri"),
1434
+ "GQ" => array(
1435
+ "03" => "Annobon",
1436
+ "04" => "Bioko Norte",
1437
+ "05" => "Bioko Sur",
1438
+ "06" => "Centro Sur",
1439
+ "07" => "Kie-Ntem",
1440
+ "08" => "Litoral",
1441
+ "09" => "Wele-Nzas"),
1442
+ "GR" => array(
1443
+ "01" => "Evros",
1444
+ "02" => "Rodhopi",
1445
+ "03" => "Xanthi",
1446
+ "04" => "Drama",
1447
+ "05" => "Serrai",
1448
+ "06" => "Kilkis",
1449
+ "07" => "Pella",
1450
+ "08" => "Florina",
1451
+ "09" => "Kastoria",
1452
+ "10" => "Grevena",
1453
+ "11" => "Kozani",
1454
+ "12" => "Imathia",
1455
+ "13" => "Thessaloniki",
1456
+ "14" => "Kavala",
1457
+ "15" => "Khalkidhiki",
1458
+ "16" => "Pieria",
1459
+ "17" => "Ioannina",
1460
+ "18" => "Thesprotia",
1461
+ "19" => "Preveza",
1462
+ "20" => "Arta",
1463
+ "21" => "Larisa",
1464
+ "22" => "Trikala",
1465
+ "23" => "Kardhitsa",
1466
+ "24" => "Magnisia",
1467
+ "25" => "Kerkira",
1468
+ "26" => "Levkas",
1469
+ "27" => "Kefallinia",
1470
+ "28" => "Zakinthos",
1471
+ "29" => "Fthiotis",
1472
+ "30" => "Evritania",
1473
+ "31" => "Aitolia kai Akarnania",
1474
+ "32" => "Fokis",
1475
+ "33" => "Voiotia",
1476
+ "34" => "Evvoia",
1477
+ "35" => "Attiki",
1478
+ "36" => "Argolis",
1479
+ "37" => "Korinthia",
1480
+ "38" => "Akhaia",
1481
+ "39" => "Ilia",
1482
+ "40" => "Messinia",
1483
+ "41" => "Arkadhia",
1484
+ "42" => "Lakonia",
1485
+ "43" => "Khania",
1486
+ "44" => "Rethimni",
1487
+ "45" => "Iraklion",
1488
+ "46" => "Lasithi",
1489
+ "47" => "Dhodhekanisos",
1490
+ "48" => "Samos",
1491
+ "49" => "Kikladhes",
1492
+ "50" => "Khios",
1493
+ "51" => "Lesvos"),
1494
+ "GT" => array(
1495
+ "01" => "Alta Verapaz",
1496
+ "02" => "Baja Verapaz",
1497
+ "03" => "Chimaltenango",
1498
+ "04" => "Chiquimula",
1499
+ "05" => "El Progreso",
1500
+ "06" => "Escuintla",
1501
+ "07" => "Guatemala",
1502
+ "08" => "Huehuetenango",
1503
+ "09" => "Izabal",
1504
+ "10" => "Jalapa",
1505
+ "11" => "Jutiapa",
1506
+ "12" => "Peten",
1507
+ "13" => "Quetzaltenango",
1508
+ "14" => "Quiche",
1509
+ "15" => "Retalhuleu",
1510
+ "16" => "Sacatepequez",
1511
+ "17" => "San Marcos",
1512
+ "18" => "Santa Rosa",
1513
+ "19" => "Solola",
1514
+ "20" => "Suchitepequez",
1515
+ "21" => "Totonicapan",
1516
+ "22" => "Zacapa"),
1517
+ "GW" => array(
1518
+ "01" => "Bafata",
1519
+ "02" => "Quinara",
1520
+ "04" => "Oio",
1521
+ "05" => "Bolama",
1522
+ "06" => "Cacheu",
1523
+ "07" => "Tombali",
1524
+ "10" => "Gabu",
1525
+ "11" => "Bissau",
1526
+ "12" => "Biombo"),
1527
+ "GY" => array(
1528
+ "10" => "Barima-Waini",
1529
+ "11" => "Cuyuni-Mazaruni",
1530
+ "12" => "Demerara-Mahaica",
1531
+ "13" => "East Berbice-Corentyne",
1532
+ "14" => "Essequibo Islands-West Demerara",
1533
+ "15" => "Mahaica-Berbice",
1534
+ "16" => "Pomeroon-Supenaam",
1535
+ "17" => "Potaro-Siparuni",
1536
+ "18" => "Upper Demerara-Berbice",
1537
+ "19" => "Upper Takutu-Upper Essequibo"),
1538
+ "HN" => array(
1539
+ "01" => "Atlantida",
1540
+ "02" => "Choluteca",
1541
+ "03" => "Colon",
1542
+ "04" => "Comayagua",
1543
+ "05" => "Copan",
1544
+ "06" => "Cortes",
1545
+ "07" => "El Paraiso",
1546
+ "08" => "Francisco Morazan",
1547
+ "09" => "Gracias a Dios",
1548
+ "10" => "Intibuca",
1549
+ "11" => "Islas de la Bahia",
1550
+ "12" => "La Paz",
1551
+ "13" => "Lempira",
1552
+ "14" => "Ocotepeque",
1553
+ "15" => "Olancho",
1554
+ "16" => "Santa Barbara",
1555
+ "17" => "Valle",
1556
+ "18" => "Yoro"),
1557
+ "HR" => array(
1558
+ "01" => "Bjelovarsko-Bilogorska",
1559
+ "02" => "Brodsko-Posavska",
1560
+ "03" => "Dubrovacko-Neretvanska",
1561
+ "04" => "Istarska",
1562
+ "05" => "Karlovacka",
1563
+ "06" => "Koprivnicko-Krizevacka",
1564
+ "07" => "Krapinsko-Zagorska",
1565
+ "08" => "Licko-Senjska",
1566
+ "09" => "Medimurska",
1567
+ "10" => "Osjecko-Baranjska",
1568
+ "11" => "Pozesko-Slavonska",
1569
+ "12" => "Primorsko-Goranska",
1570
+ "13" => "Sibensko-Kninska",
1571
+ "14" => "Sisacko-Moslavacka",
1572
+ "15" => "Splitsko-Dalmatinska",
1573
+ "16" => "Varazdinska",
1574
+ "17" => "Viroviticko-Podravska",
1575
+ "18" => "Vukovarsko-Srijemska",
1576
+ "19" => "Zadarska",
1577
+ "20" => "Zagrebacka",
1578
+ "21" => "Grad Zagreb"),
1579
+ "HT" => array(
1580
+ "03" => "Nord-Ouest",
1581
+ "06" => "Artibonite",
1582
+ "07" => "Centre",
1583
+ "09" => "Nord",
1584
+ "10" => "Nord-Est",
1585
+ "11" => "Ouest",
1586
+ "12" => "Sud",
1587
+ "13" => "Sud-Est",
1588
+ "14" => "Grand' Anse",
1589
+ "15" => "Nippes"),
1590
+ "HU" => array(
1591
+ "01" => "Bacs-Kiskun",
1592
+ "02" => "Baranya",
1593
+ "03" => "Bekes",
1594
+ "04" => "Borsod-Abauj-Zemplen",
1595
+ "05" => "Budapest",
1596
+ "06" => "Csongrad",
1597
+ "07" => "Debrecen",
1598
+ "08" => "Fejer",
1599
+ "09" => "Gyor-Moson-Sopron",
1600
+ "10" => "Hajdu-Bihar",
1601
+ "11" => "Heves",
1602
+ "12" => "Komarom-Esztergom",
1603
+ "13" => "Miskolc",
1604
+ "14" => "Nograd",
1605
+ "15" => "Pecs",
1606
+ "16" => "Pest",
1607
+ "17" => "Somogy",
1608
+ "18" => "Szabolcs-Szatmar-Bereg",
1609
+ "19" => "Szeged",
1610
+ "20" => "Jasz-Nagykun-Szolnok",
1611
+ "21" => "Tolna",
1612
+ "22" => "Vas",
1613
+ "23" => "Veszprem",
1614
+ "24" => "Zala",
1615
+ "25" => "Gyor",
1616
+ "26" => "Bekescsaba",
1617
+ "27" => "Dunaujvaros",
1618
+ "28" => "Eger",
1619
+ "29" => "Hodmezovasarhely",
1620
+ "30" => "Kaposvar",
1621
+ "31" => "Kecskemet",
1622
+ "32" => "Nagykanizsa",
1623
+ "33" => "Nyiregyhaza",
1624
+ "34" => "Sopron",
1625
+ "35" => "Szekesfehervar",
1626
+ "36" => "Szolnok",
1627
+ "37" => "Szombathely",
1628
+ "38" => "Tatabanya",
1629
+ "39" => "Veszprem",
1630
+ "40" => "Zalaegerszeg",
1631
+ "41" => "Salgotarjan",
1632
+ "42" => "Szekszard",
1633
+ "43" => "Erd"),
1634
+ "ID" => array(
1635
+ "01" => "Aceh",
1636
+ "02" => "Bali",
1637
+ "03" => "Bengkulu",
1638
+ "04" => "Jakarta Raya",
1639
+ "05" => "Jambi",
1640
+ "07" => "Jawa Tengah",
1641
+ "08" => "Jawa Timur",
1642
+ "10" => "Yogyakarta",
1643
+ "11" => "Kalimantan Barat",
1644
+ "12" => "Kalimantan Selatan",
1645
+ "13" => "Kalimantan Tengah",
1646
+ "14" => "Kalimantan Timur",
1647
+ "15" => "Lampung",
1648
+ "17" => "Nusa Tenggara Barat",
1649
+ "18" => "Nusa Tenggara Timur",
1650
+ "21" => "Sulawesi Tengah",
1651
+ "22" => "Sulawesi Tenggara",
1652
+ "24" => "Sumatera Barat",
1653
+ "26" => "Sumatera Utara",
1654
+ "28" => "Maluku",
1655
+ "29" => "Maluku Utara",
1656
+ "30" => "Jawa Barat",
1657
+ "31" => "Sulawesi Utara",
1658
+ "32" => "Sumatera Selatan",
1659
+ "33" => "Banten",
1660
+ "34" => "Gorontalo",
1661
+ "35" => "Kepulauan Bangka Belitung",
1662
+ "36" => "Papua",
1663
+ "37" => "Riau",
1664
+ "38" => "Sulawesi Selatan",
1665
+ "39" => "Irian Jaya Barat",
1666
+ "40" => "Kepulauan Riau",
1667
+ "41" => "Sulawesi Barat"),
1668
+ "IE" => array(
1669
+ "01" => "Carlow",
1670
+ "02" => "Cavan",
1671
+ "03" => "Clare",
1672
+ "04" => "Cork",
1673
+ "06" => "Donegal",
1674
+ "07" => "Dublin",
1675
+ "10" => "Galway",
1676
+ "11" => "Kerry",
1677
+ "12" => "Kildare",
1678
+ "13" => "Kilkenny",
1679
+ "14" => "Leitrim",
1680
+ "15" => "Laois",
1681
+ "16" => "Limerick",
1682
+ "18" => "Longford",
1683
+ "19" => "Louth",
1684
+ "20" => "Mayo",
1685
+ "21" => "Meath",
1686
+ "22" => "Monaghan",
1687
+ "23" => "Offaly",
1688
+ "24" => "Roscommon",
1689
+ "25" => "Sligo",
1690
+ "26" => "Tipperary",
1691
+ "27" => "Waterford",
1692
+ "29" => "Westmeath",
1693
+ "30" => "Wexford",
1694
+ "31" => "Wicklow"),
1695
+ "IL" => array(
1696
+ "01" => "HaDarom",
1697
+ "02" => "HaMerkaz",
1698
+ "03" => "HaZafon",
1699
+ "04" => "Hefa",
1700
+ "05" => "Tel Aviv",
1701
+ "06" => "Yerushalayim"),
1702
+ "IN" => array(
1703
+ "01" => "Andaman and Nicobar Islands",
1704
+ "02" => "Andhra Pradesh",
1705
+ "03" => "Assam",
1706
+ "05" => "Chandigarh",
1707
+ "06" => "Dadra and Nagar Haveli",
1708
+ "07" => "Delhi",
1709
+ "09" => "Gujarat",
1710
+ "10" => "Haryana",
1711
+ "11" => "Himachal Pradesh",
1712
+ "12" => "Jammu and Kashmir",
1713
+ "13" => "Kerala",
1714
+ "14" => "Lakshadweep",
1715
+ "16" => "Maharashtra",
1716
+ "17" => "Manipur",
1717
+ "18" => "Meghalaya",
1718
+ "19" => "Karnataka",
1719
+ "20" => "Nagaland",
1720
+ "21" => "Orissa",
1721
+ "22" => "Puducherry",
1722
+ "23" => "Punjab",
1723
+ "24" => "Rajasthan",
1724
+ "25" => "Tamil Nadu",
1725
+ "26" => "Tripura",
1726
+ "28" => "West Bengal",
1727
+ "29" => "Sikkim",
1728
+ "30" => "Arunachal Pradesh",
1729
+ "31" => "Mizoram",
1730
+ "32" => "Daman and Diu",
1731
+ "33" => "Goa",
1732
+ "34" => "Bihar",
1733
+ "35" => "Madhya Pradesh",
1734
+ "36" => "Uttar Pradesh",
1735
+ "37" => "Chhattisgarh",
1736
+ "38" => "Jharkhand",
1737
+ "39" => "Uttarakhand"),
1738
+ "IQ" => array(
1739
+ "01" => "Al Anbar",
1740
+ "02" => "Al Basrah",
1741
+ "03" => "Al Muthanna",
1742
+ "04" => "Al Qadisiyah",
1743
+ "05" => "As Sulaymaniyah",
1744
+ "06" => "Babil",
1745
+ "07" => "Baghdad",
1746
+ "08" => "Dahuk",
1747
+ "09" => "Dhi Qar",
1748
+ "10" => "Diyala",
1749
+ "11" => "Arbil",
1750
+ "12" => "Karbala'",
1751
+ "13" => "At Ta'mim",
1752
+ "14" => "Maysan",
1753
+ "15" => "Ninawa",
1754
+ "16" => "Wasit",
1755
+ "17" => "An Najaf",
1756
+ "18" => "Salah ad Din"),
1757
+ "IR" => array(
1758
+ "01" => "Azarbayjan-e Bakhtari",
1759
+ "03" => "Chahar Mahall va Bakhtiari",
1760
+ "04" => "Sistan va Baluchestan",
1761
+ "05" => "Kohkiluyeh va Buyer Ahmadi",
1762
+ "07" => "Fars",
1763
+ "08" => "Gilan",
1764
+ "09" => "Hamadan",
1765
+ "10" => "Ilam",
1766
+ "11" => "Hormozgan",
1767
+ "12" => "Kerman",
1768
+ "13" => "Bakhtaran",
1769
+ "15" => "Khuzestan",
1770
+ "16" => "Kordestan",
1771
+ "17" => "Mazandaran",
1772
+ "18" => "Semnan Province",
1773
+ "19" => "Markazi",
1774
+ "21" => "Zanjan",
1775
+ "22" => "Bushehr",
1776
+ "23" => "Lorestan",
1777
+ "24" => "Markazi",
1778
+ "25" => "Semnan",
1779
+ "26" => "Tehran",
1780
+ "27" => "Zanjan",
1781
+ "28" => "Esfahan",
1782
+ "29" => "Kerman",
1783
+ "30" => "Khorasan",
1784
+ "31" => "Yazd",
1785
+ "32" => "Ardabil",
1786
+ "33" => "East Azarbaijan",
1787
+ "34" => "Markazi",
1788
+ "35" => "Mazandaran",
1789
+ "36" => "Zanjan",
1790
+ "37" => "Golestan",
1791
+ "38" => "Qazvin",
1792
+ "39" => "Qom",
1793
+ "40" => "Yazd",
1794
+ "41" => "Khorasan-e Janubi",
1795
+ "42" => "Khorasan-e Razavi",
1796
+ "43" => "Khorasan-e Shemali"),
1797
+ "IS" => array(
1798
+ "03" => "Arnessysla",
1799
+ "05" => "Austur-Hunavatnssysla",
1800
+ "06" => "Austur-Skaftafellssysla",
1801
+ "07" => "Borgarfjardarsysla",
1802
+ "09" => "Eyjafjardarsysla",
1803
+ "10" => "Gullbringusysla",
1804
+ "15" => "Kjosarsysla",
1805
+ "17" => "Myrasysla",
1806
+ "20" => "Nordur-Mulasysla",
1807
+ "21" => "Nordur-Tingeyjarsysla",
1808
+ "23" => "Rangarvallasysla",
1809
+ "28" => "Skagafjardarsysla",
1810
+ "29" => "Snafellsnes- og Hnappadalssysla",
1811
+ "30" => "Strandasysla",
1812
+ "31" => "Sudur-Mulasysla",
1813
+ "32" => "Sudur-Tingeyjarsysla",
1814
+ "34" => "Vestur-Bardastrandarsysla",
1815
+ "35" => "Vestur-Hunavatnssysla",
1816
+ "36" => "Vestur-Isafjardarsysla",
1817
+ "37" => "Vestur-Skaftafellssysla",
1818
+ "40" => "Norourland Eystra",
1819
+ "41" => "Norourland Vestra",
1820
+ "42" => "Suourland",
1821
+ "43" => "Suournes",
1822
+ "44" => "Vestfiroir",
1823
+ "45" => "Vesturland"),
1824
+ "IT" => array(
1825
+ "01" => "Abruzzi",
1826
+ "02" => "Basilicata",
1827
+ "03" => "Calabria",
1828
+ "04" => "Campania",
1829
+ "05" => "Emilia-Romagna",
1830
+ "06" => "Friuli-Venezia Giulia",
1831
+ "07" => "Lazio",
1832
+ "08" => "Liguria",
1833
+ "09" => "Lombardia",
1834
+ "10" => "Marche",
1835
+ "11" => "Molise",
1836
+ "12" => "Piemonte",
1837
+ "13" => "Puglia",
1838
+ "14" => "Sardegna",
1839
+ "15" => "Sicilia",
1840
+ "16" => "Toscana",
1841
+ "17" => "Trentino-Alto Adige",
1842
+ "18" => "Umbria",
1843
+ "19" => "Valle d'Aosta",
1844
+ "20" => "Veneto"),
1845
+ "JM" => array(
1846
+ "01" => "Clarendon",
1847
+ "02" => "Hanover",
1848
+ "04" => "Manchester",
1849
+ "07" => "Portland",
1850
+ "08" => "Saint Andrew",
1851
+ "09" => "Saint Ann",
1852
+ "10" => "Saint Catherine",
1853
+ "11" => "Saint Elizabeth",
1854
+ "12" => "Saint James",
1855
+ "13" => "Saint Mary",
1856
+ "14" => "Saint Thomas",
1857
+ "15" => "Trelawny",
1858
+ "16" => "Westmoreland",
1859
+ "17" => "Kingston"),
1860
+ "JO" => array(
1861
+ "02" => "Al Balqa'",
1862
+ "09" => "Al Karak",
1863
+ "12" => "At Tafilah",
1864
+ "15" => "Al Mafraq",
1865
+ "16" => "Amman",
1866
+ "17" => "Az Zaraqa",
1867
+ "18" => "Irbid",
1868
+ "19" => "Ma'an",
1869
+ "20" => "Ajlun",
1870
+ "21" => "Al Aqabah",
1871
+ "22" => "Jarash",
1872
+ "23" => "Madaba"),
1873
+ "JP" => array(
1874
+ "01" => "Aichi",
1875
+ "02" => "Akita",
1876
+ "03" => "Aomori",
1877
+ "04" => "Chiba",
1878
+ "05" => "Ehime",
1879
+ "06" => "Fukui",
1880
+ "07" => "Fukuoka",
1881
+ "08" => "Fukushima",
1882
+ "09" => "Gifu",
1883
+ "10" => "Gumma",
1884
+ "11" => "Hiroshima",
1885
+ "12" => "Hokkaido",
1886
+ "13" => "Hyogo",
1887
+ "14" => "Ibaraki",
1888
+ "15" => "Ishikawa",
1889
+ "16" => "Iwate",
1890
+ "17" => "Kagawa",
1891
+ "18" => "Kagoshima",
1892
+ "19" => "Kanagawa",
1893
+ "20" => "Kochi",
1894
+ "21" => "Kumamoto",
1895
+ "22" => "Kyoto",
1896
+ "23" => "Mie",
1897
+ "24" => "Miyagi",
1898
+ "25" => "Miyazaki",
1899
+ "26" => "Nagano",
1900
+ "27" => "Nagasaki",
1901
+ "28" => "Nara",
1902
+ "29" => "Niigata",
1903
+ "30" => "Oita",
1904
+ "31" => "Okayama",
1905
+ "32" => "Osaka",
1906
+ "33" => "Saga",
1907
+ "34" => "Saitama",
1908
+ "35" => "Shiga",
1909
+ "36" => "Shimane",
1910
+ "37" => "Shizuoka",
1911
+ "38" => "Tochigi",
1912
+ "39" => "Tokushima",
1913
+ "40" => "Tokyo",
1914
+ "41" => "Tottori",
1915
+ "42" => "Toyama",
1916
+ "43" => "Wakayama",
1917
+ "44" => "Yamagata",
1918
+ "45" => "Yamaguchi",
1919
+ "46" => "Yamanashi",
1920
+ "47" => "Okinawa"),
1921
+ "KE" => array(
1922
+ "01" => "Central",
1923
+ "02" => "Coast",
1924
+ "03" => "Eastern",
1925
+ "05" => "Nairobi Area",
1926
+ "06" => "North-Eastern",
1927
+ "07" => "Nyanza",
1928
+ "08" => "Rift Valley",
1929
+ "09" => "Western"),
1930
+ "KG" => array(
1931
+ "01" => "Bishkek",
1932
+ "02" => "Chuy",
1933
+ "03" => "Jalal-Abad",
1934
+ "04" => "Naryn",
1935
+ "05" => "Osh",
1936
+ "06" => "Talas",
1937
+ "07" => "Ysyk-Kol",
1938
+ "08" => "Osh",
1939
+ "09" => "Batken"),
1940
+ "KH" => array(
1941
+ "01" => "Batdambang",
1942
+ "02" => "Kampong Cham",
1943
+ "03" => "Kampong Chhnang",
1944
+ "04" => "Kampong Speu",
1945
+ "05" => "Kampong Thum",
1946
+ "06" => "Kampot",
1947
+ "07" => "Kandal",
1948
+ "08" => "Koh Kong",
1949
+ "09" => "Kracheh",
1950
+ "10" => "Mondulkiri",
1951
+ "11" => "Phnum Penh",
1952
+ "12" => "Pursat",
1953
+ "13" => "Preah Vihear",
1954
+ "14" => "Prey Veng",
1955
+ "15" => "Ratanakiri Kiri",
1956
+ "16" => "Siem Reap",
1957
+ "17" => "Stung Treng",
1958
+ "18" => "Svay Rieng",
1959
+ "19" => "Takeo",
1960
+ "25" => "Banteay Meanchey",
1961
+ "29" => "Batdambang",
1962
+ "30" => "Pailin"),
1963
+ "KI" => array(
1964
+ "01" => "Gilbert Islands",
1965
+ "02" => "Line Islands",
1966
+ "03" => "Phoenix Islands"),
1967
+ "KM" => array(
1968
+ "01" => "Anjouan",
1969
+ "02" => "Grande Comore",
1970
+ "03" => "Moheli"),
1971
+ "KN" => array(
1972
+ "01" => "Christ Church Nichola Town",
1973
+ "02" => "Saint Anne Sandy Point",
1974
+ "03" => "Saint George Basseterre",
1975
+ "04" => "Saint George Gingerland",
1976
+ "05" => "Saint James Windward",
1977
+ "06" => "Saint John Capisterre",
1978
+ "07" => "Saint John Figtree",
1979
+ "08" => "Saint Mary Cayon",
1980
+ "09" => "Saint Paul Capisterre",
1981
+ "10" => "Saint Paul Charlestown",
1982
+ "11" => "Saint Peter Basseterre",
1983
+ "12" => "Saint Thomas Lowland",
1984
+ "13" => "Saint Thomas Middle Island",
1985
+ "15" => "Trinity Palmetto Point"),
1986
+ "KP" => array(
1987
+ "01" => "Chagang-do",
1988
+ "03" => "Hamgyong-namdo",
1989
+ "06" => "Hwanghae-namdo",
1990
+ "07" => "Hwanghae-bukto",
1991
+ "08" => "Kaesong-si",
1992
+ "09" => "Kangwon-do",
1993
+ "11" => "P'yongan-bukto",
1994
+ "12" => "P'yongyang-si",
1995
+ "13" => "Yanggang-do",
1996
+ "14" => "Namp'o-si",
1997
+ "15" => "P'yongan-namdo",
1998
+ "17" => "Hamgyong-bukto",
1999
+ "18" => "Najin Sonbong-si"),
2000
+ "KR" => array(
2001
+ "01" => "Cheju-do",
2002
+ "03" => "Cholla-bukto",
2003
+ "05" => "Ch'ungch'ong-bukto",
2004
+ "06" => "Kangwon-do",
2005
+ "10" => "Pusan-jikhalsi",
2006
+ "11" => "Seoul-t'ukpyolsi",
2007
+ "12" => "Inch'on-jikhalsi",
2008
+ "13" => "Kyonggi-do",
2009
+ "14" => "Kyongsang-bukto",
2010
+ "15" => "Taegu-jikhalsi",
2011
+ "16" => "Cholla-namdo",
2012
+ "17" => "Ch'ungch'ong-namdo",
2013
+ "18" => "Kwangju-jikhalsi",
2014
+ "19" => "Taejon-jikhalsi",
2015
+ "20" => "Kyongsang-namdo",
2016
+ "21" => "Ulsan-gwangyoksi"),
2017
+ "KW" => array(
2018
+ "01" => "Al Ahmadi",
2019
+ "02" => "Al Kuwayt",
2020
+ "05" => "Al Jahra",
2021
+ "07" => "Al Farwaniyah",
2022
+ "08" => "Hawalli",
2023
+ "09" => "Mubarak al Kabir"),
2024
+ "KY" => array(
2025
+ "01" => "Creek",
2026
+ "02" => "Eastern",
2027
+ "03" => "Midland",
2028
+ "04" => "South Town",
2029
+ "05" => "Spot Bay",
2030
+ "06" => "Stake Bay",
2031
+ "07" => "West End",
2032
+ "08" => "Western"),
2033
+ "KZ" => array(
2034
+ "01" => "Almaty",
2035
+ "02" => "Almaty City",
2036
+ "03" => "Aqmola",
2037
+ "04" => "Aqtobe",
2038
+ "05" => "Astana",
2039
+ "06" => "Atyrau",
2040
+ "07" => "West Kazakhstan",
2041
+ "08" => "Bayqonyr",
2042
+ "09" => "Mangghystau",
2043
+ "10" => "South Kazakhstan",
2044
+ "11" => "Pavlodar",
2045
+ "12" => "Qaraghandy",
2046
+ "13" => "Qostanay",
2047
+ "14" => "Qyzylorda",
2048
+ "15" => "East Kazakhstan",
2049
+ "16" => "North Kazakhstan",
2050
+ "17" => "Zhambyl"),
2051
+ "LA" => array(
2052
+ "01" => "Attapu",
2053
+ "02" => "Champasak",
2054
+ "03" => "Houaphan",
2055
+ "04" => "Khammouan",
2056
+ "05" => "Louang Namtha",
2057
+ "07" => "Oudomxai",
2058
+ "08" => "Phongsali",
2059
+ "09" => "Saravan",
2060
+ "10" => "Savannakhet",
2061
+ "11" => "Vientiane",
2062
+ "13" => "Xaignabouri",
2063
+ "14" => "Xiangkhoang",
2064
+ "17" => "Louangphrabang"),
2065
+ "LB" => array(
2066
+ "01" => "Beqaa",
2067
+ "02" => "Al Janub",
2068
+ "03" => "Liban-Nord",
2069
+ "04" => "Beyrouth",
2070
+ "05" => "Mont-Liban",
2071
+ "06" => "Liban-Sud",
2072
+ "07" => "Nabatiye",
2073
+ "08" => "Beqaa",
2074
+ "09" => "Liban-Nord",
2075
+ "10" => "Aakk,r",
2076
+ "11" => "Baalbek-Hermel"),
2077
+ "LC" => array(
2078
+ "01" => "Anse-la-Raye",
2079
+ "02" => "Dauphin",
2080
+ "03" => "Castries",
2081
+ "04" => "Choiseul",
2082
+ "05" => "Dennery",
2083
+ "06" => "Gros-Islet",
2084
+ "07" => "Laborie",
2085
+ "08" => "Micoud",
2086
+ "09" => "Soufriere",
2087
+ "10" => "Vieux-Fort",
2088
+ "11" => "Praslin"),
2089
+ "LI" => array(
2090
+ "01" => "Balzers",
2091
+ "02" => "Eschen",
2092
+ "03" => "Gamprin",
2093
+ "04" => "Mauren",
2094
+ "05" => "Planken",
2095
+ "06" => "Ruggell",
2096
+ "07" => "Schaan",
2097
+ "08" => "Schellenberg",
2098
+ "09" => "Triesen",
2099
+ "10" => "Triesenberg",
2100
+ "11" => "Vaduz",
2101
+ "21" => "Gbarpolu",
2102
+ "22" => "River Gee"),
2103
+ "LK" => array(
2104
+ "01" => "Amparai",
2105
+ "02" => "Anuradhapura",
2106
+ "03" => "Badulla",
2107
+ "04" => "Batticaloa",
2108
+ "06" => "Galle",
2109
+ "07" => "Hambantota",
2110
+ "09" => "Kalutara",
2111
+ "10" => "Kandy",
2112
+ "11" => "Kegalla",
2113
+ "12" => "Kurunegala",
2114
+ "14" => "Matale",
2115
+ "15" => "Matara",
2116
+ "16" => "Moneragala",
2117
+ "17" => "Nuwara Eliya",
2118
+ "18" => "Polonnaruwa",
2119
+ "19" => "Puttalam",
2120
+ "20" => "Ratnapura",
2121
+ "21" => "Trincomalee",
2122
+ "23" => "Colombo",
2123
+ "24" => "Gampaha",
2124
+ "25" => "Jaffna",
2125
+ "26" => "Mannar",
2126
+ "27" => "Mullaittivu",
2127
+ "28" => "Vavuniya",
2128
+ "29" => "Central",
2129
+ "30" => "North Central",
2130
+ "31" => "Northern",
2131
+ "32" => "North Western",
2132
+ "33" => "Sabaragamuwa",
2133
+ "34" => "Southern",
2134
+ "35" => "Uva",
2135
+ "36" => "Western"),
2136
+ "LR" => array(
2137
+ "01" => "Bong",
2138
+ "04" => "Grand Cape Mount",
2139
+ "05" => "Lofa",
2140
+ "06" => "Maryland",
2141
+ "07" => "Monrovia",
2142
+ "09" => "Nimba",
2143
+ "10" => "Sino",
2144
+ "11" => "Grand Bassa",
2145
+ "12" => "Grand Cape Mount",
2146
+ "13" => "Maryland",
2147
+ "14" => "Montserrado",
2148
+ "17" => "Margibi",
2149
+ "18" => "River Cess",
2150
+ "19" => "Grand Gedeh",
2151
+ "20" => "Lofa",
2152
+ "21" => "Gbarpolu",
2153
+ "22" => "River Gee"),
2154
+ "LS" => array(
2155
+ "10" => "Berea",
2156
+ "11" => "Butha-Buthe",
2157
+ "12" => "Leribe",
2158
+ "13" => "Mafeteng",
2159
+ "14" => "Maseru",
2160
+ "15" => "Mohales Hoek",
2161
+ "16" => "Mokhotlong",
2162
+ "17" => "Qachas Nek",
2163
+ "18" => "Quthing",
2164
+ "19" => "Thaba-Tseka"),
2165
+ "LT" => array(
2166
+ "56" => "Alytaus Apskritis",
2167
+ "57" => "Kauno Apskritis",
2168
+ "58" => "Klaipedos Apskritis",
2169
+ "59" => "Marijampoles Apskritis",
2170
+ "60" => "Panevezio Apskritis",
2171
+ "61" => "Siauliu Apskritis",
2172
+ "62" => "Taurages Apskritis",
2173
+ "63" => "Telsiu Apskritis",
2174
+ "64" => "Utenos Apskritis",
2175
+ "65" => "Vilniaus Apskritis"),
2176
+ "LU" => array(
2177
+ "01" => "Diekirch",
2178
+ "02" => "Grevenmacher",
2179
+ "03" => "Luxembourg"),
2180
+ "LV" => array(
2181
+ "01" => "Aizkraukles",
2182
+ "02" => "Aluksnes",
2183
+ "03" => "Balvu",
2184
+ "04" => "Bauskas",
2185
+ "05" => "Cesu",
2186
+ "06" => "Daugavpils",
2187
+ "07" => "Daugavpils",
2188
+ "08" => "Dobeles",
2189
+ "09" => "Gulbenes",
2190
+ "10" => "Jekabpils",
2191
+ "11" => "Jelgava",
2192
+ "12" => "Jelgavas",
2193
+ "13" => "Jurmala",
2194
+ "14" => "Kraslavas",
2195
+ "15" => "Kuldigas",
2196
+ "16" => "Liepaja",
2197
+ "17" => "Liepajas",
2198
+ "18" => "Limbazu",
2199
+ "19" => "Ludzas",
2200
+ "20" => "Madonas",
2201
+ "21" => "Ogres",
2202
+ "22" => "Preilu",
2203
+ "23" => "Rezekne",
2204
+ "24" => "Rezeknes",
2205
+ "25" => "Riga",
2206
+ "26" => "Rigas",
2207
+ "27" => "Saldus",
2208
+ "28" => "Talsu",
2209
+ "29" => "Tukuma",
2210
+ "30" => "Valkas",
2211
+ "31" => "Valmieras",
2212
+ "32" => "Ventspils",
2213
+ "33" => "Ventspils"),
2214
+ "LY" => array(
2215
+ "03" => "Al Aziziyah",
2216
+ "05" => "Al Jufrah",
2217
+ "08" => "Al Kufrah",
2218
+ "13" => "Ash Shati'",
2219
+ "30" => "Murzuq",
2220
+ "34" => "Sabha",
2221
+ "41" => "Tarhunah",
2222
+ "42" => "Tubruq",
2223
+ "45" => "Zlitan",
2224
+ "47" => "Ajdabiya",
2225
+ "48" => "Al Fatih",
2226
+ "49" => "Al Jabal al Akhdar",
2227
+ "50" => "Al Khums",
2228
+ "51" => "An Nuqat al Khams",
2229
+ "52" => "Awbari",
2230
+ "53" => "Az Zawiyah",
2231
+ "54" => "Banghazi",
2232
+ "55" => "Darnah",
2233
+ "56" => "Ghadamis",
2234
+ "57" => "Gharyan",
2235
+ "58" => "Misratah",
2236
+ "59" => "Sawfajjin",
2237
+ "60" => "Surt",
2238
+ "61" => "Tarabulus",
2239
+ "62" => "Yafran"),
2240
+ "MA" => array(
2241
+ "45" => "Grand Casablanca",
2242
+ "46" => "Fes-Boulemane",
2243
+ "47" => "Marrakech-Tensift-Al Haouz",
2244
+ "48" => "Meknes-Tafilalet",
2245
+ "49" => "Rabat-Sale-Zemmour-Zaer",
2246
+ "50" => "Chaouia-Ouardigha",
2247
+ "51" => "Doukkala-Abda",
2248
+ "52" => "Gharb-Chrarda-Beni Hssen",
2249
+ "53" => "Guelmim-Es Smara",
2250
+ "54" => "Oriental",
2251
+ "55" => "Souss-Massa-Dr,a",
2252
+ "56" => "Tadla-Azilal",
2253
+ "57" => "Tanger-Tetouan",
2254
+ "58" => "Taza-Al Hoceima-Taounate",
2255
+ "59" => "La,youne-Boujdour-Sakia El Hamra"),
2256
+ "MC" => array(
2257
+ "01" => "La Condamine",
2258
+ "02" => "Monaco",
2259
+ "03" => "Monte-Carlo"),
2260
+ "MD" => array(
2261
+ "51" => "Gagauzia",
2262
+ "57" => "Chisinau",
2263
+ "58" => "Stinga Nistrului",
2264
+ "59" => "Anenii Noi",
2265
+ "60" => "Balti",
2266
+ "61" => "Basarabeasca",
2267
+ "62" => "Bender",
2268
+ "63" => "Briceni",
2269
+ "64" => "Cahul",
2270
+ "65" => "Cantemir",
2271
+ "66" => "Calarasi",
2272
+ "67" => "Causeni",
2273
+ "68" => "Cimislia",
2274
+ "69" => "Criuleni",
2275
+ "70" => "Donduseni",
2276
+ "71" => "Drochia",
2277
+ "72" => "Dubasari",
2278
+ "73" => "Edinet",
2279
+ "74" => "Falesti",
2280
+ "75" => "Floresti",
2281
+ "76" => "Glodeni",
2282
+ "77" => "Hincesti",
2283
+ "78" => "Ialoveni",
2284
+ "79" => "Leova",
2285
+ "80" => "Nisporeni",
2286
+ "81" => "Ocnita",
2287
+ "82" => "Orhei",
2288
+ "83" => "Rezina",
2289
+ "84" => "Riscani",
2290
+ "85" => "Singerei",
2291
+ "86" => "Soldanesti",
2292
+ "87" => "Soroca",
2293
+ "88" => "Stefan-Voda",
2294
+ "89" => "Straseni",
2295
+ "90" => "Taraclia",
2296
+ "91" => "Telenesti",
2297
+ "92" => "Ungheni"),
2298
+ "MG" => array(
2299
+ "01" => "Antsiranana",
2300
+ "02" => "Fianarantsoa",
2301
+ "03" => "Mahajanga",
2302
+ "04" => "Toamasina",
2303
+ "05" => "Antananarivo",
2304
+ "06" => "Toliara"),
2305
+ "MK" => array(
2306
+ "01" => "Aracinovo",
2307
+ "02" => "Bac",
2308
+ "03" => "Belcista",
2309
+ "04" => "Berovo",
2310
+ "05" => "Bistrica",
2311
+ "06" => "Bitola",
2312
+ "07" => "Blatec",
2313
+ "08" => "Bogdanci",
2314
+ "09" => "Bogomila",
2315
+ "10" => "Bogovinje",
2316
+ "11" => "Bosilovo",
2317
+ "12" => "Brvenica",
2318
+ "13" => "Cair",
2319
+ "14" => "Capari",
2320
+ "15" => "Caska",
2321
+ "16" => "Cegrane",
2322
+ "17" => "Centar",
2323
+ "18" => "Centar Zupa",
2324
+ "19" => "Cesinovo",
2325
+ "20" => "Cucer-Sandevo",
2326
+ "21" => "Debar",
2327
+ "22" => "Delcevo",
2328
+ "23" => "Delogozdi",
2329
+ "24" => "Demir Hisar",
2330
+ "25" => "Demir Kapija",
2331
+ "26" => "Dobrusevo",
2332
+ "27" => "Dolna Banjica",
2333
+ "28" => "Dolneni",
2334
+ "29" => "Dorce Petrov",
2335
+ "30" => "Drugovo",
2336
+ "31" => "Dzepciste",
2337
+ "32" => "Gazi Baba",
2338
+ "33" => "Gevgelija",
2339
+ "34" => "Gostivar",
2340
+ "35" => "Gradsko",
2341
+ "36" => "Ilinden",
2342
+ "37" => "Izvor",
2343
+ "38" => "Jegunovce",
2344
+ "39" => "Kamenjane",
2345
+ "40" => "Karbinci",
2346
+ "41" => "Karpos",
2347
+ "42" => "Kavadarci",
2348
+ "43" => "Kicevo",
2349
+ "44" => "Kisela Voda",
2350
+ "45" => "Klecevce",
2351
+ "46" => "Kocani",
2352
+ "47" => "Konce",
2353
+ "48" => "Kondovo",
2354
+ "49" => "Konopiste",
2355
+ "50" => "Kosel",
2356
+ "51" => "Kratovo",
2357
+ "52" => "Kriva Palanka",
2358
+ "53" => "Krivogastani",
2359
+ "54" => "Krusevo",
2360
+ "55" => "Kuklis",
2361
+ "56" => "Kukurecani",
2362
+ "57" => "Kumanovo",
2363
+ "58" => "Labunista",
2364
+ "59" => "Lipkovo",
2365
+ "60" => "Lozovo",
2366
+ "61" => "Lukovo",
2367
+ "62" => "Makedonska Kamenica",
2368
+ "63" => "Makedonski Brod",
2369
+ "64" => "Mavrovi Anovi",
2370
+ "65" => "Meseista",
2371
+ "66" => "Miravci",
2372
+ "67" => "Mogila",
2373
+ "68" => "Murtino",
2374
+ "69" => "Negotino",
2375
+ "70" => "Negotino-Polosko",
2376
+ "71" => "Novaci",
2377
+ "72" => "Novo Selo",
2378
+ "73" => "Oblesevo",
2379
+ "74" => "Ohrid",
2380
+ "75" => "Orasac",
2381
+ "76" => "Orizari",
2382
+ "77" => "Oslomej",
2383
+ "78" => "Pehcevo",
2384
+ "79" => "Petrovec",
2385
+ "80" => "Plasnica",
2386
+ "81" => "Podares",
2387
+ "82" => "Prilep",
2388
+ "83" => "Probistip",
2389
+ "84" => "Radovis",
2390
+ "85" => "Rankovce",
2391
+ "86" => "Resen",
2392
+ "87" => "Rosoman",
2393
+ "88" => "Rostusa",
2394
+ "89" => "Samokov",
2395
+ "90" => "Saraj",
2396
+ "91" => "Sipkovica",
2397
+ "92" => "Sopiste",
2398
+ "93" => "Sopotnica",
2399
+ "94" => "Srbinovo",
2400
+ "95" => "Staravina",
2401
+ "96" => "Star Dojran",
2402
+ "97" => "Staro Nagoricane",
2403
+ "98" => "Stip",
2404
+ "99" => "Struga",
2405
+ "A1" => "Strumica",
2406
+ "A2" => "Studenicani",
2407
+ "A3" => "Suto Orizari",
2408
+ "A4" => "Sveti Nikole",
2409
+ "A5" => "Tearce",
2410
+ "A6" => "Tetovo",
2411
+ "A7" => "Topolcani",
2412
+ "A8" => "Valandovo",
2413
+ "A9" => "Vasilevo",
2414
+ "B1" => "Veles",
2415
+ "B2" => "Velesta",
2416
+ "B3" => "Vevcani",
2417
+ "B4" => "Vinica",
2418
+ "B5" => "Vitoliste",
2419
+ "B6" => "Vranestica",
2420
+ "B7" => "Vrapciste",
2421
+ "B8" => "Vratnica",
2422
+ "B9" => "Vrutok",
2423
+ "C1" => "Zajas",
2424
+ "C2" => "Zelenikovo",
2425
+ "C3" => "Zelino",
2426
+ "C4" => "Zitose",
2427
+ "C5" => "Zletovo",
2428
+ "C6" => "Zrnovci"),
2429
+ "ML" => array(
2430
+ "01" => "Bamako",
2431
+ "03" => "Kayes",
2432
+ "04" => "Mopti",
2433
+ "05" => "Segou",
2434
+ "06" => "Sikasso",
2435
+ "07" => "Koulikoro",
2436
+ "08" => "Tombouctou",
2437
+ "09" => "Gao",
2438
+ "10" => "Kidal"),
2439
+ "MM" => array(
2440
+ "01" => "Rakhine State",
2441
+ "02" => "Chin State",
2442
+ "03" => "Irrawaddy",
2443
+ "04" => "Kachin State",
2444
+ "05" => "Karan State",
2445
+ "06" => "Kayah State",
2446
+ "07" => "Magwe",
2447
+ "08" => "Mandalay",
2448
+ "09" => "Pegu",
2449
+ "10" => "Sagaing",
2450
+ "11" => "Shan State",
2451
+ "12" => "Tenasserim",
2452
+ "13" => "Mon State",
2453
+ "14" => "Rangoon",
2454
+ "17" => "Yangon"),
2455
+ "MN" => array(
2456
+ "01" => "Arhangay",
2457
+ "02" => "Bayanhongor",
2458
+ "03" => "Bayan-Olgiy",
2459
+ "05" => "Darhan",
2460
+ "06" => "Dornod",
2461
+ "07" => "Dornogovi",
2462
+ "08" => "Dundgovi",
2463
+ "09" => "Dzavhan",
2464
+ "10" => "Govi-Altay",
2465
+ "11" => "Hentiy",
2466
+ "12" => "Hovd",
2467
+ "13" => "Hovsgol",
2468
+ "14" => "Omnogovi",
2469
+ "15" => "Ovorhangay",
2470
+ "16" => "Selenge",
2471
+ "17" => "Suhbaatar",
2472
+ "18" => "Tov",
2473
+ "19" => "Uvs",
2474
+ "20" => "Ulaanbaatar",
2475
+ "21" => "Bulgan",
2476
+ "22" => "Erdenet",
2477
+ "23" => "Darhan-Uul",
2478
+ "24" => "Govisumber",
2479
+ "25" => "Orhon"),
2480
+ "MO" => array(
2481
+ "01" => "Ilhas",
2482
+ "02" => "Macau"),
2483
+ "MR" => array(
2484
+ "01" => "Hodh Ech Chargui",
2485
+ "02" => "Hodh El Gharbi",
2486
+ "03" => "Assaba",
2487
+ "04" => "Gorgol",
2488
+ "05" => "Brakna",
2489
+ "06" => "Trarza",
2490
+ "07" => "Adrar",
2491
+ "08" => "Dakhlet Nouadhibou",
2492
+ "09" => "Tagant",
2493
+ "10" => "Guidimaka",
2494
+ "11" => "Tiris Zemmour",
2495
+ "12" => "Inchiri"),
2496
+ "MS" => array(
2497
+ "01" => "Saint Anthony",
2498
+ "02" => "Saint Georges",
2499
+ "03" => "Saint Peter"),
2500
+ "MU" => array(
2501
+ "12" => "Black River",
2502
+ "13" => "Flacq",
2503
+ "14" => "Grand Port",
2504
+ "15" => "Moka",
2505
+ "16" => "Pamplemousses",
2506
+ "17" => "Plaines Wilhems",
2507
+ "18" => "Port Louis",
2508
+ "19" => "Riviere du Rempart",
2509
+ "20" => "Savanne",
2510
+ "21" => "Agalega Islands",
2511
+ "22" => "Cargados Carajos",
2512
+ "23" => "Rodrigues"),
2513
+ "MV" => array(
2514
+ "01" => "Seenu",
2515
+ "05" => "Laamu",
2516
+ "30" => "Alifu",
2517
+ "31" => "Baa",
2518
+ "32" => "Dhaalu",
2519
+ "33" => "Faafu ",
2520
+ "34" => "Gaafu Alifu",
2521
+ "35" => "Gaafu Dhaalu",
2522
+ "36" => "Haa Alifu",
2523
+ "37" => "Haa Dhaalu",
2524
+ "38" => "Kaafu",
2525
+ "39" => "Lhaviyani",
2526
+ "40" => "Maale",
2527
+ "41" => "Meemu",
2528
+ "42" => "Gnaviyani",
2529
+ "43" => "Noonu",
2530
+ "44" => "Raa",
2531
+ "45" => "Shaviyani",
2532
+ "46" => "Thaa",
2533
+ "47" => "Vaavu"),
2534
+ "MW" => array(
2535
+ "02" => "Chikwawa",
2536
+ "03" => "Chiradzulu",
2537
+ "04" => "Chitipa",
2538
+ "05" => "Thyolo",
2539
+ "06" => "Dedza",
2540
+ "07" => "Dowa",
2541
+ "08" => "Karonga",
2542
+ "09" => "Kasungu",
2543
+ "11" => "Lilongwe",
2544
+ "12" => "Mangochi",
2545
+ "13" => "Mchinji",
2546
+ "15" => "Mzimba",
2547
+ "16" => "Ntcheu",
2548
+ "17" => "Nkhata Bay",
2549
+ "18" => "Nkhotakota",
2550
+ "19" => "Nsanje",
2551
+ "20" => "Ntchisi",
2552
+ "21" => "Rumphi",
2553
+ "22" => "Salima",
2554
+ "23" => "Zomba",
2555
+ "24" => "Blantyre",
2556
+ "25" => "Mwanza",
2557
+ "26" => "Balaka",
2558
+ "27" => "Likoma",
2559
+ "28" => "Machinga",
2560
+ "29" => "Mulanje",
2561
+ "30" => "Phalombe"),
2562
+ "MX" => array(
2563
+ "01" => "Aguascalientes",
2564
+ "02" => "Baja California",
2565
+ "03" => "Baja California Sur",
2566
+ "04" => "Campeche",
2567
+ "05" => "Chiapas",
2568
+ "06" => "Chihuahua",
2569
+ "07" => "Coahuila de Zaragoza",
2570
+ "08" => "Colima",
2571
+ "09" => "Distrito Federal",
2572
+ "10" => "Durango",
2573
+ "11" => "Guanajuato",
2574
+ "12" => "Guerrero",
2575
+ "13" => "Hidalgo",
2576
+ "14" => "Jalisco",
2577
+ "15" => "Mexico",
2578
+ "16" => "Michoacan de Ocampo",
2579
+ "17" => "Morelos",
2580
+ "18" => "Nayarit",
2581
+ "19" => "Nuevo Leon",
2582
+ "20" => "Oaxaca",
2583
+ "21" => "Puebla",
2584
+ "22" => "Queretaro de Arteaga",
2585
+ "23" => "Quintana Roo",
2586
+ "24" => "San Luis Potosi",
2587
+ "25" => "Sinaloa",
2588
+ "26" => "Sonora",
2589
+ "27" => "Tabasco",
2590
+ "28" => "Tamaulipas",
2591
+ "29" => "Tlaxcala",
2592
+ "30" => "Veracruz-Llave",
2593
+ "31" => "Yucatan",
2594
+ "32" => "Zacatecas"),
2595
+ "MY" => array(
2596
+ "01" => "Johor",
2597
+ "02" => "Kedah",
2598
+ "03" => "Kelantan",
2599
+ "04" => "Melaka",
2600
+ "05" => "Negeri Sembilan",
2601
+ "06" => "Pahang",
2602
+ "07" => "Perak",
2603
+ "08" => "Perlis",
2604
+ "09" => "Pulau Pinang",
2605
+ "11" => "Sarawak",
2606
+ "12" => "Selangor",
2607
+ "13" => "Terengganu",
2608
+ "14" => "Kuala Lumpur",
2609
+ "15" => "Labuan",
2610
+ "16" => "Sabah",
2611
+ "17" => "Putrajaya"),
2612
+ "MZ" => array(
2613
+ "01" => "Cabo Delgado",
2614
+ "02" => "Gaza",
2615
+ "03" => "Inhambane",
2616
+ "04" => "Maputo",
2617
+ "05" => "Sofala",
2618
+ "06" => "Nampula",
2619
+ "07" => "Niassa",
2620
+ "08" => "Tete",
2621
+ "09" => "Zambezia",
2622
+ "10" => "Manica",
2623
+ "11" => "Maputo"),
2624
+ "NA" => array(
2625
+ "01" => "Bethanien",
2626
+ "02" => "Caprivi Oos",
2627
+ "03" => "Boesmanland",
2628
+ "04" => "Gobabis",
2629
+ "05" => "Grootfontein",
2630
+ "06" => "Kaokoland",
2631
+ "07" => "Karibib",
2632
+ "08" => "Keetmanshoop",
2633
+ "09" => "Luderitz",
2634
+ "10" => "Maltahohe",
2635
+ "11" => "Okahandja",
2636
+ "12" => "Omaruru",
2637
+ "13" => "Otjiwarongo",
2638
+ "14" => "Outjo",
2639
+ "15" => "Owambo",
2640
+ "16" => "Rehoboth",
2641
+ "17" => "Swakopmund",
2642
+ "18" => "Tsumeb",
2643
+ "20" => "Karasburg",
2644
+ "21" => "Windhoek",
2645
+ "22" => "Damaraland",
2646
+ "23" => "Hereroland Oos",
2647
+ "24" => "Hereroland Wes",
2648
+ "25" => "Kavango",
2649
+ "26" => "Mariental",
2650
+ "27" => "Namaland",
2651
+ "28" => "Caprivi",
2652
+ "29" => "Erongo",
2653
+ "30" => "Hardap",
2654
+ "31" => "Karas",
2655
+ "32" => "Kunene",
2656
+ "33" => "Ohangwena",
2657
+ "34" => "Okavango",
2658
+ "35" => "Omaheke",
2659
+ "36" => "Omusati",
2660
+ "37" => "Oshana",
2661
+ "38" => "Oshikoto",
2662
+ "39" => "Otjozondjupa"),
2663
+ "NE" => array(
2664
+ "01" => "Agadez",
2665
+ "02" => "Diffa",
2666
+ "03" => "Dosso",
2667
+ "04" => "Maradi",
2668
+ "05" => "Niamey",
2669
+ "06" => "Tahoua",
2670
+ "07" => "Zinder",
2671
+ "08" => "Niamey"),
2672
+ "NG" => array(
2673
+ "05" => "Lagos",
2674
+ "11" => "Federal Capital Territory",
2675
+ "16" => "Ogun",
2676
+ "21" => "Akwa Ibom",
2677
+ "22" => "Cross River",
2678
+ "23" => "Kaduna",
2679
+ "24" => "Katsina",
2680
+ "25" => "Anambra",
2681
+ "26" => "Benue",
2682
+ "27" => "Borno",
2683
+ "28" => "Imo",
2684
+ "29" => "Kano",
2685
+ "30" => "Kwara",
2686
+ "31" => "Niger",
2687
+ "32" => "Oyo",
2688
+ "35" => "Adamawa",
2689
+ "36" => "Delta",
2690
+ "37" => "Edo",
2691
+ "39" => "Jigawa",
2692
+ "40" => "Kebbi",
2693
+ "41" => "Kogi",
2694
+ "42" => "Osun",
2695
+ "43" => "Taraba",
2696
+ "44" => "Yobe",
2697
+ "45" => "Abia",
2698
+ "46" => "Bauchi",
2699
+ "47" => "Enugu",
2700
+ "48" => "Ondo",
2701
+ "49" => "Plateau",
2702
+ "50" => "Rivers",
2703
+ "51" => "Sokoto",
2704
+ "52" => "Bayelsa",
2705
+ "53" => "Ebonyi",
2706
+ "54" => "Ekiti",
2707
+ "55" => "Gombe",
2708
+ "56" => "Nassarawa",
2709
+ "57" => "Zamfara"),
2710
+ "NI" => array(
2711
+ "01" => "Boaco",
2712
+ "02" => "Carazo",
2713
+ "03" => "Chinandega",
2714
+ "04" => "Chontales",
2715
+ "05" => "Esteli",
2716
+ "06" => "Granada",
2717
+ "07" => "Jinotega",
2718
+ "08" => "Leon",
2719
+ "09" => "Madriz",
2720
+ "10" => "Managua",
2721
+ "11" => "Masaya",
2722
+ "12" => "Matagalpa",
2723
+ "13" => "Nueva Segovia",
2724
+ "14" => "Rio San Juan",
2725
+ "15" => "Rivas",
2726
+ "16" => "Zelaya",
2727
+ "17" => "Autonoma Atlantico Norte",
2728
+ "18" => "Region Autonoma Atlantico Sur"),
2729
+ "NL" => array(
2730
+ "01" => "Drenthe",
2731
+ "02" => "Friesland",
2732
+ "03" => "Gelderland",
2733
+ "04" => "Groningen",
2734
+ "05" => "Limburg",
2735
+ "06" => "Noord-Brabant",
2736
+ "07" => "Noord-Holland",
2737
+ "09" => "Utrecht",
2738
+ "10" => "Zeeland",
2739
+ "11" => "Zuid-Holland",
2740
+ "15" => "Overijssel",
2741
+ "16" => "Flevoland"),
2742
+ "NO" => array(
2743
+ "01" => "Akershus",
2744
+ "02" => "Aust-Agder",
2745
+ "04" => "Buskerud",
2746
+ "05" => "Finnmark",
2747
+ "06" => "Hedmark",
2748
+ "07" => "Hordaland",
2749
+ "08" => "More og Romsdal",
2750
+ "09" => "Nordland",
2751
+ "10" => "Nord-Trondelag",
2752
+ "11" => "Oppland",
2753
+ "12" => "Oslo",
2754
+ "13" => "Ostfold",
2755
+ "14" => "Rogaland",
2756
+ "15" => "Sogn og Fjordane",
2757
+ "16" => "Sor-Trondelag",
2758
+ "17" => "Telemark",
2759
+ "18" => "Troms",
2760
+ "19" => "Vest-Agder",
2761
+ "20" => "Vestfold"),
2762
+ "NP" => array(
2763
+ "01" => "Bagmati",
2764
+ "02" => "Bheri",
2765
+ "03" => "Dhawalagiri",
2766
+ "04" => "Gandaki",
2767
+ "05" => "Janakpur",
2768
+ "06" => "Karnali",
2769
+ "07" => "Kosi",
2770
+ "08" => "Lumbini",
2771
+ "09" => "Mahakali",
2772
+ "10" => "Mechi",
2773
+ "11" => "Narayani",
2774
+ "12" => "Rapti",
2775
+ "13" => "Sagarmatha",
2776
+ "14" => "Seti"),
2777
+ "NR" => array(
2778
+ "01" => "Aiwo",
2779
+ "02" => "Anabar",
2780
+ "03" => "Anetan",
2781
+ "04" => "Anibare",
2782
+ "05" => "Baiti",
2783
+ "06" => "Boe",
2784
+ "07" => "Buada",
2785
+ "08" => "Denigomodu",
2786
+ "09" => "Ewa",
2787
+ "10" => "Ijuw",
2788
+ "11" => "Meneng",
2789
+ "12" => "Nibok",
2790
+ "13" => "Uaboe",
2791
+ "14" => "Yaren"),
2792
+ "NZ" => array(
2793
+ "10" => "Chatham Islands",
2794
+ "E7" => "Auckland",
2795
+ "E8" => "Bay of Plenty",
2796
+ "E9" => "Canterbury",
2797
+ "F1" => "Gisborne",
2798
+ "F2" => "Hawke's Bay",
2799
+ "F3" => "Manawatu-Wanganui",
2800
+ "F4" => "Marlborough",
2801
+ "F5" => "Nelson",
2802
+ "F6" => "Northland",
2803
+ "F7" => "Otago",
2804
+ "F8" => "Southland",
2805
+ "F9" => "Taranaki",
2806
+ "G1" => "Waikato",
2807
+ "G2" => "Wellington",
2808
+ "G3" => "West Coast"),
2809
+ "OM" => array(
2810
+ "01" => "Ad Dakhiliyah",
2811
+ "02" => "Al Batinah",
2812
+ "03" => "Al Wusta",
2813
+ "04" => "Ash Sharqiyah",
2814
+ "05" => "Az Zahirah",
2815
+ "06" => "Masqat",
2816
+ "07" => "Musandam",
2817
+ "08" => "Zufar"),
2818
+ "PA" => array(
2819
+ "01" => "Bocas del Toro",
2820
+ "02" => "Chiriqui",
2821
+ "03" => "Cocle",
2822
+ "04" => "Colon",
2823
+ "05" => "Darien",
2824
+ "06" => "Herrera",
2825
+ "07" => "Los Santos",
2826
+ "08" => "Panama",
2827
+ "09" => "San Blas",
2828
+ "10" => "Veraguas"),
2829
+ "PE" => array(
2830
+ "01" => "Amazonas",
2831
+ "02" => "Ancash",
2832
+ "03" => "Apurimac",
2833
+ "04" => "Arequipa",
2834
+ "05" => "Ayacucho",
2835
+ "06" => "Cajamarca",
2836
+ "07" => "Callao",
2837
+ "08" => "Cusco",
2838
+ "09" => "Huancavelica",
2839
+ "10" => "Huanuco",
2840
+ "11" => "Ica",
2841
+ "12" => "Junin",
2842
+ "13" => "La Libertad",
2843
+ "14" => "Lambayeque",
2844
+ "15" => "Lima",
2845
+ "16" => "Loreto",
2846
+ "17" => "Madre de Dios",
2847
+ "18" => "Moquegua",
2848
+ "19" => "Pasco",
2849
+ "20" => "Piura",
2850
+ "21" => "Puno",
2851
+ "22" => "San Martin",
2852
+ "23" => "Tacna",
2853
+ "24" => "Tumbes",
2854
+ "25" => "Ucayali"),
2855
+ "PG" => array(
2856
+ "01" => "Central",
2857
+ "02" => "Gulf",
2858
+ "03" => "Milne Bay",
2859
+ "04" => "Northern",
2860
+ "05" => "Southern Highlands",
2861
+ "06" => "Western",
2862
+ "07" => "North Solomons",
2863
+ "08" => "Chimbu",
2864
+ "09" => "Eastern Highlands",
2865
+ "10" => "East New Britain",
2866
+ "11" => "East Sepik",
2867
+ "12" => "Madang",
2868
+ "13" => "Manus",
2869
+ "14" => "Morobe",
2870
+ "15" => "New Ireland",
2871
+ "16" => "Western Highlands",
2872
+ "17" => "West New Britain",
2873
+ "18" => "Sandaun",
2874
+ "19" => "Enga",
2875
+ "20" => "National Capital"),
2876
+ "PH" => array(
2877
+ "01" => "Abra",
2878
+ "02" => "Agusan del Norte",
2879
+ "03" => "Agusan del Sur",
2880
+ "04" => "Aklan",
2881
+ "05" => "Albay",
2882
+ "06" => "Antique",
2883
+ "07" => "Bataan",
2884
+ "08" => "Batanes",
2885
+ "09" => "Batangas",
2886
+ "10" => "Benguet",
2887
+ "11" => "Bohol",
2888
+ "12" => "Bukidnon",
2889
+ "13" => "Bulacan",
2890
+ "14" => "Cagayan",
2891
+ "15" => "Camarines Norte",
2892
+ "16" => "Camarines Sur",
2893
+ "17" => "Camiguin",
2894
+ "18" => "Capiz",
2895
+ "19" => "Catanduanes",
2896
+ "20" => "Cavite",
2897
+ "21" => "Cebu",
2898
+ "22" => "Basilan",
2899
+ "23" => "Eastern Samar",
2900
+ "24" => "Davao",
2901
+ "25" => "Davao del Sur",
2902
+ "26" => "Davao Oriental",
2903
+ "27" => "Ifugao",
2904
+ "28" => "Ilocos Norte",
2905
+ "29" => "Ilocos Sur",
2906
+ "30" => "Iloilo",
2907
+ "31" => "Isabela",
2908
+ "32" => "Kalinga-Apayao",
2909
+ "33" => "Laguna",
2910
+ "34" => "Lanao del Norte",
2911
+ "35" => "Lanao del Sur",
2912
+ "36" => "La Union",
2913
+ "37" => "Leyte",
2914
+ "38" => "Marinduque",
2915
+ "39" => "Masbate",
2916
+ "40" => "Mindoro Occidental",
2917
+ "41" => "Mindoro Oriental",
2918
+ "42" => "Misamis Occidental",
2919
+ "43" => "Misamis Oriental",
2920
+ "44" => "Mountain",
2921
+ "45" => "Negros Occidental",
2922
+ "46" => "Negros Oriental",
2923
+ "47" => "Nueva Ecija",
2924
+ "48" => "Nueva Vizcaya",
2925
+ "49" => "Palawan",
2926
+ "50" => "Pampanga",
2927
+ "51" => "Pangasinan",
2928
+ "53" => "Rizal",
2929
+ "54" => "Romblon",
2930
+ "55" => "Samar",
2931
+ "56" => "Maguindanao",
2932
+ "57" => "North Cotabato",
2933
+ "58" => "Sorsogon",
2934
+ "59" => "Southern Leyte",
2935
+ "60" => "Sulu",
2936
+ "61" => "Surigao del Norte",
2937
+ "62" => "Surigao del Sur",
2938
+ "63" => "Tarlac",
2939
+ "64" => "Zambales",
2940
+ "65" => "Zamboanga del Norte",
2941
+ "66" => "Zamboanga del Sur",
2942
+ "67" => "Northern Samar",
2943
+ "68" => "Quirino",
2944
+ "69" => "Siquijor",
2945
+ "70" => "South Cotabato",
2946
+ "71" => "Sultan Kudarat",
2947
+ "72" => "Tawitawi",
2948
+ "A1" => "Angeles",
2949
+ "A2" => "Bacolod",
2950
+ "A3" => "Bago",
2951
+ "A4" => "Baguio",
2952
+ "A5" => "Bais",
2953
+ "A6" => "Basilan City",
2954
+ "A7" => "Batangas City",
2955
+ "A8" => "Butuan",
2956
+ "A9" => "Cabanatuan",
2957
+ "B1" => "Cadiz",
2958
+ "B2" => "Cagayan de Oro",
2959
+ "B3" => "Calbayog",
2960
+ "B4" => "Caloocan",
2961
+ "B5" => "Canlaon",
2962
+ "B6" => "Cavite City",
2963
+ "B7" => "Cebu City",
2964
+ "B8" => "Cotabato",
2965
+ "B9" => "Dagupan",
2966
+ "C1" => "Danao",
2967
+ "C2" => "Dapitan",
2968
+ "C3" => "Davao City",
2969
+ "C4" => "Dipolog",
2970
+ "C5" => "Dumaguete",
2971
+ "C6" => "General Santos",
2972
+ "C7" => "Gingoog",
2973
+ "C8" => "Iligan",
2974
+ "C9" => "Iloilo City",
2975
+ "D1" => "Iriga",
2976
+ "D2" => "La Carlota",
2977
+ "D3" => "Laoag",
2978
+ "D4" => "Lapu-Lapu",
2979
+ "D5" => "Legaspi",
2980
+ "D6" => "Lipa",
2981
+ "D7" => "Lucena",
2982
+ "D8" => "Mandaue",
2983
+ "D9" => "Manila",
2984
+ "E1" => "Marawi",
2985
+ "E2" => "Naga",
2986
+ "E3" => "Olongapo",
2987
+ "E4" => "Ormoc",
2988
+ "E5" => "Oroquieta",
2989
+ "E6" => "Ozamis",
2990
+ "E7" => "Pagadian",
2991
+ "E8" => "Palayan",
2992
+ "E9" => "Pasay",
2993
+ "F1" => "Puerto Princesa",
2994
+ "F2" => "Quezon City",
2995
+ "F3" => "Roxas",
2996
+ "F4" => "San Carlos",
2997
+ "F5" => "San Carlos",
2998
+ "F6" => "San Jose",
2999
+ "F7" => "San Pablo",
3000
+ "F8" => "Silay",
3001
+ "F9" => "Surigao",
3002
+ "G1" => "Tacloban",
3003
+ "G2" => "Tagaytay",
3004
+ "G3" => "Tagbilaran",
3005
+ "G4" => "Tangub",
3006
+ "G5" => "Toledo",
3007
+ "G6" => "Trece Martires",
3008
+ "G7" => "Zamboanga",
3009
+ "G8" => "Aurora",
3010
+ "H2" => "Quezon",
3011
+ "H3" => "Negros Occidental"),
3012
+ "PK" => array(
3013
+ "01" => "Federally Administered Tribal Areas",
3014
+ "02" => "Balochistan",
3015
+ "03" => "North-West Frontier",
3016
+ "04" => "Punjab",
3017
+ "05" => "Sindh",
3018
+ "06" => "Azad Kashmir",
3019
+ "07" => "Northern Areas",
3020
+ "08" => "Islamabad"),
3021
+ "PL" => array(
3022
+ "72" => "Dolnoslaskie",
3023
+ "73" => "Kujawsko-Pomorskie",
3024
+ "74" => "Lodzkie",
3025
+ "75" => "Lubelskie",
3026
+ "76" => "Lubuskie",
3027
+ "77" => "Malopolskie",
3028
+ "78" => "Mazowieckie",
3029
+ "79" => "Opolskie",
3030
+ "80" => "Podkarpackie",
3031
+ "81" => "Podlaskie",
3032
+ "82" => "Pomorskie",
3033
+ "83" => "Slaskie",
3034
+ "84" => "Swietokrzyskie",
3035
+ "85" => "Warminsko-Mazurskie",
3036
+ "86" => "Wielkopolskie",
3037
+ "87" => "Zachodniopomorskie"),
3038
+ "PS" => array(
3039
+ "GZ" => "Gaza",
3040
+ "WE" => "West Bank"),
3041
+ "PT" => array(
3042
+ "02" => "Aveiro",
3043
+ "03" => "Beja",
3044
+ "04" => "Braga",
3045
+ "05" => "Braganca",
3046
+ "06" => "Castelo Branco",
3047
+ "07" => "Coimbra",
3048
+ "08" => "Evora",
3049
+ "09" => "Faro",
3050
+ "10" => "Madeira",
3051
+ "11" => "Guarda",
3052
+ "13" => "Leiria",
3053
+ "14" => "Lisboa",
3054
+ "16" => "Portalegre",
3055
+ "17" => "Porto",
3056
+ "18" => "Santarem",
3057
+ "19" => "Setubal",
3058
+ "20" => "Viana do Castelo",
3059
+ "21" => "Vila Real",
3060
+ "22" => "Viseu",
3061
+ "23" => "Azores"),
3062
+ "PY" => array(
3063
+ "01" => "Alto Parana",
3064
+ "02" => "Amambay",
3065
+ "03" => "Boqueron",
3066
+ "04" => "Caaguazu",
3067
+ "05" => "Caazapa",
3068
+ "06" => "Central",
3069
+ "07" => "Concepcion",
3070
+ "08" => "Cordillera",
3071
+ "10" => "Guaira",
3072
+ "11" => "Itapua",
3073
+ "12" => "Misiones",
3074
+ "13" => "Neembucu",
3075
+ "15" => "Paraguari",
3076
+ "16" => "Presidente Hayes",
3077
+ "17" => "San Pedro",
3078
+ "19" => "Canindeyu",
3079
+ "20" => "Chaco",
3080
+ "21" => "Nueva Asuncion",
3081
+ "23" => "Alto Paraguay"),
3082
+ "QA" => array(
3083
+ "01" => "Ad Dawhah",
3084
+ "02" => "Al Ghuwariyah",
3085
+ "03" => "Al Jumaliyah",
3086
+ "04" => "Al Khawr",
3087
+ "05" => "Al Wakrah Municipality",
3088
+ "06" => "Ar Rayyan",
3089
+ "08" => "Madinat ach Shamal",
3090
+ "09" => "Umm Salal",
3091
+ "10" => "Al Wakrah",
3092
+ "11" => "Jariyan al Batnah",
3093
+ "12" => "Umm Sa'id"),
3094
+ "RO" => array(
3095
+ "01" => "Alba",
3096
+ "02" => "Arad",
3097
+ "03" => "Arges",
3098
+ "04" => "Bacau",
3099
+ "05" => "Bihor",
3100
+ "06" => "Bistrita-Nasaud",
3101
+ "07" => "Botosani",
3102
+ "08" => "Braila",
3103
+ "09" => "Brasov",
3104
+ "10" => "Bucuresti",
3105
+ "11" => "Buzau",
3106
+ "12" => "Caras-Severin",
3107
+ "13" => "Cluj",
3108
+ "14" => "Constanta",
3109
+ "15" => "Covasna",
3110
+ "16" => "Dambovita",
3111
+ "17" => "Dolj",
3112
+ "18" => "Galati",
3113
+ "19" => "Gorj",
3114
+ "20" => "Harghita",
3115
+ "21" => "Hunedoara",
3116
+ "22" => "Ialomita",
3117
+ "23" => "Iasi",
3118
+ "25" => "Maramures",
3119
+ "26" => "Mehedinti",
3120
+ "27" => "Mures",
3121
+ "28" => "Neamt",
3122
+ "29" => "Olt",
3123
+ "30" => "Prahova",
3124
+ "31" => "Salaj",
3125
+ "32" => "Satu Mare",
3126
+ "33" => "Sibiu",
3127
+ "34" => "Suceava",
3128
+ "35" => "Teleorman",
3129
+ "36" => "Timis",
3130
+ "37" => "Tulcea",
3131
+ "38" => "Vaslui",
3132
+ "39" => "Valcea",
3133
+ "40" => "Vrancea",
3134
+ "41" => "Calarasi",
3135
+ "42" => "Giurgiu",
3136
+ "43" => "Ilfov"),
3137
+ "RS" => array(
3138
+ "01" => "Kosovo",
3139
+ "02" => "Vojvodina"),
3140
+ "RU" => array(
3141
+ "01" => "Adygeya, Republic of",
3142
+ "02" => "Aginsky Buryatsky AO",
3143
+ "03" => "Gorno-Altay",
3144
+ "04" => "Altaisky krai",
3145
+ "05" => "Amur",
3146
+ "06" => "Arkhangel'sk",
3147
+ "07" => "Astrakhan'",
3148
+ "08" => "Bashkortostan",
3149
+ "09" => "Belgorod",
3150
+ "10" => "Bryansk",
3151
+ "11" => "Buryat",
3152
+ "12" => "Chechnya",
3153
+ "13" => "Chelyabinsk",
3154
+ "14" => "Chita",
3155
+ "15" => "Chukot",
3156
+ "16" => "Chuvashia",
3157
+ "17" => "Dagestan",
3158
+ "18" => "Evenk",
3159
+ "19" => "Ingush",
3160
+ "20" => "Irkutsk",
3161
+ "21" => "Ivanovo",
3162
+ "22" => "Kabardin-Balkar",
3163
+ "23" => "Kaliningrad",
3164
+ "24" => "Kalmyk",
3165
+ "25" => "Kaluga",
3166
+ "26" => "Kamchatka",
3167
+ "27" => "Karachay-Cherkess",
3168
+ "28" => "Karelia",
3169
+ "29" => "Kemerovo",
3170
+ "30" => "Khabarovsk",
3171
+ "31" => "Khakass",
3172
+ "32" => "Khanty-Mansiy",
3173
+ "33" => "Kirov",
3174
+ "34" => "Komi",
3175
+ "35" => "Komi-Permyak",
3176
+ "36" => "Koryak",
3177
+ "37" => "Kostroma",
3178
+ "38" => "Krasnodar",
3179
+ "39" => "Krasnoyarsk",
3180
+ "40" => "Kurgan",
3181
+ "41" => "Kursk",
3182
+ "42" => "Leningrad",
3183
+ "43" => "Lipetsk",
3184
+ "44" => "Magadan",
3185
+ "45" => "Mariy-El",
3186
+ "46" => "Mordovia",
3187
+ "47" => "Moskva",
3188
+ "48" => "Moscow City",
3189
+ "49" => "Murmansk",
3190
+ "50" => "Nenets",
3191
+ "51" => "Nizhegorod",
3192
+ "52" => "Novgorod",
3193
+ "53" => "Novosibirsk",
3194
+ "54" => "Omsk",
3195
+ "55" => "Orenburg",
3196
+ "56" => "Orel",
3197
+ "57" => "Penza",
3198
+ "58" => "Perm'",
3199
+ "59" => "Primor'ye",
3200
+ "60" => "Pskov",
3201
+ "61" => "Rostov",
3202
+ "62" => "Ryazan'",
3203
+ "63" => "Sakha",
3204
+ "64" => "Sakhalin",
3205
+ "65" => "Samara",
3206
+ "66" => "Saint Petersburg City",
3207
+ "67" => "Saratov",
3208
+ "68" => "North Ossetia",
3209
+ "69" => "Smolensk",
3210
+ "70" => "Stavropol'",
3211
+ "71" => "Sverdlovsk",
3212
+ "72" => "Tambovskaya oblast",
3213
+ "73" => "Tatarstan",
3214
+ "74" => "Taymyr",
3215
+ "75" => "Tomsk",
3216
+ "76" => "Tula",
3217
+ "77" => "Tver'",
3218
+ "78" => "Tyumen'",
3219
+ "79" => "Tuva",
3220
+ "80" => "Udmurt",
3221
+ "81" => "Ul'yanovsk",
3222
+ "82" => "Ust-Orda Buryat",
3223
+ "83" => "Vladimir",
3224
+ "84" => "Volgograd",
3225
+ "85" => "Vologda",
3226
+ "86" => "Voronezh",
3227
+ "87" => "Yamal-Nenets",
3228
+ "88" => "Yaroslavl'",
3229
+ "89" => "Yevrey",
3230
+ "90" => "Permskiy Kray",
3231
+ "91" => "Krasnoyarskiy Kray",
3232
+ "92" => "Kamchatskiy Kray",
3233
+ "93" => "Zabaykal'skiy Kray"),
3234
+ "RW" => array(
3235
+ "01" => "Butare",
3236
+ "06" => "Gitarama",
3237
+ "07" => "Kibungo",
3238
+ "09" => "Kigali",
3239
+ "11" => "Est",
3240
+ "12" => "Kigali",
3241
+ "13" => "Nord",
3242
+ "14" => "Ouest",
3243
+ "15" => "Sud"),
3244
+ "SA" => array(
3245
+ "02" => "Al Bahah",
3246
+ "05" => "Al Madinah",
3247
+ "06" => "Ash Sharqiyah",
3248
+ "08" => "Al Qasim",
3249
+ "10" => "Ar Riyad",
3250
+ "11" => "Asir Province",
3251
+ "13" => "Ha'il",
3252
+ "14" => "Makkah",
3253
+ "15" => "Al Hudud ash Shamaliyah",
3254
+ "16" => "Najran",
3255
+ "17" => "Jizan",
3256
+ "19" => "Tabuk",
3257
+ "20" => "Al Jawf"),
3258
+ "SB" => array(
3259
+ "03" => "Malaita",
3260
+ "06" => "Guadalcanal",
3261
+ "07" => "Isabel",
3262
+ "08" => "Makira",
3263
+ "09" => "Temotu",
3264
+ "10" => "Central",
3265
+ "11" => "Western",
3266
+ "12" => "Choiseul",
3267
+ "13" => "Rennell and Bellona"),
3268
+ "SC" => array(
3269
+ "01" => "Anse aux Pins",
3270
+ "02" => "Anse Boileau",
3271
+ "03" => "Anse Etoile",
3272
+ "04" => "Anse Louis",
3273
+ "05" => "Anse Royale",
3274
+ "06" => "Baie Lazare",
3275
+ "07" => "Baie Sainte Anne",
3276
+ "08" => "Beau Vallon",
3277
+ "09" => "Bel Air",
3278
+ "10" => "Bel Ombre",
3279
+ "11" => "Cascade",
3280
+ "12" => "Glacis",
3281
+ "13" => "Grand' Anse",
3282
+ "14" => "Grand' Anse",
3283
+ "15" => "La Digue",
3284
+ "16" => "La Riviere Anglaise",
3285
+ "17" => "Mont Buxton",
3286
+ "18" => "Mont Fleuri",
3287
+ "19" => "Plaisance",
3288
+ "20" => "Pointe La Rue",
3289
+ "21" => "Port Glaud",
3290
+ "22" => "Saint Louis",
3291
+ "23" => "Takamaka"),
3292
+ "SD" => array(
3293
+ "27" => "Al Wusta",
3294
+ "28" => "Al Istiwa'iyah",
3295
+ "29" => "Al Khartum",
3296
+ "30" => "Ash Shamaliyah",
3297
+ "31" => "Ash Sharqiyah",
3298
+ "32" => "Bahr al Ghazal",
3299
+ "33" => "Darfur",
3300
+ "34" => "Kurdufan",
3301
+ "35" => "Upper Nile",
3302
+ "40" => "Al Wahadah State",
3303
+ "44" => "Central Equatoria State"),
3304
+ "SE" => array(
3305
+ "02" => "Blekinge Lan",
3306
+ "03" => "Gavleborgs Lan",
3307
+ "05" => "Gotlands Lan",
3308
+ "06" => "Hallands Lan",
3309
+ "07" => "Jamtlands Lan",
3310
+ "08" => "Jonkopings Lan",
3311
+ "09" => "Kalmar Lan",
3312
+ "10" => "Dalarnas Lan",
3313
+ "12" => "Kronobergs Lan",
3314
+ "14" => "Norrbottens Lan",
3315
+ "15" => "Orebro Lan",
3316
+ "16" => "Ostergotlands Lan",
3317
+ "18" => "Sodermanlands Lan",
3318
+ "21" => "Uppsala Lan",
3319
+ "22" => "Varmlands Lan",
3320
+ "23" => "Vasterbottens Lan",
3321
+ "24" => "Vasternorrlands Lan",
3322
+ "25" => "Vastmanlands Lan",
3323
+ "26" => "Stockholms Lan",
3324
+ "27" => "Skane Lan",
3325
+ "28" => "Vastra Gotaland"),
3326
+ "SH" => array(
3327
+ "01" => "Ascension",
3328
+ "02" => "Saint Helena",
3329
+ "03" => "Tristan da Cunha"),
3330
+ "SI" => array(
3331
+ "01" => "Ajdovscina",
3332
+ "02" => "Beltinci",
3333
+ "03" => "Bled",
3334
+ "04" => "Bohinj",
3335
+ "05" => "Borovnica",
3336
+ "06" => "Bovec",
3337
+ "07" => "Brda",
3338
+ "08" => "Brezice",
3339
+ "09" => "Brezovica",
3340
+ "11" => "Celje",
3341
+ "12" => "Cerklje na Gorenjskem",
3342
+ "13" => "Cerknica",
3343
+ "14" => "Cerkno",
3344
+ "15" => "Crensovci",
3345
+ "16" => "Crna na Koroskem",
3346
+ "17" => "Crnomelj",
3347
+ "19" => "Divaca",
3348
+ "20" => "Dobrepolje",
3349
+ "22" => "Dol pri Ljubljani",
3350
+ "24" => "Dornava",
3351
+ "25" => "Dravograd",
3352
+ "26" => "Duplek",
3353
+ "27" => "Gorenja Vas-Poljane",
3354
+ "28" => "Gorisnica",
3355
+ "29" => "Gornja Radgona",
3356
+ "30" => "Gornji Grad",
3357
+ "31" => "Gornji Petrovci",
3358
+ "32" => "Grosuplje",
3359
+ "34" => "Hrastnik",
3360
+ "35" => "Hrpelje-Kozina",
3361
+ "36" => "Idrija",
3362
+ "37" => "Ig",
3363
+ "38" => "Ilirska Bistrica",
3364
+ "39" => "Ivancna Gorica",
3365
+ "40" => "Izola-Isola",
3366
+ "42" => "Jursinci",
3367
+ "44" => "Kanal",
3368
+ "45" => "Kidricevo",
3369
+ "46" => "Kobarid",
3370
+ "47" => "Kobilje",
3371
+ "49" => "Komen",
3372
+ "50" => "Koper-Capodistria",
3373
+ "51" => "Kozje",
3374
+ "52" => "Kranj",
3375
+ "53" => "Kranjska Gora",
3376
+ "54" => "Krsko",
3377
+ "55" => "Kungota",
3378
+ "57" => "Lasko",
3379
+ "61" => "Ljubljana",
3380
+ "62" => "Ljubno",
3381
+ "64" => "Logatec",
3382
+ "66" => "Loski Potok",
3383
+ "68" => "Lukovica",
3384
+ "71" => "Medvode",
3385
+ "72" => "Menges",
3386
+ "73" => "Metlika",
3387
+ "74" => "Mezica",
3388
+ "76" => "Mislinja",
3389
+ "77" => "Moravce",
3390
+ "78" => "Moravske Toplice",
3391
+ "79" => "Mozirje",
3392
+ "80" => "Murska Sobota",
3393
+ "81" => "Muta",
3394
+ "82" => "Naklo",
3395
+ "83" => "Nazarje",
3396
+ "84" => "Nova Gorica",
3397
+ "86" => "Odranci",
3398
+ "87" => "Ormoz",
3399
+ "88" => "Osilnica",
3400
+ "89" => "Pesnica",
3401
+ "91" => "Pivka",
3402
+ "92" => "Podcetrtek",
3403
+ "94" => "Postojna",
3404
+ "97" => "Puconci",
3405
+ "98" => "Racam",
3406
+ "99" => "Radece",
3407
+ "A1" => "Radenci",
3408
+ "A2" => "Radlje ob Dravi",
3409
+ "A3" => "Radovljica",
3410
+ "A6" => "Rogasovci",
3411
+ "A7" => "Rogaska Slatina",
3412
+ "A8" => "Rogatec",
3413
+ "B1" => "Semic",
3414
+ "B2" => "Sencur",
3415
+ "B3" => "Sentilj",
3416
+ "B4" => "Sentjernej",
3417
+ "B6" => "Sevnica",
3418
+ "B7" => "Sezana",
3419
+ "B8" => "Skocjan",
3420
+ "B9" => "Skofja Loka",
3421
+ "C1" => "Skofljica",
3422
+ "C2" => "Slovenj Gradec",
3423
+ "C4" => "Slovenske Konjice",
3424
+ "C5" => "Smarje pri Jelsah",
3425
+ "C6" => "Smartno ob Paki",
3426
+ "C7" => "Sostanj",
3427
+ "C8" => "Starse",
3428
+ "C9" => "Store",
3429
+ "D1" => "Sveti Jurij",
3430
+ "D2" => "Tolmin",
3431
+ "D3" => "Trbovlje",
3432
+ "D4" => "Trebnje",
3433
+ "D5" => "Trzic",
3434
+ "D6" => "Turnisce",
3435
+ "D7" => "Velenje",
3436
+ "D8" => "Velike Lasce",
3437
+ "E1" => "Vipava",
3438
+ "E2" => "Vitanje",
3439
+ "E3" => "Vodice",
3440
+ "E5" => "Vrhnika",
3441
+ "E6" => "Vuzenica",
3442
+ "E7" => "Zagorje ob Savi",
3443
+ "E9" => "Zavrc",
3444
+ "F1" => "Zelezniki",
3445
+ "F2" => "Ziri",
3446
+ "F3" => "Zrece",
3447
+ "G4" => "Dobrova-Horjul-Polhov Gradec",
3448
+ "G7" => "Domzale",
3449
+ "H4" => "Jesenice",
3450
+ "H6" => "Kamnik",
3451
+ "H7" => "Kocevje",
3452
+ "I2" => "Kuzma",
3453
+ "I3" => "Lenart",
3454
+ "I5" => "Litija",
3455
+ "I6" => "Ljutomer",
3456
+ "I7" => "Loska Dolina",
3457
+ "I9" => "Luce",
3458
+ "J1" => "Majsperk",
3459
+ "J2" => "Maribor",
3460
+ "J5" => "Miren-Kostanjevica",
3461
+ "J7" => "Novo Mesto",
3462
+ "J9" => "Piran",
3463
+ "K5" => "Preddvor",
3464
+ "K7" => "Ptuj",
3465
+ "L1" => "Ribnica",
3466
+ "L3" => "Ruse",
3467
+ "L7" => "Sentjur pri Celju",
3468
+ "L8" => "Slovenska Bistrica",
3469
+ "N2" => "Videm",
3470
+ "N3" => "Vojnik",
3471
+ "N5" => "Zalec"),
3472
+ "SK" => array(
3473
+ "01" => "Banska Bystrica",
3474
+ "02" => "Bratislava",
3475
+ "03" => "Kosice",
3476
+ "04" => "Nitra",
3477
+ "05" => "Presov",
3478
+ "06" => "Trencin",
3479
+ "07" => "Trnava",
3480
+ "08" => "Zilina"),
3481
+ "SL" => array(
3482
+ "01" => "Eastern",
3483
+ "02" => "Northern",
3484
+ "03" => "Southern",
3485
+ "04" => "Western Area"),
3486
+ "SM" => array(
3487
+ "01" => "Acquaviva",
3488
+ "02" => "Chiesanuova",
3489
+ "03" => "Domagnano",
3490
+ "04" => "Faetano",
3491
+ "05" => "Fiorentino",
3492
+ "06" => "Borgo Maggiore",
3493
+ "07" => "San Marino",
3494
+ "08" => "Monte Giardino",
3495
+ "09" => "Serravalle"),
3496
+ "SN" => array(
3497
+ "01" => "Dakar",
3498
+ "03" => "Diourbel",
3499
+ "05" => "Tambacounda",
3500
+ "07" => "Thies",
3501
+ "09" => "Fatick",
3502
+ "10" => "Kaolack",
3503
+ "11" => "Kolda",
3504
+ "12" => "Ziguinchor",
3505
+ "13" => "Louga",
3506
+ "14" => "Saint-Louis",
3507
+ "15" => "Matam"),
3508
+ "SO" => array(
3509
+ "01" => "Bakool",
3510
+ "02" => "Banaadir",
3511
+ "03" => "Bari",
3512
+ "04" => "Bay",
3513
+ "05" => "Galguduud",
3514
+ "06" => "Gedo",
3515
+ "07" => "Hiiraan",
3516
+ "08" => "Jubbada Dhexe",
3517
+ "09" => "Jubbada Hoose",
3518
+ "10" => "Mudug",
3519
+ "11" => "Nugaal",
3520
+ "12" => "Sanaag",
3521
+ "13" => "Shabeellaha Dhexe",
3522
+ "14" => "Shabeellaha Hoose",
3523
+ "16" => "Woqooyi Galbeed",
3524
+ "18" => "Nugaal",
3525
+ "19" => "Togdheer",
3526
+ "20" => "Woqooyi Galbeed",
3527
+ "21" => "Awdal",
3528
+ "22" => "Sool"),
3529
+ "SR" => array(
3530
+ "10" => "Brokopondo",
3531
+ "11" => "Commewijne",
3532
+ "12" => "Coronie",
3533
+ "13" => "Marowijne",
3534
+ "14" => "Nickerie",
3535
+ "15" => "Para",
3536
+ "16" => "Paramaribo",
3537
+ "17" => "Saramacca",
3538
+ "18" => "Sipaliwini",
3539
+ "19" => "Wanica"),
3540
+ "ST" => array(
3541
+ "01" => "Principe",
3542
+ "02" => "Sao Tome"),
3543
+ "SV" => array(
3544
+ "01" => "Ahuachapan",
3545
+ "02" => "Cabanas",
3546
+ "03" => "Chalatenango",
3547
+ "04" => "Cuscatlan",
3548
+ "05" => "La Libertad",
3549
+ "06" => "La Paz",
3550
+ "07" => "La Union",
3551
+ "08" => "Morazan",
3552
+ "09" => "San Miguel",
3553
+ "10" => "San Salvador",
3554
+ "11" => "Santa Ana",
3555
+ "12" => "San Vicente",
3556
+ "13" => "Sonsonate",
3557
+ "14" => "Usulutan"),
3558
+ "SY" => array(
3559
+ "01" => "Al Hasakah",
3560
+ "02" => "Al Ladhiqiyah",
3561
+ "03" => "Al Qunaytirah",
3562
+ "04" => "Ar Raqqah",
3563
+ "05" => "As Suwayda'",
3564
+ "06" => "Dar",
3565
+ "07" => "Dayr az Zawr",
3566
+ "08" => "Rif Dimashq",
3567
+ "09" => "Halab",
3568
+ "10" => "Hamah",
3569
+ "11" => "Hims",
3570
+ "12" => "Idlib",
3571
+ "13" => "Dimashq",
3572
+ "14" => "Tartus"),
3573
+ "SZ" => array(
3574
+ "01" => "Hhohho",
3575
+ "02" => "Lubombo",
3576
+ "03" => "Manzini",
3577
+ "04" => "Shiselweni",
3578
+ "05" => "Praslin"),
3579
+ "TD" => array(
3580
+ "01" => "Batha",
3581
+ "02" => "Biltine",
3582
+ "03" => "Borkou-Ennedi-Tibesti",
3583
+ "04" => "Chari-Baguirmi",
3584
+ "05" => "Guera",
3585
+ "06" => "Kanem",
3586
+ "07" => "Lac",
3587
+ "08" => "Logone Occidental",
3588
+ "09" => "Logone Oriental",
3589
+ "10" => "Mayo-Kebbi",
3590
+ "11" => "Moyen-Chari",
3591
+ "12" => "Ouaddai",
3592
+ "13" => "Salamat",
3593
+ "14" => "Tandjile"),
3594
+ "TG" => array(
3595
+ "22" => "Centrale",
3596
+ "23" => "Kara",
3597
+ "24" => "Maritime",
3598
+ "25" => "Plateaux",
3599
+ "26" => "Savanes"),
3600
+ "TH" => array(
3601
+ "01" => "Mae Hong Son",
3602
+ "02" => "Chiang Mai",
3603
+ "03" => "Chiang Rai",
3604
+ "04" => "Nan",
3605
+ "05" => "Lamphun",
3606
+ "06" => "Lampang",
3607
+ "07" => "Phrae",
3608
+ "08" => "Tak",
3609
+ "09" => "Sukhothai",
3610
+ "10" => "Uttaradit",
3611
+ "11" => "Kamphaeng Phet",
3612
+ "12" => "Phitsanulok",
3613
+ "13" => "Phichit",
3614
+ "14" => "Phetchabun",
3615
+ "15" => "Uthai Thani",
3616
+ "16" => "Nakhon Sawan",
3617
+ "17" => "Nong Khai",
3618
+ "18" => "Loei",
3619
+ "20" => "Sakon Nakhon",
3620
+ "21" => "Nakhon Phanom",
3621
+ "22" => "Khon Kaen",
3622
+ "23" => "Kalasin",
3623
+ "24" => "Maha Sarakham",
3624
+ "25" => "Roi Et",
3625
+ "26" => "Chaiyaphum",
3626
+ "27" => "Nakhon Ratchasima",
3627
+ "28" => "Buriram",
3628
+ "29" => "Surin",
3629
+ "30" => "Sisaket",
3630
+ "31" => "Narathiwat",
3631
+ "32" => "Chai Nat",
3632
+ "33" => "Sing Buri",
3633
+ "34" => "Lop Buri",
3634
+ "35" => "Ang Thong",
3635
+ "36" => "Phra Nakhon Si Ayutthaya",
3636
+ "37" => "Saraburi",
3637
+ "38" => "Nonthaburi",
3638
+ "39" => "Pathum Thani",
3639
+ "40" => "Krung Thep",
3640
+ "41" => "Phayao",
3641
+ "42" => "Samut Prakan",
3642
+ "43" => "Nakhon Nayok",
3643
+ "44" => "Chachoengsao",
3644
+ "45" => "Prachin Buri",
3645
+ "46" => "Chon Buri",
3646
+ "47" => "Rayong",
3647
+ "48" => "Chanthaburi",
3648
+ "49" => "Trat",
3649
+ "50" => "Kanchanaburi",
3650
+ "51" => "Suphan Buri",
3651
+ "52" => "Ratchaburi",
3652
+ "53" => "Nakhon Pathom",
3653
+ "54" => "Samut Songkhram",
3654
+ "55" => "Samut Sakhon",
3655
+ "56" => "Phetchaburi",
3656
+ "57" => "Prachuap Khiri Khan",
3657
+ "58" => "Chumphon",
3658
+ "59" => "Ranong",
3659
+ "60" => "Surat Thani",
3660
+ "61" => "Phangnga",
3661
+ "62" => "Phuket",
3662
+ "63" => "Krabi",
3663
+ "64" => "Nakhon Si Thammarat",
3664
+ "65" => "Trang",
3665
+ "66" => "Phatthalung",
3666
+ "67" => "Satun",
3667
+ "68" => "Songkhla",
3668
+ "69" => "Pattani",
3669
+ "70" => "Yala",
3670
+ "71" => "Ubon Ratchathani",
3671
+ "72" => "Yasothon",
3672
+ "73" => "Nakhon Phanom",
3673
+ "75" => "Ubon Ratchathani",
3674
+ "76" => "Udon Thani",
3675
+ "77" => "Amnat Charoen",
3676
+ "78" => "Mukdahan",
3677
+ "79" => "Nong Bua Lamphu",
3678
+ "80" => "Sa Kaeo"),
3679
+ "TJ" => array(
3680
+ "01" => "Kuhistoni Badakhshon",
3681
+ "02" => "Khatlon",
3682
+ "03" => "Sughd"),
3683
+ "TM" => array(
3684
+ "01" => "Ahal",
3685
+ "02" => "Balkan",
3686
+ "03" => "Dashoguz",
3687
+ "04" => "Lebap",
3688
+ "05" => "Mary"),
3689
+ "TN" => array(
3690
+ "02" => "Kasserine",
3691
+ "03" => "Kairouan",
3692
+ "06" => "Jendouba",
3693
+ "10" => "Qafsah",
3694
+ "14" => "El Kef",
3695
+ "15" => "Al Mahdia",
3696
+ "16" => "Al Munastir",
3697
+ "17" => "Bajah",
3698
+ "18" => "Bizerte",
3699
+ "19" => "Nabeul",
3700
+ "22" => "Siliana",
3701
+ "23" => "Sousse",
3702
+ "27" => "Ben Arous",
3703
+ "28" => "Madanin",
3704
+ "29" => "Gabes",
3705
+ "31" => "Kebili",
3706
+ "32" => "Sfax",
3707
+ "33" => "Sidi Bou Zid",
3708
+ "34" => "Tataouine",
3709
+ "35" => "Tozeur",
3710
+ "36" => "Tunis",
3711
+ "37" => "Zaghouan",
3712
+ "38" => "Aiana",
3713
+ "39" => "Manouba"),
3714
+ "TO" => array(
3715
+ "01" => "Ha",
3716
+ "02" => "Tongatapu",
3717
+ "03" => "Vava"),
3718
+ "TR" => array(
3719
+ "02" => "Adiyaman",
3720
+ "03" => "Afyonkarahisar",
3721
+ "04" => "Agri",
3722
+ "05" => "Amasya",
3723
+ "07" => "Antalya",
3724
+ "08" => "Artvin",
3725
+ "09" => "Aydin",
3726
+ "10" => "Balikesir",
3727
+ "11" => "Bilecik",
3728
+ "12" => "Bingol",
3729
+ "13" => "Bitlis",
3730
+ "14" => "Bolu",
3731
+ "15" => "Burdur",
3732
+ "16" => "Bursa",
3733
+ "17" => "Canakkale",
3734
+ "19" => "Corum",
3735
+ "20" => "Denizli",
3736
+ "21" => "Diyarbakir",
3737
+ "22" => "Edirne",
3738
+ "23" => "Elazig",
3739
+ "24" => "Erzincan",
3740
+ "25" => "Erzurum",
3741
+ "26" => "Eskisehir",
3742
+ "28" => "Giresun",
3743
+ "31" => "Hatay",
3744
+ "32" => "Mersin",
3745
+ "33" => "Isparta",
3746
+ "34" => "Istanbul",
3747
+ "35" => "Izmir",
3748
+ "37" => "Kastamonu",
3749
+ "38" => "Kayseri",
3750
+ "39" => "Kirklareli",
3751
+ "40" => "Kirsehir",
3752
+ "41" => "Kocaeli",
3753
+ "43" => "Kutahya",
3754
+ "44" => "Malatya",
3755
+ "45" => "Manisa",
3756
+ "46" => "Kahramanmaras",
3757
+ "48" => "Mugla",
3758
+ "49" => "Mus",
3759
+ "50" => "Nevsehir",
3760
+ "52" => "Ordu",
3761
+ "53" => "Rize",
3762
+ "54" => "Sakarya",
3763
+ "55" => "Samsun",
3764
+ "57" => "Sinop",
3765
+ "58" => "Sivas",
3766
+ "59" => "Tekirdag",
3767
+ "60" => "Tokat",
3768
+ "61" => "Trabzon",
3769
+ "62" => "Tunceli",
3770
+ "63" => "Sanliurfa",
3771
+ "64" => "Usak",
3772
+ "65" => "Van",
3773
+ "66" => "Yozgat",
3774
+ "68" => "Ankara",
3775
+ "69" => "Gumushane",
3776
+ "70" => "Hakkari",
3777
+ "71" => "Konya",
3778
+ "72" => "Mardin",
3779
+ "73" => "Nigde",
3780
+ "74" => "Siirt",
3781
+ "75" => "Aksaray",
3782
+ "76" => "Batman",
3783
+ "77" => "Bayburt",
3784
+ "78" => "Karaman",
3785
+ "79" => "Kirikkale",
3786
+ "80" => "Sirnak",
3787
+ "81" => "Adana",
3788
+ "82" => "Cankiri",
3789
+ "83" => "Gaziantep",
3790
+ "84" => "Kars",
3791
+ "85" => "Zonguldak",
3792
+ "86" => "Ardahan",
3793
+ "87" => "Bartin",
3794
+ "88" => "Igdir",
3795
+ "89" => "Karabuk",
3796
+ "90" => "Kilis",
3797
+ "91" => "Osmaniye",
3798
+ "92" => "Yalova",
3799
+ "93" => "Duzce"),
3800
+ "TT" => array(
3801
+ "01" => "Arima",
3802
+ "02" => "Caroni",
3803
+ "03" => "Mayaro",
3804
+ "04" => "Nariva",
3805
+ "05" => "Port-of-Spain",
3806
+ "06" => "Saint Andrew",
3807
+ "07" => "Saint David",
3808
+ "08" => "Saint George",
3809
+ "09" => "Saint Patrick",
3810
+ "10" => "San Fernando",
3811
+ "11" => "Tobago",
3812
+ "12" => "Victoria"),
3813
+ "TW" => array(
3814
+ "01" => "Fu-chien",
3815
+ "02" => "Kao-hsiung",
3816
+ "03" => "T'ai-pei",
3817
+ "04" => "T'ai-wan"),
3818
+ "TZ" => array(
3819
+ "02" => "Pwani",
3820
+ "03" => "Dodoma",
3821
+ "04" => "Iringa",
3822
+ "05" => "Kigoma",
3823
+ "06" => "Kilimanjaro",
3824
+ "07" => "Lindi",
3825
+ "08" => "Mara",
3826
+ "09" => "Mbeya",
3827
+ "10" => "Morogoro",
3828
+ "11" => "Mtwara",
3829
+ "12" => "Mwanza",
3830
+ "13" => "Pemba North",
3831
+ "14" => "Ruvuma",
3832
+ "15" => "Shinyanga",
3833
+ "16" => "Singida",
3834
+ "17" => "Tabora",
3835
+ "18" => "Tanga",
3836
+ "19" => "Kagera",
3837
+ "20" => "Pemba South",
3838
+ "21" => "Zanzibar Central",
3839
+ "22" => "Zanzibar North",
3840
+ "23" => "Dar es Salaam",
3841
+ "24" => "Rukwa",
3842
+ "25" => "Zanzibar Urban",
3843
+ "26" => "Arusha",
3844
+ "27" => "Manyara"),
3845
+ "UA" => array(
3846
+ "01" => "Cherkas'ka Oblast'",
3847
+ "02" => "Chernihivs'ka Oblast'",
3848
+ "03" => "Chernivets'ka Oblast'",
3849
+ "04" => "Dnipropetrovs'ka Oblast'",
3850
+ "05" => "Donets'ka Oblast'",
3851
+ "06" => "Ivano-Frankivs'ka Oblast'",
3852
+ "07" => "Kharkivs'ka Oblast'",
3853
+ "08" => "Khersons'ka Oblast'",
3854
+ "09" => "Khmel'nyts'ka Oblast'",
3855
+ "10" => "Kirovohrads'ka Oblast'",
3856
+ "11" => "Krym",
3857
+ "12" => "Kyyiv",
3858
+ "13" => "Kyyivs'ka Oblast'",
3859
+ "14" => "Luhans'ka Oblast'",
3860
+ "15" => "L'vivs'ka Oblast'",
3861
+ "16" => "Mykolayivs'ka Oblast'",
3862
+ "17" => "Odes'ka Oblast'",
3863
+ "18" => "Poltavs'ka Oblast'",
3864
+ "19" => "Rivnens'ka Oblast'",
3865
+ "20" => "Sevastopol'",
3866
+ "21" => "Sums'ka Oblast'",
3867
+ "22" => "Ternopil's'ka Oblast'",
3868
+ "23" => "Vinnyts'ka Oblast'",
3869
+ "24" => "Volyns'ka Oblast'",
3870
+ "25" => "Zakarpats'ka Oblast'",
3871
+ "26" => "Zaporiz'ka Oblast'",
3872
+ "27" => "Zhytomyrs'ka Oblast'"),
3873
+ "UG" => array(
3874
+ "26" => "Apac",
3875
+ "28" => "Bundibugyo",
3876
+ "29" => "Bushenyi",
3877
+ "30" => "Gulu",
3878
+ "31" => "Hoima",
3879
+ "33" => "Jinja",
3880
+ "36" => "Kalangala",
3881
+ "37" => "Kampala",
3882
+ "38" => "Kamuli",
3883
+ "39" => "Kapchorwa",
3884
+ "40" => "Kasese",
3885
+ "41" => "Kibale",
3886
+ "42" => "Kiboga",
3887
+ "43" => "Kisoro",
3888
+ "45" => "Kotido",
3889
+ "46" => "Kumi",
3890
+ "47" => "Lira",
3891
+ "50" => "Masindi",
3892
+ "52" => "Mbarara",
3893
+ "56" => "Mubende",
3894
+ "58" => "Nebbi",
3895
+ "59" => "Ntungamo",
3896
+ "60" => "Pallisa",
3897
+ "61" => "Rakai",
3898
+ "65" => "Adjumani",
3899
+ "66" => "Bugiri",
3900
+ "67" => "Busia",
3901
+ "69" => "Katakwi",
3902
+ "70" => "Luwero",
3903
+ "71" => "Masaka",
3904
+ "72" => "Moyo",
3905
+ "73" => "Nakasongola",
3906
+ "74" => "Sembabule",
3907
+ "76" => "Tororo",
3908
+ "77" => "Arua",
3909
+ "78" => "Iganga",
3910
+ "79" => "Kabarole",
3911
+ "80" => "Kaberamaido",
3912
+ "81" => "Kamwenge",
3913
+ "82" => "Kanungu",
3914
+ "83" => "Kayunga",
3915
+ "84" => "Kitgum",
3916
+ "85" => "Kyenjojo",
3917
+ "86" => "Mayuge",
3918
+ "87" => "Mbale",
3919
+ "88" => "Moroto",
3920
+ "89" => "Mpigi",
3921
+ "90" => "Mukono",
3922
+ "91" => "Nakapiripirit",
3923
+ "92" => "Pader",
3924
+ "93" => "Rukungiri",
3925
+ "94" => "Sironko",
3926
+ "95" => "Soroti",
3927
+ "96" => "Wakiso",
3928
+ "97" => "Yumbe"),
3929
+ "US" => array(
3930
+ "AA" => "Armed Forces Americas",
3931
+ "AE" => "Armed Forces Europe, Middle East, & Canada",
3932
+ "AK" => "Alaska",
3933
+ "AL" => "Alabama",
3934
+ "AP" => "Armed Forces Pacific",
3935
+ "AR" => "Arkansas",
3936
+ "AS" => "American Samoa",
3937
+ "AZ" => "Arizona",
3938
+ "CA" => "California",
3939
+ "CO" => "Colorado",
3940
+ "CT" => "Connecticut",
3941
+ "DC" => "District of Columbia",
3942
+ "DE" => "Delaware",
3943
+ "FL" => "Florida",
3944
+ "FM" => "Federated States of Micronesia",
3945
+ "GA" => "Georgia",
3946
+ "GU" => "Guam",
3947
+ "HI" => "Hawaii",
3948
+ "IA" => "Iowa",
3949
+ "ID" => "Idaho",
3950
+ "IL" => "Illinois",
3951
+ "IN" => "Indiana",
3952
+ "KS" => "Kansas",
3953
+ "KY" => "Kentucky",
3954
+ "LA" => "Louisiana",
3955
+ "MA" => "Massachusetts",
3956
+ "MD" => "Maryland",
3957
+ "ME" => "Maine",
3958
+ "MH" => "Marshall Islands",
3959
+ "MI" => "Michigan",
3960
+ "MN" => "Minnesota",
3961
+ "MO" => "Missouri",
3962
+ "MP" => "Northern Mariana Islands",
3963
+ "MS" => "Mississippi",
3964
+ "MT" => "Montana",
3965
+ "NC" => "North Carolina",
3966
+ "ND" => "North Dakota",
3967
+ "NE" => "Nebraska",
3968
+ "NH" => "New Hampshire",
3969
+ "NJ" => "New Jersey",
3970
+ "NM" => "New Mexico",
3971
+ "NV" => "Nevada",
3972
+ "NY" => "New York",
3973
+ "OH" => "Ohio",
3974
+ "OK" => "Oklahoma",
3975
+ "OR" => "Oregon",
3976
+ "PA" => "Pennsylvania",
3977
+ "PR" => "Puerto Rico",
3978
+ "PW" => "Palau",
3979
+ "RI" => "Rhode Island",
3980
+ "SC" => "South Carolina",
3981
+ "SD" => "South Dakota",
3982
+ "TN" => "Tennessee",
3983
+ "TX" => "Texas",
3984
+ "UT" => "Utah",
3985
+ "VA" => "Virginia",
3986
+ "VI" => "Virgin Islands",
3987
+ "VT" => "Vermont",
3988
+ "WA" => "Washington",
3989
+ "WI" => "Wisconsin",
3990
+ "WV" => "West Virginia",
3991
+ "WY" => "Wyoming"),
3992
+ "UY" => array(
3993
+ "01" => "Artigas",
3994
+ "02" => "Canelones",
3995
+ "03" => "Cerro Largo",
3996
+ "04" => "Colonia",
3997
+ "05" => "Durazno",
3998
+ "06" => "Flores",
3999
+ "07" => "Florida",
4000
+ "08" => "Lavalleja",
4001
+ "09" => "Maldonado",
4002
+ "10" => "Montevideo",
4003
+ "11" => "Paysandu",
4004
+ "12" => "Rio Negro",
4005
+ "13" => "Rivera",
4006
+ "14" => "Rocha",
4007
+ "15" => "Salto",
4008
+ "16" => "San Jose",
4009
+ "17" => "Soriano",
4010
+ "18" => "Tacuarembo",
4011
+ "19" => "Treinta y Tres"),
4012
+ "UZ" => array(
4013
+ "01" => "Andijon",
4014
+ "02" => "Bukhoro",
4015
+ "03" => "Farghona",
4016
+ "04" => "Jizzakh",
4017
+ "05" => "Khorazm",
4018
+ "06" => "Namangan",
4019
+ "07" => "Nawoiy",
4020
+ "08" => "Qashqadaryo",
4021
+ "09" => "Qoraqalpoghiston",
4022
+ "10" => "Samarqand",
4023
+ "11" => "Sirdaryo",
4024
+ "12" => "Surkhondaryo",
4025
+ "13" => "Toshkent",
4026
+ "14" => "Toshkent"),
4027
+ "VC" => array(
4028
+ "01" => "Charlotte",
4029
+ "02" => "Saint Andrew",
4030
+ "03" => "Saint David",
4031
+ "04" => "Saint George",
4032
+ "05" => "Saint Patrick",
4033
+ "06" => "Grenadines"),
4034
+ "VE" => array(
4035
+ "01" => "Amazonas",
4036
+ "02" => "Anzoategui",
4037
+ "03" => "Apure",
4038
+ "04" => "Aragua",
4039
+ "05" => "Barinas",
4040
+ "06" => "Bolivar",
4041
+ "07" => "Carabobo",
4042
+ "08" => "Cojedes",
4043
+ "09" => "Delta Amacuro",
4044
+ "11" => "Falcon",
4045
+ "12" => "Guarico",
4046
+ "13" => "Lara",
4047
+ "14" => "Merida",
4048
+ "15" => "Miranda",
4049
+ "16" => "Monagas",
4050
+ "17" => "Nueva Esparta",
4051
+ "18" => "Portuguesa",
4052
+ "19" => "Sucre",
4053
+ "20" => "Tachira",
4054
+ "21" => "Trujillo",
4055
+ "22" => "Yaracuy",
4056
+ "23" => "Zulia",
4057
+ "24" => "Dependencias Federales",
4058
+ "25" => "Distrito Federal",
4059
+ "26" => "Vargas"),
4060
+ "VN" => array(
4061
+ "01" => "An Giang",
4062
+ "03" => "Ben Tre",
4063
+ "05" => "Cao Bang",
4064
+ "09" => "Dong Thap",
4065
+ "13" => "Hai Phong",
4066
+ "20" => "Ho Chi Minh",
4067
+ "21" => "Kien Giang",
4068
+ "23" => "Lam Dong",
4069
+ "24" => "Long An",
4070
+ "30" => "Quang Ninh",
4071
+ "32" => "Son La",
4072
+ "33" => "Tay Ninh",
4073
+ "34" => "Thanh Hoa",
4074
+ "35" => "Thai Binh",
4075
+ "37" => "Tien Giang",
4076
+ "39" => "Lang Son",
4077
+ "43" => "An Giang",
4078
+ "44" => "Dac Lac",
4079
+ "45" => "Dong Nai",
4080
+ "46" => "Dong Thap",
4081
+ "47" => "Kien Giang",
4082
+ "49" => "Song Be",
4083
+ "50" => "Vinh Phu",
4084
+ "51" => "Ha Noi",
4085
+ "52" => "Ho Chi Minh",
4086
+ "53" => "Ba Ria-Vung Tau",
4087
+ "54" => "Binh Dinh",
4088
+ "55" => "Binh Thuan",
4089
+ "58" => "Ha Giang",
4090
+ "59" => "Ha Tay",
4091
+ "60" => "Ha Tinh",
4092
+ "61" => "Hoa Binh",
4093
+ "62" => "Khanh Hoa",
4094
+ "63" => "Kon Tum",
4095
+ "64" => "Quang Tri",
4096
+ "65" => "Nam Ha",
4097
+ "66" => "Nghe An",
4098
+ "67" => "Ninh Binh",
4099
+ "68" => "Ninh Thuan",
4100
+ "69" => "Phu Yen",
4101
+ "70" => "Quang Binh",
4102
+ "71" => "Quang Ngai",
4103
+ "72" => "Quang Tri",
4104
+ "73" => "Soc Trang",
4105
+ "74" => "Thua Thien",
4106
+ "75" => "Tra Vinh",
4107
+ "76" => "Tuyen Quang",
4108
+ "77" => "Vinh Long",
4109
+ "78" => "Da Nang",
4110
+ "79" => "Hai Duong",
4111
+ "80" => "Ha Nam",
4112
+ "81" => "Hung Yen",
4113
+ "82" => "Nam Dinh",
4114
+ "83" => "Phu Tho",
4115
+ "84" => "Quang Nam",
4116
+ "85" => "Thai Nguyen",
4117
+ "86" => "Vinh Puc Province",
4118
+ "87" => "Can Tho",
4119
+ "88" => "Dak Lak",
4120
+ "89" => "Lai Chau",
4121
+ "90" => "Lao Cai",
4122
+ "91" => "Dak Nong",
4123
+ "92" => "Dien Bien",
4124
+ "93" => "Hau Giang"),
4125
+ "VU" => array(
4126
+ "05" => "Ambrym",
4127
+ "06" => "Aoba",
4128
+ "07" => "Torba",
4129
+ "08" => "Efate",
4130
+ "09" => "Epi",
4131
+ "10" => "Malakula",
4132
+ "11" => "Paama",
4133
+ "12" => "Pentecote",
4134
+ "13" => "Sanma",
4135
+ "14" => "Shepherd",
4136
+ "15" => "Tafea",
4137
+ "16" => "Malampa",
4138
+ "17" => "Penama",
4139
+ "18" => "Shefa"),
4140
+ "WS" => array(
4141
+ "02" => "Aiga-i-le-Tai",
4142
+ "03" => "Atua",
4143
+ "04" => "Fa",
4144
+ "05" => "Gaga",
4145
+ "06" => "Va",
4146
+ "07" => "Gagaifomauga",
4147
+ "08" => "Palauli",
4148
+ "09" => "Satupa",
4149
+ "10" => "Tuamasaga",
4150
+ "11" => "Vaisigano"),
4151
+ "YE" => array(
4152
+ "01" => "Abyan",
4153
+ "02" => "Adan",
4154
+ "03" => "Al Mahrah",
4155
+ "04" => "Hadramawt",
4156
+ "05" => "Shabwah",
4157
+ "06" => "Lahij",
4158
+ "07" => "Al Bayda'",
4159
+ "08" => "Al Hudaydah",
4160
+ "09" => "Al Jawf",
4161
+ "10" => "Al Mahwit",
4162
+ "11" => "Dhamar",
4163
+ "12" => "Hajjah",
4164
+ "13" => "Ibb",
4165
+ "14" => "Ma'rib",
4166
+ "15" => "Sa'dah",
4167
+ "16" => "San'a'",
4168
+ "17" => "Taizz",
4169
+ "18" => "Ad Dali",
4170
+ "19" => "Amran",
4171
+ "20" => "Al Bayda'",
4172
+ "21" => "Al Jawf",
4173
+ "22" => "Hajjah",
4174
+ "23" => "Ibb",
4175
+ "24" => "Lahij",
4176
+ "25" => "Taizz"),
4177
+ "ZA" => array(
4178
+ "01" => "North-Western Province",
4179
+ "02" => "KwaZulu-Natal",
4180
+ "03" => "Free State",
4181
+ "05" => "Eastern Cape",
4182
+ "06" => "Gauteng",
4183
+ "07" => "Mpumalanga",
4184
+ "08" => "Northern Cape",
4185
+ "09" => "Limpopo",
4186
+ "10" => "North-West",
4187
+ "11" => "Western Cape"),
4188
+ "ZM" => array(
4189
+ "01" => "Western",
4190
+ "02" => "Central",
4191
+ "03" => "Eastern",
4192
+ "04" => "Luapula",
4193
+ "05" => "Northern",
4194
+ "06" => "North-Western",
4195
+ "07" => "Southern",
4196
+ "08" => "Copperbelt",
4197
+ "09" => "Lusaka"),
4198
+ "ZW" => array(
4199
+ "01" => "Manicaland",
4200
+ "02" => "Midlands",
4201
+ "03" => "Mashonaland Central",
4202
+ "04" => "Mashonaland East",
4203
+ "05" => "Mashonaland West",
4204
+ "06" => "Matabeleland North",
4205
+ "07" => "Matabeleland South",
4206
+ "08" => "Masvingo",
4207
+ "09" => "Bulawayo",
4208
+ "10" => "Harare")
4209
+ );
4210
+ };
4211
+
4212
+
4213
+ class Abserve_Opc_Helper_City {
4214
+ const GEOIP_COUNTRY_BEGIN = 16776960;
4215
+ const GEOIP_STATE_BEGIN_REV0 = 16700000;
4216
+ const GEOIP_STATE_BEGIN_REV1 = 16000000;
4217
+ const GEOIP_STANDARD = 0;
4218
+ const GEOIP_MEMORY_CACHE = 1;
4219
+ const GEOIP_SHARED_MEMORY = 2;
4220
+ const STRUCTURE_INFO_MAX_SIZE = 20;
4221
+ const DATABASE_INFO_MAX_SIZE = 100;
4222
+ const GEOIP_COUNTRY_EDITION = 106;
4223
+ const GEOIP_PROXY_EDITION = 8;
4224
+ const GEOIP_ASNUM_EDITION = 9;
4225
+ const GEOIP_NETSPEED_EDITION = 10;
4226
+ const GEOIP_REGION_EDITION_REV0 = 112;
4227
+ const GEOIP_REGION_EDITION_REV1 = 3;
4228
+ const GEOIP_CITY_EDITION_REV0 = 111;
4229
+ const GEOIP_CITY_EDITION_REV1 = 2;
4230
+ const GEOIP_ORG_EDITION = 110;
4231
+ const GEOIP_ISP_EDITION = 4;
4232
+ const SEGMENT_RECORD_LENGTH = 3;
4233
+ const STANDARD_RECORD_LENGTH = 3;
4234
+ const ORG_RECORD_LENGTH = 4;
4235
+ const MAX_RECORD_LENGTH = 4;
4236
+ const MAX_ORG_RECORD_LENGTH = 300;
4237
+ const GEOIP_SHM_KEY = 0x4f415401;
4238
+ const US_OFFSET = 1;
4239
+ const CANADA_OFFSET = 677;
4240
+ const WORLD_OFFSET = 1353;
4241
+ const FIPS_RANGE = 360;
4242
+ const GEOIP_UNKNOWN_SPEED = 0;
4243
+ const GEOIP_DIALUP_SPEED = 1;
4244
+ const GEOIP_CABLEDSL_SPEED = 2;
4245
+ const GEOIP_CORPORATE_SPEED = 3;
4246
+ const GEOIP_DOMAIN_EDITION = 11;
4247
+ const GEOIP_COUNTRY_EDITION_V6 = 12;
4248
+ const GEOIP_LOCATIONA_EDITION = 13;
4249
+ const GEOIP_ACCURACYRADIUS_EDITION = 14;
4250
+ const GEOIP_CITYCOMBINED_EDITION = 15;
4251
+ const GEOIP_CITY_EDITION_REV1_V6 = 30;
4252
+ const GEOIP_CITY_EDITION_REV0_V6 = 31;
4253
+ const GEOIP_NETSPEED_EDITION_REV1 = 32;
4254
+ const GEOIP_NETSPEED_EDITION_REV1_V6 = 33;
4255
+ const GEOIP_USERTYPE_EDITION = 28;
4256
+ const GEOIP_USERTYPE_EDITION_V6 = 29;
4257
+ const GEOIP_ASNUM_EDITION_V6 = 21;
4258
+ const GEOIP_ISP_EDITION_V6 = 22;
4259
+ const GEOIP_ORG_EDITION_V6 = 23;
4260
+ const GEOIP_DOMAIN_EDITION_V6 = 24;
4261
+
4262
+ const CITYCOMBINED_FIXED_RECORD = 7;
4263
+
4264
+ const FULL_RECORD_LENGTH = 50;
4265
+
4266
+ public $flags;
4267
+ public $filehandle;
4268
+ public $memory_buffer;
4269
+ public $databaseType;
4270
+ public $databaseSegments;
4271
+ public $record_length;
4272
+ public $shmid;
4273
+ public $GEOIP_COUNTRY_CODE_TO_NUMBER = array(
4274
+ "" => 0, "AP" => 1, "EU" => 2, "AD" => 3, "AE" => 4, "AF" => 5,
4275
+ "AG" => 6, "AI" => 7, "AL" => 8, "AM" => 9, "CW" => 10, "AO" => 11,
4276
+ "AQ" => 12, "AR" => 13, "AS" => 14, "AT" => 15, "AU" => 16, "AW" => 17,
4277
+ "AZ" => 18, "BA" => 19, "BB" => 20, "BD" => 21, "BE" => 22, "BF" => 23,
4278
+ "BG" => 24, "BH" => 25, "BI" => 26, "BJ" => 27, "BM" => 28, "BN" => 29,
4279
+ "BO" => 30, "BR" => 31, "BS" => 32, "BT" => 33, "BV" => 34, "BW" => 35,
4280
+ "BY" => 36, "BZ" => 37, "CA" => 38, "CC" => 39, "CD" => 40, "CF" => 41,
4281
+ "CG" => 42, "CH" => 43, "CI" => 44, "CK" => 45, "CL" => 46, "CM" => 47,
4282
+ "CN" => 48, "CO" => 49, "CR" => 50, "CU" => 51, "CV" => 52, "CX" => 53,
4283
+ "CY" => 54, "CZ" => 55, "DE" => 56, "DJ" => 57, "DK" => 58, "DM" => 59,
4284
+ "DO" => 60, "DZ" => 61, "EC" => 62, "EE" => 63, "EG" => 64, "EH" => 65,
4285
+ "ER" => 66, "ES" => 67, "ET" => 68, "FI" => 69, "FJ" => 70, "FK" => 71,
4286
+ "FM" => 72, "FO" => 73, "FR" => 74, "SX" => 75, "GA" => 76, "GB" => 77,
4287
+ "GD" => 78, "GE" => 79, "GF" => 80, "GH" => 81, "GI" => 82, "GL" => 83,
4288
+ "GM" => 84, "GN" => 85, "GP" => 86, "GQ" => 87, "GR" => 88, "GS" => 89,
4289
+ "GT" => 90, "GU" => 91, "GW" => 92, "GY" => 93, "HK" => 94, "HM" => 95,
4290
+ "HN" => 96, "HR" => 97, "HT" => 98, "HU" => 99, "ID" => 100, "IE" => 101,
4291
+ "IL" => 102, "IN" => 103, "IO" => 104, "IQ" => 105, "IR" => 106, "IS" => 107,
4292
+ "IT" => 108, "JM" => 109, "JO" => 110, "JP" => 111, "KE" => 112, "KG" => 113,
4293
+ "KH" => 114, "KI" => 115, "KM" => 116, "KN" => 117, "KP" => 118, "KR" => 119,
4294
+ "KW" => 120, "KY" => 121, "KZ" => 122, "LA" => 123, "LB" => 124, "LC" => 125,
4295
+ "LI" => 126, "LK" => 127, "LR" => 128, "LS" => 129, "LT" => 130, "LU" => 131,
4296
+ "LV" => 132, "LY" => 133, "MA" => 134, "MC" => 135, "MD" => 136, "MG" => 137,
4297
+ "MH" => 138, "MK" => 139, "ML" => 140, "MM" => 141, "MN" => 142, "MO" => 143,
4298
+ "MP" => 144, "MQ" => 145, "MR" => 146, "MS" => 147, "MT" => 148, "MU" => 149,
4299
+ "MV" => 150, "MW" => 151, "MX" => 152, "MY" => 153, "MZ" => 154, "NA" => 155,
4300
+ "NC" => 156, "NE" => 157, "NF" => 158, "NG" => 159, "NI" => 160, "NL" => 161,
4301
+ "NO" => 162, "NP" => 163, "NR" => 164, "NU" => 165, "NZ" => 166, "OM" => 167,
4302
+ "PA" => 168, "PE" => 169, "PF" => 170, "PG" => 171, "PH" => 172, "PK" => 173,
4303
+ "PL" => 174, "PM" => 175, "PN" => 176, "PR" => 177, "PS" => 178, "PT" => 179,
4304
+ "PW" => 180, "PY" => 181, "QA" => 182, "RE" => 183, "RO" => 184, "RU" => 185,
4305
+ "RW" => 186, "SA" => 187, "SB" => 188, "SC" => 189, "SD" => 190, "SE" => 191,
4306
+ "SG" => 192, "SH" => 193, "SI" => 194, "SJ" => 195, "SK" => 196, "SL" => 197,
4307
+ "SM" => 198, "SN" => 199, "SO" => 200, "SR" => 201, "ST" => 202, "SV" => 203,
4308
+ "SY" => 204, "SZ" => 205, "TC" => 206, "TD" => 207, "TF" => 208, "TG" => 209,
4309
+ "TH" => 210, "TJ" => 211, "TK" => 212, "TM" => 213, "TN" => 214, "TO" => 215,
4310
+ "TL" => 216, "TR" => 217, "TT" => 218, "TV" => 219, "TW" => 220, "TZ" => 221,
4311
+ "UA" => 222, "UG" => 223, "UM" => 224, "US" => 225, "UY" => 226, "UZ" => 227,
4312
+ "VA" => 228, "VC" => 229, "VE" => 230, "VG" => 231, "VI" => 232, "VN" => 233,
4313
+ "VU" => 234, "WF" => 235, "WS" => 236, "YE" => 237, "YT" => 238, "RS" => 239,
4314
+ "ZA" => 240, "ZM" => 241, "ME" => 242, "ZW" => 243, "A1" => 244, "A2" => 245,
4315
+ "O1" => 246, "AX" => 247, "GG" => 248, "IM" => 249, "JE" => 250, "BL" => 251,
4316
+ "MF" => 252, "BQ" => 253, "SS" => 254
4317
+ );
4318
+ public $GEOIP_COUNTRY_CODES = array(
4319
+ "","AP","EU","AD","AE","AF","AG","AI","AL","AM","CW",
4320
+ "AO","AQ","AR","AS","AT","AU","AW","AZ","BA","BB",
4321
+ "BD","BE","BF","BG","BH","BI","BJ","BM","BN","BO",
4322
+ "BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD",
4323
+ "CF","CG","CH","CI","CK","CL","CM","CN","CO","CR",
4324
+ "CU","CV","CX","CY","CZ","DE","DJ","DK","DM","DO",
4325
+ "DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ",
4326
+ "FK","FM","FO","FR","SX","GA","GB","GD","GE","GF",
4327
+ "GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT",
4328
+ "GU","GW","GY","HK","HM","HN","HR","HT","HU","ID",
4329
+ "IE","IL","IN","IO","IQ","IR","IS","IT","JM","JO",
4330
+ "JP","KE","KG","KH","KI","KM","KN","KP","KR","KW",
4331
+ "KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT",
4332
+ "LU","LV","LY","MA","MC","MD","MG","MH","MK","ML",
4333
+ "MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV",
4334
+ "MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI",
4335
+ "NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF",
4336
+ "PG","PH","PK","PL","PM","PN","PR","PS","PT","PW",
4337
+ "PY","QA","RE","RO","RU","RW","SA","SB","SC","SD",
4338
+ "SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO",
4339
+ "SR","ST","SV","SY","SZ","TC","TD","TF","TG","TH",
4340
+ "TJ","TK","TM","TN","TO","TL","TR","TT","TV","TW",
4341
+ "TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE",
4342
+ "VG","VI","VN","VU","WF","WS","YE","YT","RS","ZA",
4343
+ "ZM","ME","ZW","A1","A2","O1","AX","GG","IM","JE",
4344
+ "BL","MF", "BQ", "SS", "O1" );
4345
+ public $GEOIP_COUNTRY_CODES3 = array(
4346
+ "","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","CUW",
4347
+ "AGO","ATA","ARG","ASM","AUT","AUS","ABW","AZE","BIH","BRB",
4348
+ "BGD","BEL","BFA","BGR","BHR","BDI","BEN","BMU","BRN","BOL",
4349
+ "BRA","BHS","BTN","BVT","BWA","BLR","BLZ","CAN","CCK","COD",
4350
+ "CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI",
4351
+ "CUB","CPV","CXR","CYP","CZE","DEU","DJI","DNK","DMA","DOM",
4352
+ "DZA","ECU","EST","EGY","ESH","ERI","ESP","ETH","FIN","FJI",
4353
+ "FLK","FSM","FRO","FRA","SXM","GAB","GBR","GRD","GEO","GUF",
4354
+ "GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","SGS","GTM",
4355
+ "GUM","GNB","GUY","HKG","HMD","HND","HRV","HTI","HUN","IDN",
4356
+ "IRL","ISR","IND","IOT","IRQ","IRN","ISL","ITA","JAM","JOR",
4357
+ "JPN","KEN","KGZ","KHM","KIR","COM","KNA","PRK","KOR","KWT",
4358
+ "CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU",
4359
+ "LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI",
4360
+ "MMR","MNG","MAC","MNP","MTQ","MRT","MSR","MLT","MUS","MDV",
4361
+ "MWI","MEX","MYS","MOZ","NAM","NCL","NER","NFK","NGA","NIC",
4362
+ "NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER","PYF",
4363
+ "PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW",
4364
+ "PRY","QAT","REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN",
4365
+ "SWE","SGP","SHN","SVN","SJM","SVK","SLE","SMR","SEN","SOM",
4366
+ "SUR","STP","SLV","SYR","SWZ","TCA","TCD","ATF","TGO","THA",
4367
+ "TJK","TKL","TKM","TUN","TON","TLS","TUR","TTO","TUV","TWN",
4368
+ "TZA","UKR","UGA","UMI","USA","URY","UZB","VAT","VCT","VEN",
4369
+ "VGB","VIR","VNM","VUT","WLF","WSM","YEM","MYT","SRB","ZAF",
4370
+ "ZMB","MNE","ZWE","A1","A2","O1","ALA","GGY","IMN","JEY",
4371
+ "BLM","MAF", "BES", "SSD", "O1"
4372
+ );
4373
+ public $GEOIP_COUNTRY_NAMES = array(
4374
+ "","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Curacao",
4375
+ "Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados",
4376
+ "Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia",
4377
+ "Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the",
4378
+ "Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica",
4379
+ "Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic",
4380
+ "Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji",
4381
+ "Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","Sint Maarten (Dutch part)","Gabon","United Kingdom","Grenada","Georgia","French Guiana",
4382
+ "Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala",
4383
+ "Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia",
4384
+ "Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan",
4385
+ "Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait",
4386
+ "Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania",
4387
+ "Luxembourg","Latvia","Libya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali",
4388
+ "Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives",
4389
+ "Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua",
4390
+ "Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia",
4391
+ "Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau",
4392
+ "Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan",
4393
+ "Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname",
4394
+ "Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand",
4395
+ "Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan",
4396
+ "Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela",
4397
+ "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa",
4398
+ "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey",
4399
+ "Saint Barthelemy","Saint Martin", "Bonaire, Saint Eustatius and Saba",
4400
+ "South Sudan", "Other"
4401
+ );
4402
+
4403
+ public $GEOIP_CONTINENT_CODES = array(
4404
+ "--", "AS","EU","EU","AS","AS","NA","NA","EU","AS","NA",
4405
+ "AF","AN","SA","OC","EU","OC","NA","AS","EU","NA",
4406
+ "AS","EU","AF","EU","AS","AF","AF","NA","AS","SA",
4407
+ "SA","NA","AS","AN","AF","EU","NA","NA","AS","AF",
4408
+ "AF","AF","EU","AF","OC","SA","AF","AS","SA","NA",
4409
+ "NA","AF","AS","AS","EU","EU","AF","EU","NA","NA",
4410
+ "AF","SA","EU","AF","AF","AF","EU","AF","EU","OC",
4411
+ "SA","OC","EU","EU","NA","AF","EU","NA","AS","SA",
4412
+ "AF","EU","NA","AF","AF","NA","AF","EU","AN","NA",
4413
+ "OC","AF","SA","AS","AN","NA","EU","NA","EU","AS",
4414
+ "EU","AS","AS","AS","AS","AS","EU","EU","NA","AS",
4415
+ "AS","AF","AS","AS","OC","AF","NA","AS","AS","AS",
4416
+ "NA","AS","AS","AS","NA","EU","AS","AF","AF","EU",
4417
+ "EU","EU","AF","AF","EU","EU","AF","OC","EU","AF",
4418
+ "AS","AS","AS","OC","NA","AF","NA","EU","AF","AS",
4419
+ "AF","NA","AS","AF","AF","OC","AF","OC","AF","NA",
4420
+ "EU","EU","AS","OC","OC","OC","AS","NA","SA","OC",
4421
+ "OC","AS","AS","EU","NA","OC","NA","AS","EU","OC",
4422
+ "SA","AS","AF","EU","EU","AF","AS","OC","AF","AF",
4423
+ "EU","AS","AF","EU","EU","EU","AF","EU","AF","AF",
4424
+ "SA","AF","NA","AS","AF","NA","AF","AN","AF","AS",
4425
+ "AS","OC","AS","AF","OC","AS","EU","NA","OC","AS",
4426
+ "AF","EU","AF","OC","NA","SA","AS","EU","NA","SA",
4427
+ "NA","NA","AS","OC","OC","OC","AS","AF","EU","AF",
4428
+ "AF","EU","AF","--","--","--","EU","EU","EU","EU",
4429
+ "NA","NA","NA", "AF", "--"
4430
+ );
4431
+
4432
+ private $filename = '';
4433
+
4434
+ public function __construct()
4435
+ {
4436
+ $this->filename = Mage::getBaseDir() . "/lib/MaxMind/GeoIP/data/" . Mage::getStoreConfig('opc/geo/city_file');
4437
+ $this->geoip_open(self::GEOIP_STANDARD);
4438
+ }
4439
+
4440
+ public function geoip_load_shared_mem ($file) {
4441
+
4442
+ $fp = fopen($file, "rb");
4443
+ if (!$fp) {
4444
+ print "error opening $file: $php_errormsg\n";
4445
+ exit;
4446
+ }
4447
+ $s_array = fstat($fp);
4448
+ $size = $s_array['size'];
4449
+ if ($this->shmid = @shmop_open (self::GEOIP_SHM_KEY, "w", 0, 0)) {
4450
+ shmop_delete ($this->shmid);
4451
+ shmop_close ($this->shmid);
4452
+ }
4453
+ $this->shmid = shmop_open (self::GEOIP_SHM_KEY, "c", 0644, $size);
4454
+ shmop_write ($this->shmid, fread($fp, $size), 0);
4455
+ shmop_close ($this->shmid);
4456
+ }
4457
+
4458
+ public function _setup_segments() {
4459
+ $this->databaseType = self::GEOIP_COUNTRY_EDITION;
4460
+ $this->record_length = self::STANDARD_RECORD_LENGTH;
4461
+ if ($this->flags & self::GEOIP_SHARED_MEMORY) {
4462
+ $offset = @shmop_size ($this->shmid) - 3;
4463
+ for ($i = 0; $i < self::STRUCTURE_INFO_MAX_SIZE; $i++) {
4464
+ $delim = @shmop_read ($this->shmid, $offset, 3);
4465
+ $offset += 3;
4466
+ if ($delim == (chr(255).chr(255).chr(255))) {
4467
+ $this->databaseType = ord(@shmop_read ($this->shmid, $offset, 1));
4468
+ $offset++;
4469
+
4470
+ if ($this->databaseType == self::GEOIP_REGION_EDITION_REV0) {
4471
+ $this->databaseSegments = self::GEOIP_STATE_BEGIN_REV0;
4472
+ } else if ($this->databaseType == self::GEOIP_REGION_EDITION_REV1) {
4473
+ $this->databaseSegments = self::GEOIP_STATE_BEGIN_REV1;
4474
+ } else if (($this->databaseType == self::GEOIP_CITY_EDITION_REV0)||
4475
+ ($this->databaseType == self::GEOIP_CITY_EDITION_REV1)
4476
+ || ($this->databaseType == self::GEOIP_ORG_EDITION)
4477
+ || ($this->databaseType == self::GEOIP_ORG_EDITION_V6)
4478
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION)
4479
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION_V6)
4480
+ || ($this->databaseType == self::GEOIP_ISP_EDITION)
4481
+ || ($this->databaseType == self::GEOIP_ISP_EDITION_V6)
4482
+ || ($this->databaseType == self::GEOIP_USERTYPE_EDITION)
4483
+ || ($this->databaseType == self::GEOIP_USERTYPE_EDITION_V6)
4484
+ || ($this->databaseType == self::GEOIP_LOCATIONA_EDITION)
4485
+ || ($this->databaseType == self::GEOIP_ACCURACYRADIUS_EDITION)
4486
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV0_V6)
4487
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV1_V6)
4488
+ || ($this->databaseType == self::GEOIP_NETSPEED_EDITION_REV1)
4489
+ || ($this->databaseType == self::GEOIP_NETSPEED_EDITION_REV1_V6)
4490
+ || ($this->databaseType == self::GEOIP_ASNUM_EDITION)
4491
+ || ($this->databaseType == self::GEOIP_ASNUM_EDITION_V6)) {
4492
+ $this->databaseSegments = 0;
4493
+ $buf = @shmop_read ($this->shmid, $offset, self::SEGMENT_RECORD_LENGTH);
4494
+ for ($j = 0;$j < self::SEGMENT_RECORD_LENGTH;$j++) {
4495
+ $this->databaseSegments += (ord($buf[$j]) << ($j * 8));
4496
+ }
4497
+ if (($this->databaseType == self::GEOIP_ORG_EDITION)
4498
+ || ($this->databaseType == self::GEOIP_ORG_EDITION_V6)
4499
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION)
4500
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION_V6)
4501
+ || ($this->databaseType == self::GEOIP_ISP_EDITION)
4502
+ || ($this->databaseType == self::GEOIP_ISP_EDITION_V6)) {
4503
+ $this->record_length = self::ORG_RECORD_LENGTH;
4504
+ }
4505
+ }
4506
+ break;
4507
+ } else {
4508
+ $offset -= 4;
4509
+ }
4510
+ }
4511
+ if (($this->databaseType == self::GEOIP_COUNTRY_EDITION)||
4512
+ ($this->databaseType == self::GEOIP_COUNTRY_EDITION_V6)||
4513
+ ($this->databaseType == self::GEOIP_PROXY_EDITION)||
4514
+ ($this->databaseType == self::GEOIP_NETSPEED_EDITION)) {
4515
+ $this->databaseSegments = self::GEOIP_COUNTRY_BEGIN;
4516
+ }
4517
+ } else {
4518
+ $filepos = ftell($this->filehandle);
4519
+ fseek($this->filehandle, -3, SEEK_END);
4520
+ for ($i = 0; $i < self::STRUCTURE_INFO_MAX_SIZE; $i++) {
4521
+ $delim = fread($this->filehandle,3);
4522
+ if ($delim == (chr(255).chr(255).chr(255))) {
4523
+ $this->databaseType = ord(fread($this->filehandle,1));
4524
+ if ($this->databaseType == self::GEOIP_REGION_EDITION_REV0) {
4525
+ $this->databaseSegments = self::GEOIP_STATE_BEGIN_REV0;
4526
+ }
4527
+ else if ($this->databaseType == self::GEOIP_REGION_EDITION_REV1) {
4528
+ $this->databaseSegments = self::GEOIP_STATE_BEGIN_REV1;
4529
+ } else if (($this->databaseType == self::GEOIP_CITY_EDITION_REV0)
4530
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV1)
4531
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV0_V6)
4532
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV1_V6)
4533
+ || ($this->databaseType == self::GEOIP_ORG_EDITION)
4534
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION)
4535
+ || ($this->databaseType == self::GEOIP_ISP_EDITION)
4536
+ || ($this->databaseType == self::GEOIP_ORG_EDITION_V6)
4537
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION_V6)
4538
+ || ($this->databaseType == self::GEOIP_ISP_EDITION_V6)
4539
+ || ($this->databaseType == self::GEOIP_LOCATIONA_EDITION)
4540
+ || ($this->databaseType == self::GEOIP_ACCURACYRADIUS_EDITION)
4541
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV0_V6)
4542
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV1_V6)
4543
+ || ($this->databaseType == self::GEOIP_NETSPEED_EDITION_REV1)
4544
+ || ($this->databaseType == self::GEOIP_NETSPEED_EDITION_REV1_V6)
4545
+ || ($this->databaseType == self::GEOIP_USERTYPE_EDITION)
4546
+ || ($this->databaseType == self::GEOIP_USERTYPE_EDITION_V6)
4547
+ || ($this->databaseType == self::GEOIP_ASNUM_EDITION)
4548
+ || ($this->databaseType == self::GEOIP_ASNUM_EDITION_V6)) {
4549
+ $this->databaseSegments = 0;
4550
+ $buf = fread($this->filehandle,self::SEGMENT_RECORD_LENGTH);
4551
+ for ($j = 0;$j < self::SEGMENT_RECORD_LENGTH;$j++) {
4552
+ $this->databaseSegments += (ord($buf[$j]) << ($j * 8));
4553
+ }
4554
+ if ( ( $this->databaseType == self::GEOIP_ORG_EDITION )
4555
+ || ( $this->databaseType == self::GEOIP_DOMAIN_EDITION )
4556
+ || ( $this->databaseType == self::GEOIP_ISP_EDITION )
4557
+ || ( $this->databaseType == self::GEOIP_ORG_EDITION_V6 )
4558
+ || ( $this->databaseType == self::GEOIP_DOMAIN_EDITION_V6 )
4559
+ || ( $this->databaseType == self::GEOIP_ISP_EDITION_V6 )) {
4560
+ $this->record_length = self::ORG_RECORD_LENGTH;
4561
+ }
4562
+ }
4563
+ break;
4564
+ } else {
4565
+ fseek($this->filehandle, -4, SEEK_CUR);
4566
+ }
4567
+ }
4568
+ if (($this->databaseType == self::GEOIP_COUNTRY_EDITION)||
4569
+ ($this->databaseType == self::GEOIP_COUNTRY_EDITION_V6)||
4570
+ ($this->databaseType == self::GEOIP_PROXY_EDITION)||
4571
+ ($this->databaseType == self::GEOIP_NETSPEED_EDITION)) {
4572
+ $this->databaseSegments = self::GEOIP_COUNTRY_BEGIN;
4573
+ }
4574
+ fseek($this->filehandle,$filepos,SEEK_SET);
4575
+ }
4576
+ }
4577
+
4578
+ public function geoip_open($flags) {
4579
+ $this->flags = $flags;
4580
+ if ($this->flags & self::GEOIP_SHARED_MEMORY) {
4581
+ $this->shmid = @shmop_open (self::GEOIP_SHM_KEY, "a", 0, 0);
4582
+ } else {
4583
+ $this->filehandle = fopen($this->filename,"rb") or die("Can not open $this->filename\n" );
4584
+ if ($this->flags & self::GEOIP_MEMORY_CACHE) {
4585
+ $s_array = fstat($this->filehandle);
4586
+ $this->memory_buffer = fread($this->filehandle, $s_array['size']);
4587
+ }
4588
+ }
4589
+
4590
+ $this->_setup_segments();
4591
+ }
4592
+
4593
+ public function geoip_close() {
4594
+ if ($this->flags & self::GEOIP_SHARED_MEMORY) {
4595
+ return true;
4596
+ }
4597
+
4598
+ return fclose($this->filehandle);
4599
+ }
4600
+
4601
+ public function geoip_country_id_by_name_v6($name) {
4602
+ $rec = $this->dns_get_record($name, DNS_AAAA);
4603
+ if ( !$rec ) {
4604
+ return false;
4605
+ }
4606
+ $addr = $rec[0]["ipv6"];
4607
+ if (!$addr || $addr == $name) {
4608
+ return false;
4609
+ }
4610
+ return $this->geoip_country_id_by_addr_v6($addr);
4611
+ }
4612
+
4613
+ public function geoip_country_id_by_name($name) {
4614
+ $addr = gethostbyname($name);
4615
+ if (!$addr || $addr == $name) {
4616
+ return false;
4617
+ }
4618
+ return $this->geoip_country_id_by_addr($addr);
4619
+ }
4620
+
4621
+ public function geoip_country_code_by_name_v6($name) {
4622
+ $country_id = $this->geoip_country_id_by_name_v6($name);
4623
+ if ($country_id !== false) {
4624
+ return $this->GEOIP_COUNTRY_CODES[$country_id];
4625
+ }
4626
+ return false;
4627
+ }
4628
+
4629
+ public function geoip_country_code_by_name($name) {
4630
+ $country_id = $this->geoip_country_id_by_name($name);
4631
+ if ($country_id !== false) {
4632
+ return $this->GEOIP_COUNTRY_CODES[$country_id];
4633
+ }
4634
+ return false;
4635
+ }
4636
+
4637
+ public function geoip_country_name_by_name_v6($name) {
4638
+ $country_id = $this->geoip_country_id_by_name_v6($name);
4639
+ if ($country_id !== false) {
4640
+ return $this->GEOIP_COUNTRY_NAMES[$country_id];
4641
+ }
4642
+ return false;
4643
+ }
4644
+
4645
+ public function geoip_country_name_by_name($name) {
4646
+ $country_id = $this->geoip_country_id_by_name($name);
4647
+ if ($country_id !== false) {
4648
+ return $this->GEOIP_COUNTRY_NAMES[$country_id];
4649
+ }
4650
+ return false;
4651
+ }
4652
+
4653
+ public function geoip_country_id_by_addr_v6($addr) {
4654
+ $ipnum = inet_pton($addr);
4655
+ return $this->_geoip_seek_country_v6($ipnum) - self::GEOIP_COUNTRY_BEGIN;
4656
+ }
4657
+
4658
+ public function geoip_country_id_by_addr($addr) {
4659
+ $ipnum = ip2long($addr);
4660
+ return $this->_geoip_seek_country($ipnum) - self::GEOIP_COUNTRY_BEGIN;
4661
+ }
4662
+
4663
+ public function geoip_country_code_by_addr_v6($addr) {
4664
+ $country_id = $this->geoip_country_id_by_addr_v6($addr);
4665
+ if ($country_id !== false) {
4666
+ return $this->GEOIP_COUNTRY_CODES[$country_id];
4667
+ }
4668
+ return false;
4669
+ }
4670
+
4671
+ public function geoip_country_code_by_addr($addr) {
4672
+ if ($this->databaseType == self::GEOIP_CITY_EDITION_REV1) {
4673
+ $record = $this->geoip_record_by_addr($addr);
4674
+ if ( $record !== false ) {
4675
+ return $record->country_code;
4676
+ }
4677
+ } else {
4678
+ $country_id = $this->geoip_country_id_by_addr($addr);
4679
+ if ($country_id !== false) {
4680
+ return $this->GEOIP_COUNTRY_CODES[$country_id];
4681
+ }
4682
+ }
4683
+ return false;
4684
+ }
4685
+
4686
+ public function geoip_country_name_by_addr_v6($addr) {
4687
+ $country_id = $this->geoip_country_id_by_addr_v6($addr);
4688
+ if ($country_id !== false) {
4689
+ return $this->GEOIP_COUNTRY_NAMES[$country_id];
4690
+ }
4691
+ return false;
4692
+ }
4693
+
4694
+ public function geoip_country_name_by_addr($addr) {
4695
+ if ($this->databaseType == self::GEOIP_CITY_EDITION_REV1) {
4696
+ $record = $this->geoip_record_by_addr($addr);
4697
+ return $record->country_name;
4698
+ } else {
4699
+ $country_id = $this->geoip_country_id_by_addr($addr);
4700
+ if ($country_id !== false) {
4701
+ return $this->GEOIP_COUNTRY_NAMES[$country_id];
4702
+ }
4703
+ }
4704
+ return false;
4705
+ }
4706
+
4707
+ public function _geoip_seek_country_v6($ipnum) {
4708
+
4709
+ # arrays from unpack start with offset 1
4710
+ # yet another php mystery. array_merge work around
4711
+ # this broken behaviour
4712
+ $v6vec = array_merge(unpack( "C16", $ipnum));
4713
+
4714
+ $offset = 0;
4715
+ for ($depth = 127; $depth >= 0; --$depth) {
4716
+ if ($this->flags & self::GEOIP_MEMORY_CACHE) {
4717
+ // workaround php's broken substr, strpos, etc handling with
4718
+ // mbstring.func_overload and mbstring.internal_encoding
4719
+ $enc = mb_internal_encoding();
4720
+ mb_internal_encoding('ISO-8859-1');
4721
+
4722
+ $buf = substr($this->memory_buffer,
4723
+ 2 * $this->record_length * $offset,
4724
+ 2 * $this->record_length);
4725
+
4726
+ mb_internal_encoding($enc);
4727
+ } elseif ($this->flags & self::GEOIP_SHARED_MEMORY) {
4728
+ $buf = @shmop_read ($this->shmid,
4729
+ 2 * $this->record_length * $offset,
4730
+ 2 * $this->record_length );
4731
+ } else {
4732
+ fseek($this->filehandle, 2 * $this->record_length * $offset, SEEK_SET) == 0
4733
+ or die("fseek failed");
4734
+ $buf = fread($this->filehandle, 2 * $this->record_length);
4735
+ }
4736
+ $x = array(0,0);
4737
+ for ($i = 0; $i < 2; ++$i) {
4738
+ for ($j = 0; $j < $this->record_length; ++$j) {
4739
+ $x[$i] += ord($buf[$this->record_length * $i + $j]) << ($j * 8);
4740
+ }
4741
+ }
4742
+
4743
+ $bnum = 127 - $depth;
4744
+ $idx = $bnum >> 3;
4745
+ $b_mask = 1 << ( $bnum & 7 ^ 7 );
4746
+ if (($v6vec[$idx] & $b_mask) > 0) {
4747
+ if ($x[1] >= $this->databaseSegments) {
4748
+ return $x[1];
4749
+ }
4750
+ $offset = $x[1];
4751
+ } else {
4752
+ if ($x[0] >= $this->databaseSegments) {
4753
+ return $x[0];
4754
+ }
4755
+ $offset = $x[0];
4756
+ }
4757
+ }
4758
+ trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR);
4759
+ return false;
4760
+ }
4761
+
4762
+ public function _geoip_seek_country($ipnum) {
4763
+ $offset = 0;
4764
+ for ($depth = 31; $depth >= 0; --$depth) {
4765
+ if ($this->flags & self::GEOIP_MEMORY_CACHE) {
4766
+ // workaround php's broken substr, strpos, etc handling with
4767
+ // mbstring.func_overload and mbstring.internal_encoding
4768
+ $enc = mb_internal_encoding();
4769
+ mb_internal_encoding('ISO-8859-1');
4770
+
4771
+ $buf = substr($this->memory_buffer,
4772
+ 2 * $this->record_length * $offset,
4773
+ 2 * $this->record_length);
4774
+
4775
+ mb_internal_encoding($enc);
4776
+ } elseif ($this->flags & self::GEOIP_SHARED_MEMORY) {
4777
+ $buf = @shmop_read ($this->shmid,
4778
+ 2 * $this->record_length * $offset,
4779
+ 2 * $this->record_length );
4780
+ } else {
4781
+ fseek($this->filehandle, 2 * $this->record_length * $offset, SEEK_SET) == 0
4782
+ or die("fseek failed");
4783
+ $buf = fread($this->filehandle, 2 * $this->record_length);
4784
+ }
4785
+ $x = array(0,0);
4786
+ for ($i = 0; $i < 2; ++$i) {
4787
+ for ($j = 0; $j < $this->record_length; ++$j) {
4788
+ $x[$i] += ord($buf[$this->record_length * $i + $j]) << ($j * 8);
4789
+ }
4790
+ }
4791
+ if ($ipnum & (1 << $depth)) {
4792
+ if ($x[1] >= $this->databaseSegments) {
4793
+ return $x[1];
4794
+ }
4795
+ $offset = $x[1];
4796
+ } else {
4797
+ if ($x[0] >= $this->databaseSegments) {
4798
+ return $x[0];
4799
+ }
4800
+ $offset = $x[0];
4801
+ }
4802
+ }
4803
+ trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR);
4804
+ return false;
4805
+ }
4806
+
4807
+ public function _common_get_org($seek_org) {
4808
+ $record_pointer = $seek_org + (2 * $this->record_length - 1) * $this->databaseSegments;
4809
+ if ($this->flags & self::GEOIP_SHARED_MEMORY) {
4810
+ $org_buf = @shmop_read ($this->shmid, $record_pointer, self::MAX_ORG_RECORD_LENGTH);
4811
+ } else {
4812
+ fseek($this->filehandle, $record_pointer, SEEK_SET);
4813
+ $org_buf = fread($this->filehandle,self::MAX_ORG_RECORD_LENGTH);
4814
+ }
4815
+ // workaround php's broken substr, strpos, etc handling with
4816
+ // mbstring.func_overload and mbstring.internal_encoding
4817
+ $enc = mb_internal_encoding();
4818
+ mb_internal_encoding('ISO-8859-1');
4819
+ $org_buf = substr($org_buf, 0, strpos($org_buf, "\0"));
4820
+ mb_internal_encoding($enc);
4821
+ return $org_buf;
4822
+ }
4823
+
4824
+ public function _get_org_v6($ipnum) {
4825
+ $seek_org = _geoip_seek_country_v6($ipnum);
4826
+ if ($seek_org == $this->databaseSegments) {
4827
+ return NULL;
4828
+ }
4829
+ return $this->_common_get_org($seek_org);
4830
+ }
4831
+
4832
+ public function _get_org($ipnum) {
4833
+ $seek_org = $this->_geoip_seek_country($ipnum);
4834
+ if ($seek_org == $this->databaseSegments) {
4835
+ return NULL;
4836
+ }
4837
+ return $this->_common_get_org($seek_org);
4838
+ }
4839
+
4840
+ public function geoip_name_by_addr_v6 ($addr) {
4841
+ if ($addr == NULL) {
4842
+ return 0;
4843
+ }
4844
+ $ipnum = inet_pton($addr);
4845
+ return $this->_get_org_v6($ipnum);
4846
+ }
4847
+
4848
+ public function geoip_name_by_addr ($addr) {
4849
+ if ($addr == NULL) {
4850
+ return 0;
4851
+ }
4852
+ $ipnum = ip2long($addr);
4853
+ return $this->_get_org($ipnum);
4854
+ }
4855
+
4856
+ public function geoip_org_by_addr ($addr) {
4857
+ return $this->geoip_name_by_addr($addr);
4858
+ }
4859
+
4860
+ public function _get_region($ipnum) {
4861
+ if ($this->databaseType == self::GEOIP_REGION_EDITION_REV0) {
4862
+ $seek_region = $this->_geoip_seek_country($ipnum) - self::GEOIP_STATE_BEGIN_REV0;
4863
+ if ($seek_region >= 1000) {
4864
+ $country_code = "US";
4865
+ $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65);
4866
+ } else {
4867
+ $country_code = $this->GEOIP_COUNTRY_CODES[$seek_region];
4868
+ $region = "";
4869
+ }
4870
+ return array ($country_code,$region);
4871
+ } else if ($this->databaseType == self::GEOIP_REGION_EDITION_REV1) {
4872
+ $seek_region = _geoip_seek_country($ipnum) - self::GEOIP_STATE_BEGIN_REV1;
4873
+ //print $seek_region;
4874
+ if ($seek_region < self::US_OFFSET) {
4875
+ $country_code = "";
4876
+ $region = "";
4877
+ } else if ($seek_region < self::CANADA_OFFSET) {
4878
+ $country_code = "US";
4879
+ $region = chr(($seek_region - self::US_OFFSET)/26 + 65) . chr(($seek_region - self::US_OFFSET)%26 + 65);
4880
+ } else if ($seek_region < self::WORLD_OFFSET) {
4881
+ $country_code = "CA";
4882
+ $region = chr(($seek_region - self::CANADA_OFFSET)/26 + 65) . chr(($seek_region - self::CANADA_OFFSET)%26 + 65);
4883
+ } else {
4884
+ $country_code = $this->GEOIP_COUNTRY_CODES[($seek_region - self::WORLD_OFFSET) / self::FIPS_RANGE];
4885
+ $region = "";
4886
+ }
4887
+ return array ($country_code,$region);
4888
+ }
4889
+ }
4890
+
4891
+ public function geoip_region_by_addr ($addr) {
4892
+ if ($addr == NULL) {
4893
+ return 0;
4894
+ }
4895
+ $ipnum = ip2long($addr);
4896
+ return $this->_get_region($ipnum);
4897
+ }
4898
+
4899
+ public function getdnsattributes ($l,$ip) {
4900
+ $r = new Net_DNS_Resolver();
4901
+ $r->nameservers = array("ws1.maxmind.com");
4902
+ $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN");
4903
+ $str = is_object($p->answer[0])?$p->answer[0]->string():'';
4904
+ $str = substr($str, 1, -1 );
4905
+ return $str;
4906
+ }
4907
+
4908
+ public function getrecordwithdnsservice($str) {
4909
+ $record = new GeoIpDNSRecord();
4910
+ $keyvalue = explode(";",$str);
4911
+ foreach ($keyvalue as $keyvalue2) {
4912
+ list($key,$value) = explode("=",$keyvalue2);
4913
+ if ($key == "co") {
4914
+ $record->country_code = $value;
4915
+ }
4916
+ if ($key == "ci") {
4917
+ $record->city = $value;
4918
+ }
4919
+ if ($key == "re") {
4920
+ $record->region = $value;
4921
+ }
4922
+ if ($key == "ac") {
4923
+ $record->areacode = $value;
4924
+ }
4925
+ if ($key == "dm" || $key == "me" ) {
4926
+ $record->dmacode = $value;
4927
+ $record->metrocode = $value;
4928
+ }
4929
+ if ($key == "is") {
4930
+ $record->isp = $value;
4931
+ }
4932
+ if ($key == "or") {
4933
+ $record->org = $value;
4934
+ }
4935
+ if ($key == "zi") {
4936
+ $record->postal_code = $value;
4937
+ }
4938
+ if ($key == "la") {
4939
+ $record->latitude = $value;
4940
+ }
4941
+ if ($key == "lo") {
4942
+ $record->longitude = $value;
4943
+ }
4944
+ }
4945
+ $number = $GLOBALS['GEOIP_COUNTRY_CODE_TO_NUMBER'][$record->country_code];
4946
+ $record->country_code3 = $GLOBALS['GEOIP_COUNTRY_CODES3'][$number];
4947
+ $record->country_name = $GLOBALS['GEOIP_COUNTRY_NAMES'][$number];
4948
+ if ($record->region != "") {
4949
+ if (($record->country_code == "US") || ($record->country_code == "CA")) {
4950
+ $record->regionname = $GLOBALS['ISO'][$record->country_code][$record->region];
4951
+ } else {
4952
+ $record->regionname = $GLOBALS['FIPS'][$record->country_code][$record->region];
4953
+ }
4954
+ }
4955
+ return $record;
4956
+ }
4957
+
4958
+
4959
+ public function _get_record_v6($ipnum) {
4960
+ $seek_country = $this->_geoip_seek_country_v6($ipnum);
4961
+ if ($seek_country == $this->databaseSegments) {
4962
+ return NULL;
4963
+ }
4964
+ return $this->_common_get_record($seek_country);
4965
+ }
4966
+
4967
+ public function _common_get_record($seek_country) {
4968
+ // workaround php's broken substr, strpos, etc handling with
4969
+ // mbstring.func_overload and mbstring.internal_encoding
4970
+ $enc = mb_internal_encoding();
4971
+ mb_internal_encoding('ISO-8859-1');
4972
+
4973
+ $record_pointer = $seek_country + (2 * $this->record_length - 1) * $this->databaseSegments;
4974
+
4975
+ if ($this->flags & self::GEOIP_MEMORY_CACHE) {
4976
+ $record_buf = substr($this->memory_buffer,$record_pointer,self::FULL_RECORD_LENGTH);
4977
+ } elseif ($this->flags & self::GEOIP_SHARED_MEMORY) {
4978
+ $record_buf = @shmop_read($this->shmid,$record_pointer,self::FULL_RECORD_LENGTH);
4979
+ } else {
4980
+ fseek($this->filehandle, $record_pointer, SEEK_SET);
4981
+ $record_buf = fread($this->filehandle,self::FULL_RECORD_LENGTH);
4982
+ }
4983
+ $record = new GeoIpRecord();
4984
+ $record_buf_pos = 0;
4985
+ $char = ord(substr($record_buf,$record_buf_pos,1));
4986
+ $record->country_code = $this->GEOIP_COUNTRY_CODES[$char];
4987
+ $record->country_code3 = $this->GEOIP_COUNTRY_CODES3[$char];
4988
+ $record->country_name = $this->GEOIP_COUNTRY_NAMES[$char];
4989
+ $record->continent_code = $this->GEOIP_CONTINENT_CODES[$char];
4990
+ $record_buf_pos++;
4991
+ $str_length = 0;
4992
+ // Get region
4993
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
4994
+ while ($char != 0) {
4995
+ $str_length++;
4996
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
4997
+ }
4998
+ if ($str_length > 0) {
4999
+ $record->region = substr($record_buf,$record_buf_pos,$str_length);
5000
+ }
5001
+ $record_buf_pos += $str_length + 1;
5002
+ $str_length = 0;
5003
+ // Get city
5004
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
5005
+ while ($char != 0) {
5006
+ $str_length++;
5007
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
5008
+ }
5009
+ if ($str_length > 0) {
5010
+ $record->city = substr($record_buf,$record_buf_pos,$str_length);
5011
+ }
5012
+ $record_buf_pos += $str_length + 1;
5013
+ $str_length = 0;
5014
+ // Get postal code
5015
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
5016
+ while ($char != 0) {
5017
+ $str_length++;
5018
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
5019
+ }
5020
+ if ($str_length > 0) {
5021
+ $record->postal_code = substr($record_buf,$record_buf_pos,$str_length);
5022
+ }
5023
+ $record_buf_pos += $str_length + 1;
5024
+ $str_length = 0;
5025
+ // Get latitude and longitude
5026
+ $latitude = 0;
5027
+ $longitude = 0;
5028
+ for ($j = 0;$j < 3; ++$j) {
5029
+ $char = ord(substr($record_buf,$record_buf_pos++,1));
5030
+ $latitude += ($char << ($j * 8));
5031
+ }
5032
+ $record->latitude = ($latitude/10000) - 180;
5033
+ for ($j = 0;$j < 3; ++$j) {
5034
+ $char = ord(substr($record_buf,$record_buf_pos++,1));
5035
+ $longitude += ($char << ($j * 8));
5036
+ }
5037
+ $record->longitude = ($longitude/10000) - 180;
5038
+ if (self::GEOIP_CITY_EDITION_REV1 == $this->databaseType) {
5039
+ $metroarea_combo = 0;
5040
+ if ($record->country_code == "US") {
5041
+ for ($j = 0;$j < 3;++$j) {
5042
+ $char = ord(substr($record_buf,$record_buf_pos++,1));
5043
+ $metroarea_combo += ($char << ($j * 8));
5044
+ }
5045
+ $record->metro_code = $record->dma_code = floor($metroarea_combo/1000);
5046
+ $record->area_code = $metroarea_combo%1000;
5047
+ }
5048
+ }
5049
+ mb_internal_encoding($enc);
5050
+ return $record;
5051
+ }
5052
+
5053
+ public function geoip_record_by_addr_v6 ($addr) {
5054
+ if ($addr == NULL) {
5055
+ return 0;
5056
+ }
5057
+ $ipnum = inet_pton($addr);
5058
+ return $this->_get_record_v6($ipnum);
5059
+ }
5060
+
5061
+ public function _get_record($ipnum) {
5062
+ $seek_country = $this->_geoip_seek_country($ipnum);
5063
+ if ($seek_country == $this->databaseSegments) {
5064
+ return NULL;
5065
+ }
5066
+ return $this->_common_get_record($seek_country);
5067
+ }
5068
+
5069
+ public function geoip_record_by_addr($addr) {
5070
+ if ($addr == NULL) {
5071
+ return 0;
5072
+ }
5073
+ $ipnum = ip2long($addr);
5074
+
5075
+ return $this->_get_record($ipnum);
5076
+ }
5077
+
5078
+ public function get(){
5079
+
5080
+ $customerIp = Mage::helper('core/http')->getRemoteAddr(false);
5081
+
5082
+ if ($customerIp == '127.0.0.1'){
5083
+ $ip = "96.30.30.149"; //Mage::helper('core/http')->getRemoteAddr(true);
5084
+ }else{
5085
+ $ip = $customerIp;
5086
+ }
5087
+
5088
+ $record = $this->geoip_record_by_addr($ip);
5089
+ if (is_object($record)){
5090
+ return $record->city;
5091
+ }
5092
+ return false;
5093
+ }
5094
+
5095
+ }
5096
+
5097
+
5098
+
app/code/community/Abserve/Opc/Helper/Country.php ADDED
@@ -0,0 +1,897 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Helper_Country {
3
+ const GEOIP_COUNTRY_BEGIN = 16776960;
4
+ const GEOIP_STATE_BEGIN_REV0 = 16700000;
5
+ const GEOIP_STATE_BEGIN_REV1 = 16000000;
6
+ const GEOIP_STANDARD = 0;
7
+ const GEOIP_MEMORY_CACHE = 1;
8
+ const GEOIP_SHARED_MEMORY = 2;
9
+ const STRUCTURE_INFO_MAX_SIZE = 20;
10
+ const DATABASE_INFO_MAX_SIZE = 100;
11
+ const GEOIP_COUNTRY_EDITION = 106;
12
+ const GEOIP_PROXY_EDITION = 8;
13
+ const GEOIP_ASNUM_EDITION = 9;
14
+ const GEOIP_NETSPEED_EDITION = 10;
15
+ const GEOIP_REGION_EDITION_REV0 = 112;
16
+ const GEOIP_REGION_EDITION_REV1 = 3;
17
+ const GEOIP_CITY_EDITION_REV0 = 111;
18
+ const GEOIP_CITY_EDITION_REV1 = 2;
19
+ const GEOIP_ORG_EDITION = 110;
20
+ const GEOIP_ISP_EDITION = 4;
21
+ const SEGMENT_RECORD_LENGTH = 3;
22
+ const STANDARD_RECORD_LENGTH = 3;
23
+ const ORG_RECORD_LENGTH = 4;
24
+ const MAX_RECORD_LENGTH = 4;
25
+ const MAX_ORG_RECORD_LENGTH = 300;
26
+ const GEOIP_SHM_KEY = 0x4f415401;
27
+ const US_OFFSET = 1;
28
+ const CANADA_OFFSET = 677;
29
+ const WORLD_OFFSET = 1353;
30
+ const FIPS_RANGE = 360;
31
+ const GEOIP_UNKNOWN_SPEED = 0;
32
+ const GEOIP_DIALUP_SPEED = 1;
33
+ const GEOIP_CABLEDSL_SPEED = 2;
34
+ const GEOIP_CORPORATE_SPEED = 3;
35
+ const GEOIP_DOMAIN_EDITION = 11;
36
+ const GEOIP_COUNTRY_EDITION_V6 = 12;
37
+ const GEOIP_LOCATIONA_EDITION = 13;
38
+ const GEOIP_ACCURACYRADIUS_EDITION = 14;
39
+ const GEOIP_CITYCOMBINED_EDITION = 15;
40
+ const GEOIP_CITY_EDITION_REV1_V6 = 30;
41
+ const GEOIP_CITY_EDITION_REV0_V6 = 31;
42
+ const GEOIP_NETSPEED_EDITION_REV1 = 32;
43
+ const GEOIP_NETSPEED_EDITION_REV1_V6 = 33;
44
+ const GEOIP_USERTYPE_EDITION = 28;
45
+ const GEOIP_USERTYPE_EDITION_V6 = 29;
46
+ const GEOIP_ASNUM_EDITION_V6 = 21;
47
+ const GEOIP_ISP_EDITION_V6 = 22;
48
+ const GEOIP_ORG_EDITION_V6 = 23;
49
+ const GEOIP_DOMAIN_EDITION_V6 = 24;
50
+
51
+ const CITYCOMBINED_FIXED_RECORD = 7;
52
+
53
+ const FULL_RECORD_LENGTH = 50;
54
+
55
+ public $flags;
56
+ public $filehandle;
57
+ public $memory_buffer;
58
+ public $databaseType;
59
+ public $databaseSegments;
60
+ public $record_length;
61
+ public $shmid;
62
+ public $GEOIP_COUNTRY_CODE_TO_NUMBER = array(
63
+ "" => 0, "AP" => 1, "EU" => 2, "AD" => 3, "AE" => 4, "AF" => 5,
64
+ "AG" => 6, "AI" => 7, "AL" => 8, "AM" => 9, "CW" => 10, "AO" => 11,
65
+ "AQ" => 12, "AR" => 13, "AS" => 14, "AT" => 15, "AU" => 16, "AW" => 17,
66
+ "AZ" => 18, "BA" => 19, "BB" => 20, "BD" => 21, "BE" => 22, "BF" => 23,
67
+ "BG" => 24, "BH" => 25, "BI" => 26, "BJ" => 27, "BM" => 28, "BN" => 29,
68
+ "BO" => 30, "BR" => 31, "BS" => 32, "BT" => 33, "BV" => 34, "BW" => 35,
69
+ "BY" => 36, "BZ" => 37, "CA" => 38, "CC" => 39, "CD" => 40, "CF" => 41,
70
+ "CG" => 42, "CH" => 43, "CI" => 44, "CK" => 45, "CL" => 46, "CM" => 47,
71
+ "CN" => 48, "CO" => 49, "CR" => 50, "CU" => 51, "CV" => 52, "CX" => 53,
72
+ "CY" => 54, "CZ" => 55, "DE" => 56, "DJ" => 57, "DK" => 58, "DM" => 59,
73
+ "DO" => 60, "DZ" => 61, "EC" => 62, "EE" => 63, "EG" => 64, "EH" => 65,
74
+ "ER" => 66, "ES" => 67, "ET" => 68, "FI" => 69, "FJ" => 70, "FK" => 71,
75
+ "FM" => 72, "FO" => 73, "FR" => 74, "SX" => 75, "GA" => 76, "GB" => 77,
76
+ "GD" => 78, "GE" => 79, "GF" => 80, "GH" => 81, "GI" => 82, "GL" => 83,
77
+ "GM" => 84, "GN" => 85, "GP" => 86, "GQ" => 87, "GR" => 88, "GS" => 89,
78
+ "GT" => 90, "GU" => 91, "GW" => 92, "GY" => 93, "HK" => 94, "HM" => 95,
79
+ "HN" => 96, "HR" => 97, "HT" => 98, "HU" => 99, "ID" => 100, "IE" => 101,
80
+ "IL" => 102, "IN" => 103, "IO" => 104, "IQ" => 105, "IR" => 106, "IS" => 107,
81
+ "IT" => 108, "JM" => 109, "JO" => 110, "JP" => 111, "KE" => 112, "KG" => 113,
82
+ "KH" => 114, "KI" => 115, "KM" => 116, "KN" => 117, "KP" => 118, "KR" => 119,
83
+ "KW" => 120, "KY" => 121, "KZ" => 122, "LA" => 123, "LB" => 124, "LC" => 125,
84
+ "LI" => 126, "LK" => 127, "LR" => 128, "LS" => 129, "LT" => 130, "LU" => 131,
85
+ "LV" => 132, "LY" => 133, "MA" => 134, "MC" => 135, "MD" => 136, "MG" => 137,
86
+ "MH" => 138, "MK" => 139, "ML" => 140, "MM" => 141, "MN" => 142, "MO" => 143,
87
+ "MP" => 144, "MQ" => 145, "MR" => 146, "MS" => 147, "MT" => 148, "MU" => 149,
88
+ "MV" => 150, "MW" => 151, "MX" => 152, "MY" => 153, "MZ" => 154, "NA" => 155,
89
+ "NC" => 156, "NE" => 157, "NF" => 158, "NG" => 159, "NI" => 160, "NL" => 161,
90
+ "NO" => 162, "NP" => 163, "NR" => 164, "NU" => 165, "NZ" => 166, "OM" => 167,
91
+ "PA" => 168, "PE" => 169, "PF" => 170, "PG" => 171, "PH" => 172, "PK" => 173,
92
+ "PL" => 174, "PM" => 175, "PN" => 176, "PR" => 177, "PS" => 178, "PT" => 179,
93
+ "PW" => 180, "PY" => 181, "QA" => 182, "RE" => 183, "RO" => 184, "RU" => 185,
94
+ "RW" => 186, "SA" => 187, "SB" => 188, "SC" => 189, "SD" => 190, "SE" => 191,
95
+ "SG" => 192, "SH" => 193, "SI" => 194, "SJ" => 195, "SK" => 196, "SL" => 197,
96
+ "SM" => 198, "SN" => 199, "SO" => 200, "SR" => 201, "ST" => 202, "SV" => 203,
97
+ "SY" => 204, "SZ" => 205, "TC" => 206, "TD" => 207, "TF" => 208, "TG" => 209,
98
+ "TH" => 210, "TJ" => 211, "TK" => 212, "TM" => 213, "TN" => 214, "TO" => 215,
99
+ "TL" => 216, "TR" => 217, "TT" => 218, "TV" => 219, "TW" => 220, "TZ" => 221,
100
+ "UA" => 222, "UG" => 223, "UM" => 224, "US" => 225, "UY" => 226, "UZ" => 227,
101
+ "VA" => 228, "VC" => 229, "VE" => 230, "VG" => 231, "VI" => 232, "VN" => 233,
102
+ "VU" => 234, "WF" => 235, "WS" => 236, "YE" => 237, "YT" => 238, "RS" => 239,
103
+ "ZA" => 240, "ZM" => 241, "ME" => 242, "ZW" => 243, "A1" => 244, "A2" => 245,
104
+ "O1" => 246, "AX" => 247, "GG" => 248, "IM" => 249, "JE" => 250, "BL" => 251,
105
+ "MF" => 252, "BQ" => 253, "SS" => 254
106
+ );
107
+ public $GEOIP_COUNTRY_CODES = array(
108
+ "","AP","EU","AD","AE","AF","AG","AI","AL","AM","CW",
109
+ "AO","AQ","AR","AS","AT","AU","AW","AZ","BA","BB",
110
+ "BD","BE","BF","BG","BH","BI","BJ","BM","BN","BO",
111
+ "BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD",
112
+ "CF","CG","CH","CI","CK","CL","CM","CN","CO","CR",
113
+ "CU","CV","CX","CY","CZ","DE","DJ","DK","DM","DO",
114
+ "DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ",
115
+ "FK","FM","FO","FR","SX","GA","GB","GD","GE","GF",
116
+ "GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT",
117
+ "GU","GW","GY","HK","HM","HN","HR","HT","HU","ID",
118
+ "IE","IL","IN","IO","IQ","IR","IS","IT","JM","JO",
119
+ "JP","KE","KG","KH","KI","KM","KN","KP","KR","KW",
120
+ "KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT",
121
+ "LU","LV","LY","MA","MC","MD","MG","MH","MK","ML",
122
+ "MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV",
123
+ "MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI",
124
+ "NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF",
125
+ "PG","PH","PK","PL","PM","PN","PR","PS","PT","PW",
126
+ "PY","QA","RE","RO","RU","RW","SA","SB","SC","SD",
127
+ "SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO",
128
+ "SR","ST","SV","SY","SZ","TC","TD","TF","TG","TH",
129
+ "TJ","TK","TM","TN","TO","TL","TR","TT","TV","TW",
130
+ "TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE",
131
+ "VG","VI","VN","VU","WF","WS","YE","YT","RS","ZA",
132
+ "ZM","ME","ZW","A1","A2","O1","AX","GG","IM","JE",
133
+ "BL","MF", "BQ", "SS", "O1" );
134
+ public $GEOIP_COUNTRY_CODES3 = array(
135
+ "","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","CUW",
136
+ "AGO","ATA","ARG","ASM","AUT","AUS","ABW","AZE","BIH","BRB",
137
+ "BGD","BEL","BFA","BGR","BHR","BDI","BEN","BMU","BRN","BOL",
138
+ "BRA","BHS","BTN","BVT","BWA","BLR","BLZ","CAN","CCK","COD",
139
+ "CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI",
140
+ "CUB","CPV","CXR","CYP","CZE","DEU","DJI","DNK","DMA","DOM",
141
+ "DZA","ECU","EST","EGY","ESH","ERI","ESP","ETH","FIN","FJI",
142
+ "FLK","FSM","FRO","FRA","SXM","GAB","GBR","GRD","GEO","GUF",
143
+ "GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","SGS","GTM",
144
+ "GUM","GNB","GUY","HKG","HMD","HND","HRV","HTI","HUN","IDN",
145
+ "IRL","ISR","IND","IOT","IRQ","IRN","ISL","ITA","JAM","JOR",
146
+ "JPN","KEN","KGZ","KHM","KIR","COM","KNA","PRK","KOR","KWT",
147
+ "CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU",
148
+ "LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI",
149
+ "MMR","MNG","MAC","MNP","MTQ","MRT","MSR","MLT","MUS","MDV",
150
+ "MWI","MEX","MYS","MOZ","NAM","NCL","NER","NFK","NGA","NIC",
151
+ "NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER","PYF",
152
+ "PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW",
153
+ "PRY","QAT","REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN",
154
+ "SWE","SGP","SHN","SVN","SJM","SVK","SLE","SMR","SEN","SOM",
155
+ "SUR","STP","SLV","SYR","SWZ","TCA","TCD","ATF","TGO","THA",
156
+ "TJK","TKL","TKM","TUN","TON","TLS","TUR","TTO","TUV","TWN",
157
+ "TZA","UKR","UGA","UMI","USA","URY","UZB","VAT","VCT","VEN",
158
+ "VGB","VIR","VNM","VUT","WLF","WSM","YEM","MYT","SRB","ZAF",
159
+ "ZMB","MNE","ZWE","A1","A2","O1","ALA","GGY","IMN","JEY",
160
+ "BLM","MAF", "BES", "SSD", "O1"
161
+ );
162
+ public $GEOIP_COUNTRY_NAMES = array(
163
+ "","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Curacao",
164
+ "Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados",
165
+ "Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia",
166
+ "Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the",
167
+ "Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica",
168
+ "Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic",
169
+ "Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji",
170
+ "Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","Sint Maarten (Dutch part)","Gabon","United Kingdom","Grenada","Georgia","French Guiana",
171
+ "Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala",
172
+ "Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia",
173
+ "Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan",
174
+ "Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait",
175
+ "Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania",
176
+ "Luxembourg","Latvia","Libya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali",
177
+ "Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives",
178
+ "Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua",
179
+ "Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia",
180
+ "Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau",
181
+ "Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan",
182
+ "Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname",
183
+ "Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand",
184
+ "Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan",
185
+ "Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela",
186
+ "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa",
187
+ "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey",
188
+ "Saint Barthelemy","Saint Martin", "Bonaire, Saint Eustatius and Saba",
189
+ "South Sudan", "Other"
190
+ );
191
+
192
+ public $GEOIP_CONTINENT_CODES = array(
193
+ "--", "AS","EU","EU","AS","AS","NA","NA","EU","AS","NA",
194
+ "AF","AN","SA","OC","EU","OC","NA","AS","EU","NA",
195
+ "AS","EU","AF","EU","AS","AF","AF","NA","AS","SA",
196
+ "SA","NA","AS","AN","AF","EU","NA","NA","AS","AF",
197
+ "AF","AF","EU","AF","OC","SA","AF","AS","SA","NA",
198
+ "NA","AF","AS","AS","EU","EU","AF","EU","NA","NA",
199
+ "AF","SA","EU","AF","AF","AF","EU","AF","EU","OC",
200
+ "SA","OC","EU","EU","NA","AF","EU","NA","AS","SA",
201
+ "AF","EU","NA","AF","AF","NA","AF","EU","AN","NA",
202
+ "OC","AF","SA","AS","AN","NA","EU","NA","EU","AS",
203
+ "EU","AS","AS","AS","AS","AS","EU","EU","NA","AS",
204
+ "AS","AF","AS","AS","OC","AF","NA","AS","AS","AS",
205
+ "NA","AS","AS","AS","NA","EU","AS","AF","AF","EU",
206
+ "EU","EU","AF","AF","EU","EU","AF","OC","EU","AF",
207
+ "AS","AS","AS","OC","NA","AF","NA","EU","AF","AS",
208
+ "AF","NA","AS","AF","AF","OC","AF","OC","AF","NA",
209
+ "EU","EU","AS","OC","OC","OC","AS","NA","SA","OC",
210
+ "OC","AS","AS","EU","NA","OC","NA","AS","EU","OC",
211
+ "SA","AS","AF","EU","EU","AF","AS","OC","AF","AF",
212
+ "EU","AS","AF","EU","EU","EU","AF","EU","AF","AF",
213
+ "SA","AF","NA","AS","AF","NA","AF","AN","AF","AS",
214
+ "AS","OC","AS","AF","OC","AS","EU","NA","OC","AS",
215
+ "AF","EU","AF","OC","NA","SA","AS","EU","NA","SA",
216
+ "NA","NA","AS","OC","OC","OC","AS","AF","EU","AF",
217
+ "AF","EU","AF","--","--","--","EU","EU","EU","EU",
218
+ "NA","NA","NA", "AF", "--"
219
+ );
220
+
221
+ private $filename = '';
222
+
223
+ public function __construct()
224
+ {
225
+ $this->filename = Mage::getBaseDir() . "/lib/MaxMind/GeoIP/data/" . Mage::getStoreConfig('opc/geo/country_file');
226
+ $this->geoip_open(self::GEOIP_STANDARD);
227
+ }
228
+
229
+ public function geoip_load_shared_mem ($file) {
230
+
231
+ $fp = fopen($file, "rb");
232
+ if (!$fp) {
233
+ print "error opening $file: $php_errormsg\n";
234
+ exit;
235
+ }
236
+ $s_array = fstat($fp);
237
+ $size = $s_array['size'];
238
+ if ($this->shmid = @shmop_open (self::GEOIP_SHM_KEY, "w", 0, 0)) {
239
+ shmop_delete ($this->shmid);
240
+ shmop_close ($this->shmid);
241
+ }
242
+ $this->shmid = shmop_open (self::GEOIP_SHM_KEY, "c", 0644, $size);
243
+ shmop_write ($this->shmid, fread($fp, $size), 0);
244
+ shmop_close ($this->shmid);
245
+ }
246
+
247
+ public function _setup_segments() {
248
+ $this->databaseType = self::GEOIP_COUNTRY_EDITION;
249
+ $this->record_length = self::STANDARD_RECORD_LENGTH;
250
+ if ($this->flags & self::GEOIP_SHARED_MEMORY) {
251
+ $offset = @shmop_size ($this->shmid) - 3;
252
+ for ($i = 0; $i < self::STRUCTURE_INFO_MAX_SIZE; $i++) {
253
+ $delim = @shmop_read ($this->shmid, $offset, 3);
254
+ $offset += 3;
255
+ if ($delim == (chr(255).chr(255).chr(255))) {
256
+ $this->databaseType = ord(@shmop_read ($this->shmid, $offset, 1));
257
+ $offset++;
258
+
259
+ if ($this->databaseType == self::GEOIP_REGION_EDITION_REV0) {
260
+ $this->databaseSegments = self::GEOIP_STATE_BEGIN_REV0;
261
+ } else if ($this->databaseType == self::GEOIP_REGION_EDITION_REV1) {
262
+ $this->databaseSegments = self::GEOIP_STATE_BEGIN_REV1;
263
+ } else if (($this->databaseType == self::GEOIP_CITY_EDITION_REV0)||
264
+ ($this->databaseType == self::GEOIP_CITY_EDITION_REV1)
265
+ || ($this->databaseType == self::GEOIP_ORG_EDITION)
266
+ || ($this->databaseType == self::GEOIP_ORG_EDITION_V6)
267
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION)
268
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION_V6)
269
+ || ($this->databaseType == self::GEOIP_ISP_EDITION)
270
+ || ($this->databaseType == self::GEOIP_ISP_EDITION_V6)
271
+ || ($this->databaseType == self::GEOIP_USERTYPE_EDITION)
272
+ || ($this->databaseType == self::GEOIP_USERTYPE_EDITION_V6)
273
+ || ($this->databaseType == self::GEOIP_LOCATIONA_EDITION)
274
+ || ($this->databaseType == self::GEOIP_ACCURACYRADIUS_EDITION)
275
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV0_V6)
276
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV1_V6)
277
+ || ($this->databaseType == self::GEOIP_NETSPEED_EDITION_REV1)
278
+ || ($this->databaseType == self::GEOIP_NETSPEED_EDITION_REV1_V6)
279
+ || ($this->databaseType == self::GEOIP_ASNUM_EDITION)
280
+ || ($this->databaseType == self::GEOIP_ASNUM_EDITION_V6)) {
281
+ $this->databaseSegments = 0;
282
+ $buf = @shmop_read ($this->shmid, $offset, self::SEGMENT_RECORD_LENGTH);
283
+ for ($j = 0;$j < self::SEGMENT_RECORD_LENGTH;$j++) {
284
+ $this->databaseSegments += (ord($buf[$j]) << ($j * 8));
285
+ }
286
+ if (($this->databaseType == self::GEOIP_ORG_EDITION)
287
+ || ($this->databaseType == self::GEOIP_ORG_EDITION_V6)
288
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION)
289
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION_V6)
290
+ || ($this->databaseType == self::GEOIP_ISP_EDITION)
291
+ || ($this->databaseType == self::GEOIP_ISP_EDITION_V6)) {
292
+ $this->record_length = self::ORG_RECORD_LENGTH;
293
+ }
294
+ }
295
+ break;
296
+ } else {
297
+ $offset -= 4;
298
+ }
299
+ }
300
+ if (($this->databaseType == self::GEOIP_COUNTRY_EDITION)||
301
+ ($this->databaseType == self::GEOIP_COUNTRY_EDITION_V6)||
302
+ ($this->databaseType == self::GEOIP_PROXY_EDITION)||
303
+ ($this->databaseType == self::GEOIP_NETSPEED_EDITION)) {
304
+ $this->databaseSegments = self::GEOIP_COUNTRY_BEGIN;
305
+ }
306
+ } else {
307
+ $filepos = ftell($this->filehandle);
308
+ fseek($this->filehandle, -3, SEEK_END);
309
+ for ($i = 0; $i < self::STRUCTURE_INFO_MAX_SIZE; $i++) {
310
+ $delim = fread($this->filehandle,3);
311
+ if ($delim == (chr(255).chr(255).chr(255))) {
312
+ $this->databaseType = ord(fread($this->filehandle,1));
313
+ if ($this->databaseType == self::GEOIP_REGION_EDITION_REV0) {
314
+ $this->databaseSegments = self::GEOIP_STATE_BEGIN_REV0;
315
+ }
316
+ else if ($this->databaseType == self::GEOIP_REGION_EDITION_REV1) {
317
+ $this->databaseSegments = self::GEOIP_STATE_BEGIN_REV1;
318
+ } else if (($this->databaseType == self::GEOIP_CITY_EDITION_REV0)
319
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV1)
320
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV0_V6)
321
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV1_V6)
322
+ || ($this->databaseType == self::GEOIP_ORG_EDITION)
323
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION)
324
+ || ($this->databaseType == self::GEOIP_ISP_EDITION)
325
+ || ($this->databaseType == self::GEOIP_ORG_EDITION_V6)
326
+ || ($this->databaseType == self::GEOIP_DOMAIN_EDITION_V6)
327
+ || ($this->databaseType == self::GEOIP_ISP_EDITION_V6)
328
+ || ($this->databaseType == self::GEOIP_LOCATIONA_EDITION)
329
+ || ($this->databaseType == self::GEOIP_ACCURACYRADIUS_EDITION)
330
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV0_V6)
331
+ || ($this->databaseType == self::GEOIP_CITY_EDITION_REV1_V6)
332
+ || ($this->databaseType == self::GEOIP_NETSPEED_EDITION_REV1)
333
+ || ($this->databaseType == self::GEOIP_NETSPEED_EDITION_REV1_V6)
334
+ || ($this->databaseType == self::GEOIP_USERTYPE_EDITION)
335
+ || ($this->databaseType == self::GEOIP_USERTYPE_EDITION_V6)
336
+ || ($this->databaseType == self::GEOIP_ASNUM_EDITION)
337
+ || ($this->databaseType == self::GEOIP_ASNUM_EDITION_V6)) {
338
+ $this->databaseSegments = 0;
339
+ $buf = fread($this->filehandle,self::SEGMENT_RECORD_LENGTH);
340
+ for ($j = 0;$j < self::SEGMENT_RECORD_LENGTH;$j++) {
341
+ $this->databaseSegments += (ord($buf[$j]) << ($j * 8));
342
+ }
343
+ if ( ( $this->databaseType == self::GEOIP_ORG_EDITION )
344
+ || ( $this->databaseType == self::GEOIP_DOMAIN_EDITION )
345
+ || ( $this->databaseType == self::GEOIP_ISP_EDITION )
346
+ || ( $this->databaseType == self::GEOIP_ORG_EDITION_V6 )
347
+ || ( $this->databaseType == self::GEOIP_DOMAIN_EDITION_V6 )
348
+ || ( $this->databaseType == self::GEOIP_ISP_EDITION_V6 )) {
349
+ $this->record_length = self::ORG_RECORD_LENGTH;
350
+ }
351
+ }
352
+ break;
353
+ } else {
354
+ fseek($this->filehandle, -4, SEEK_CUR);
355
+ }
356
+ }
357
+ if (($this->databaseType == self::GEOIP_COUNTRY_EDITION)||
358
+ ($this->databaseType == self::GEOIP_COUNTRY_EDITION_V6)||
359
+ ($this->databaseType == self::GEOIP_PROXY_EDITION)||
360
+ ($this->databaseType == self::GEOIP_NETSPEED_EDITION)) {
361
+ $this->databaseSegments = self::GEOIP_COUNTRY_BEGIN;
362
+ }
363
+ fseek($this->filehandle,$filepos,SEEK_SET);
364
+ }
365
+ }
366
+
367
+ public function geoip_open($flags) {
368
+ $this->flags = $flags;
369
+ if ($this->flags & self::GEOIP_SHARED_MEMORY) {
370
+ $this->shmid = @shmop_open (self::GEOIP_SHM_KEY, "a", 0, 0);
371
+ } else {
372
+ $this->filehandle = fopen($this->filename,"rb") or die("Can not open $this->filename\n" );
373
+ if ($this->flags & self::GEOIP_MEMORY_CACHE) {
374
+ $s_array = fstat($this->filehandle);
375
+ $this->memory_buffer = fread($this->filehandle, $s_array['size']);
376
+ }
377
+ }
378
+
379
+ $this->_setup_segments();
380
+ }
381
+
382
+ public function geoip_close() {
383
+ if ($this->flags & self::GEOIP_SHARED_MEMORY) {
384
+ return true;
385
+ }
386
+
387
+ return fclose($this->filehandle);
388
+ }
389
+
390
+ public function geoip_country_id_by_name_v6($name) {
391
+ $rec = $this->dns_get_record($name, DNS_AAAA);
392
+ if ( !$rec ) {
393
+ return false;
394
+ }
395
+ $addr = $rec[0]["ipv6"];
396
+ if (!$addr || $addr == $name) {
397
+ return false;
398
+ }
399
+ return $this->geoip_country_id_by_addr_v6($addr);
400
+ }
401
+
402
+ public function geoip_country_id_by_name($name) {
403
+ $addr = gethostbyname($name);
404
+ if (!$addr || $addr == $name) {
405
+ return false;
406
+ }
407
+ return $this->geoip_country_id_by_addr($addr);
408
+ }
409
+
410
+ public function geoip_country_code_by_name_v6($name) {
411
+ $country_id = $this->geoip_country_id_by_name_v6($name);
412
+ if ($country_id !== false) {
413
+ return $this->GEOIP_COUNTRY_CODES[$country_id];
414
+ }
415
+ return false;
416
+ }
417
+
418
+ public function geoip_country_code_by_name($name) {
419
+ $country_id = $this->geoip_country_id_by_name($name);
420
+ if ($country_id !== false) {
421
+ return $this->GEOIP_COUNTRY_CODES[$country_id];
422
+ }
423
+ return false;
424
+ }
425
+
426
+ public function geoip_country_name_by_name_v6($name) {
427
+ $country_id = $this->geoip_country_id_by_name_v6($name);
428
+ if ($country_id !== false) {
429
+ return $this->GEOIP_COUNTRY_NAMES[$country_id];
430
+ }
431
+ return false;
432
+ }
433
+
434
+ public function geoip_country_name_by_name($name) {
435
+ $country_id = $this->geoip_country_id_by_name($name);
436
+ if ($country_id !== false) {
437
+ return $this->GEOIP_COUNTRY_NAMES[$country_id];
438
+ }
439
+ return false;
440
+ }
441
+
442
+ public function geoip_country_id_by_addr_v6($addr) {
443
+ $ipnum = inet_pton($addr);
444
+ return $this->_geoip_seek_country_v6($ipnum) - self::GEOIP_COUNTRY_BEGIN;
445
+ }
446
+
447
+ public function geoip_country_id_by_addr($addr) {
448
+ $ipnum = ip2long($addr);
449
+ return $this->_geoip_seek_country($ipnum) - self::GEOIP_COUNTRY_BEGIN;
450
+ }
451
+
452
+ public function geoip_country_code_by_addr_v6($addr) {
453
+ $country_id = $this->geoip_country_id_by_addr_v6($addr);
454
+ if ($country_id !== false) {
455
+ return $this->GEOIP_COUNTRY_CODES[$country_id];
456
+ }
457
+ return false;
458
+ }
459
+
460
+ public function geoip_country_code_by_addr($addr) {
461
+ if ($this->databaseType == self::GEOIP_CITY_EDITION_REV1) {
462
+ $record = $this->geoip_record_by_addr($addr);
463
+ if ( $record !== false ) {
464
+ return $record->country_code;
465
+ }
466
+ } else {
467
+ $country_id = $this->geoip_country_id_by_addr($addr);
468
+ if ($country_id !== false) {
469
+ return $this->GEOIP_COUNTRY_CODES[$country_id];
470
+ }
471
+ }
472
+ return false;
473
+ }
474
+
475
+ public function geoip_country_name_by_addr_v6($addr) {
476
+ $country_id = $this->geoip_country_id_by_addr_v6($addr);
477
+ if ($country_id !== false) {
478
+ return $this->GEOIP_COUNTRY_NAMES[$country_id];
479
+ }
480
+ return false;
481
+ }
482
+
483
+ public function geoip_country_name_by_addr($addr) {
484
+ if ($this->databaseType == self::GEOIP_CITY_EDITION_REV1) {
485
+ $record = $this->geoip_record_by_addr($addr);
486
+ return $record->country_name;
487
+ } else {
488
+ $country_id = $this->geoip_country_id_by_addr($addr);
489
+ if ($country_id !== false) {
490
+ return $this->GEOIP_COUNTRY_NAMES[$country_id];
491
+ }
492
+ }
493
+ return false;
494
+ }
495
+
496
+ public function _geoip_seek_country_v6($ipnum) {
497
+
498
+ # arrays from unpack start with offset 1
499
+ # yet another php mystery. array_merge work around
500
+ # this broken behaviour
501
+ $v6vec = array_merge(unpack( "C16", $ipnum));
502
+
503
+ $offset = 0;
504
+ for ($depth = 127; $depth >= 0; --$depth) {
505
+ if ($this->flags & self::GEOIP_MEMORY_CACHE) {
506
+ // workaround php's broken substr, strpos, etc handling with
507
+ // mbstring.func_overload and mbstring.internal_encoding
508
+ $enc = mb_internal_encoding();
509
+ mb_internal_encoding('ISO-8859-1');
510
+
511
+ $buf = substr($this->memory_buffer,
512
+ 2 * $this->record_length * $offset,
513
+ 2 * $this->record_length);
514
+
515
+ mb_internal_encoding($enc);
516
+ } elseif ($this->flags & self::GEOIP_SHARED_MEMORY) {
517
+ $buf = @shmop_read ($this->shmid,
518
+ 2 * $this->record_length * $offset,
519
+ 2 * $this->record_length );
520
+ } else {
521
+ fseek($this->filehandle, 2 * $this->record_length * $offset, SEEK_SET) == 0
522
+ or die("fseek failed");
523
+ $buf = fread($this->filehandle, 2 * $this->record_length);
524
+ }
525
+ $x = array(0,0);
526
+ for ($i = 0; $i < 2; ++$i) {
527
+ for ($j = 0; $j < $this->record_length; ++$j) {
528
+ $x[$i] += ord($buf[$this->record_length * $i + $j]) << ($j * 8);
529
+ }
530
+ }
531
+
532
+ $bnum = 127 - $depth;
533
+ $idx = $bnum >> 3;
534
+ $b_mask = 1 << ( $bnum & 7 ^ 7 );
535
+ if (($v6vec[$idx] & $b_mask) > 0) {
536
+ if ($x[1] >= $this->databaseSegments) {
537
+ return $x[1];
538
+ }
539
+ $offset = $x[1];
540
+ } else {
541
+ if ($x[0] >= $this->databaseSegments) {
542
+ return $x[0];
543
+ }
544
+ $offset = $x[0];
545
+ }
546
+ }
547
+ trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR);
548
+ return false;
549
+ }
550
+
551
+ public function _geoip_seek_country($ipnum) {
552
+ $offset = 0;
553
+ for ($depth = 31; $depth >= 0; --$depth) {
554
+ if ($this->flags & self::GEOIP_MEMORY_CACHE) {
555
+ // workaround php's broken substr, strpos, etc handling with
556
+ // mbstring.func_overload and mbstring.internal_encoding
557
+ $enc = mb_internal_encoding();
558
+ mb_internal_encoding('ISO-8859-1');
559
+
560
+ $buf = substr($this->memory_buffer,
561
+ 2 * $this->record_length * $offset,
562
+ 2 * $this->record_length);
563
+
564
+ mb_internal_encoding($enc);
565
+ } elseif ($this->flags & self::GEOIP_SHARED_MEMORY) {
566
+ $buf = @shmop_read ($this->shmid,
567
+ 2 * $this->record_length * $offset,
568
+ 2 * $this->record_length );
569
+ } else {
570
+ fseek($this->filehandle, 2 * $this->record_length * $offset, SEEK_SET) == 0
571
+ or die("fseek failed");
572
+ $buf = fread($this->filehandle, 2 * $this->record_length);
573
+ }
574
+ $x = array(0,0);
575
+ for ($i = 0; $i < 2; ++$i) {
576
+ for ($j = 0; $j < $this->record_length; ++$j) {
577
+ $x[$i] += ord($buf[$this->record_length * $i + $j]) << ($j * 8);
578
+ }
579
+ }
580
+ if ($ipnum & (1 << $depth)) {
581
+ if ($x[1] >= $this->databaseSegments) {
582
+ return $x[1];
583
+ }
584
+ $offset = $x[1];
585
+ } else {
586
+ if ($x[0] >= $this->databaseSegments) {
587
+ return $x[0];
588
+ }
589
+ $offset = $x[0];
590
+ }
591
+ }
592
+ trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR);
593
+ return false;
594
+ }
595
+
596
+ public function _common_get_org($seek_org) {
597
+ $record_pointer = $seek_org + (2 * $this->record_length - 1) * $this->databaseSegments;
598
+ if ($this->flags & self::GEOIP_SHARED_MEMORY) {
599
+ $org_buf = @shmop_read ($this->shmid, $record_pointer, self::MAX_ORG_RECORD_LENGTH);
600
+ } else {
601
+ fseek($this->filehandle, $record_pointer, SEEK_SET);
602
+ $org_buf = fread($this->filehandle,self::MAX_ORG_RECORD_LENGTH);
603
+ }
604
+ // workaround php's broken substr, strpos, etc handling with
605
+ // mbstring.func_overload and mbstring.internal_encoding
606
+ $enc = mb_internal_encoding();
607
+ mb_internal_encoding('ISO-8859-1');
608
+ $org_buf = substr($org_buf, 0, strpos($org_buf, "\0"));
609
+ mb_internal_encoding($enc);
610
+ return $org_buf;
611
+ }
612
+
613
+ public function _get_org_v6($ipnum) {
614
+ $seek_org = _geoip_seek_country_v6($ipnum);
615
+ if ($seek_org == $this->databaseSegments) {
616
+ return NULL;
617
+ }
618
+ return $this->_common_get_org($seek_org);
619
+ }
620
+
621
+ public function _get_org($ipnum) {
622
+ $seek_org = $this->_geoip_seek_country($ipnum);
623
+ if ($seek_org == $this->databaseSegments) {
624
+ return NULL;
625
+ }
626
+ return $this->_common_get_org($seek_org);
627
+ }
628
+
629
+ public function geoip_name_by_addr_v6 ($addr) {
630
+ if ($addr == NULL) {
631
+ return 0;
632
+ }
633
+ $ipnum = inet_pton($addr);
634
+ return $this->_get_org_v6($ipnum);
635
+ }
636
+
637
+ public function geoip_name_by_addr ($addr) {
638
+ if ($addr == NULL) {
639
+ return 0;
640
+ }
641
+ $ipnum = ip2long($addr);
642
+ return $this->_get_org($ipnum);
643
+ }
644
+
645
+ public function geoip_org_by_addr ($addr) {
646
+ return $this->geoip_name_by_addr($addr);
647
+ }
648
+
649
+ public function _get_region($ipnum) {
650
+ if ($this->databaseType == self::GEOIP_REGION_EDITION_REV0) {
651
+ $seek_region = $this->_geoip_seek_country($ipnum) - self::GEOIP_STATE_BEGIN_REV0;
652
+ if ($seek_region >= 1000) {
653
+ $country_code = "US";
654
+ $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65);
655
+ } else {
656
+ $country_code = $this->GEOIP_COUNTRY_CODES[$seek_region];
657
+ $region = "";
658
+ }
659
+ return array ($country_code,$region);
660
+ } else if ($this->databaseType == self::GEOIP_REGION_EDITION_REV1) {
661
+ $seek_region = _geoip_seek_country($ipnum) - self::GEOIP_STATE_BEGIN_REV1;
662
+ //print $seek_region;
663
+ if ($seek_region < self::US_OFFSET) {
664
+ $country_code = "";
665
+ $region = "";
666
+ } else if ($seek_region < self::CANADA_OFFSET) {
667
+ $country_code = "US";
668
+ $region = chr(($seek_region - self::US_OFFSET)/26 + 65) . chr(($seek_region - self::US_OFFSET)%26 + 65);
669
+ } else if ($seek_region < self::WORLD_OFFSET) {
670
+ $country_code = "CA";
671
+ $region = chr(($seek_region - self::CANADA_OFFSET)/26 + 65) . chr(($seek_region - self::CANADA_OFFSET)%26 + 65);
672
+ } else {
673
+ $country_code = $this->GEOIP_COUNTRY_CODES[($seek_region - self::WORLD_OFFSET) / self::FIPS_RANGE];
674
+ $region = "";
675
+ }
676
+ return array ($country_code,$region);
677
+ }
678
+ }
679
+
680
+ public function geoip_region_by_addr ($addr) {
681
+ if ($addr == NULL) {
682
+ return 0;
683
+ }
684
+ $ipnum = ip2long($addr);
685
+ return $this->_get_region($ipnum);
686
+ }
687
+
688
+ public function getdnsattributes ($l,$ip) {
689
+ $r = new Net_DNS_Resolver();
690
+ $r->nameservers = array("ws1.maxmind.com");
691
+ $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN");
692
+ $str = is_object($p->answer[0])?$p->answer[0]->string():'';
693
+ $str = substr($str, 1, -1 );
694
+ return $str;
695
+ }
696
+
697
+ public function getrecordwithdnsservice($str) {
698
+ $record = new GeoIpDNSRecord();
699
+ $keyvalue = explode(";",$str);
700
+ foreach ($keyvalue as $keyvalue2) {
701
+ list($key,$value) = explode("=",$keyvalue2);
702
+ if ($key == "co") {
703
+ $record->country_code = $value;
704
+ }
705
+ if ($key == "ci") {
706
+ $record->city = $value;
707
+ }
708
+ if ($key == "re") {
709
+ $record->region = $value;
710
+ }
711
+ if ($key == "ac") {
712
+ $record->areacode = $value;
713
+ }
714
+ if ($key == "dm" || $key == "me" ) {
715
+ $record->dmacode = $value;
716
+ $record->metrocode = $value;
717
+ }
718
+ if ($key == "is") {
719
+ $record->isp = $value;
720
+ }
721
+ if ($key == "or") {
722
+ $record->org = $value;
723
+ }
724
+ if ($key == "zi") {
725
+ $record->postal_code = $value;
726
+ }
727
+ if ($key == "la") {
728
+ $record->latitude = $value;
729
+ }
730
+ if ($key == "lo") {
731
+ $record->longitude = $value;
732
+ }
733
+ }
734
+ $number = $GLOBALS['GEOIP_COUNTRY_CODE_TO_NUMBER'][$record->country_code];
735
+ $record->country_code3 = $GLOBALS['GEOIP_COUNTRY_CODES3'][$number];
736
+ $record->country_name = $GLOBALS['GEOIP_COUNTRY_NAMES'][$number];
737
+ if ($record->region != "") {
738
+ if (($record->country_code == "US") || ($record->country_code == "CA")) {
739
+ $record->regionname = $GLOBALS['ISO'][$record->country_code][$record->region];
740
+ } else {
741
+ $record->regionname = $GLOBALS['FIPS'][$record->country_code][$record->region];
742
+ }
743
+ }
744
+ return $record;
745
+ }
746
+
747
+
748
+ public function _get_record_v6($ipnum) {
749
+ $seek_country = $this->_geoip_seek_country_v6($ipnum);
750
+ if ($seek_country == $this->databaseSegments) {
751
+ return NULL;
752
+ }
753
+ return $this->_common_get_record($seek_country);
754
+ }
755
+
756
+ public function _common_get_record($seek_country) {
757
+ // workaround php's broken substr, strpos, etc handling with
758
+ // mbstring.func_overload and mbstring.internal_encoding
759
+ $enc = mb_internal_encoding();
760
+ mb_internal_encoding('ISO-8859-1');
761
+
762
+ $record_pointer = $seek_country + (2 * $this->record_length - 1) * $this->databaseSegments;
763
+
764
+ if ($this->flags & self::GEOIP_MEMORY_CACHE) {
765
+ $record_buf = substr($this->memory_buffer,$record_pointer,self::FULL_RECORD_LENGTH);
766
+ } elseif ($this->flags & self::GEOIP_SHARED_MEMORY) {
767
+ $record_buf = @shmop_read($this->shmid,$record_pointer,self::FULL_RECORD_LENGTH);
768
+ } else {
769
+ fseek($this->filehandle, $record_pointer, SEEK_SET);
770
+ $record_buf = fread($this->filehandle,self::FULL_RECORD_LENGTH);
771
+ }
772
+ $record = new GeoIpRecord();
773
+ $record_buf_pos = 0;
774
+ $char = ord(substr($record_buf,$record_buf_pos,1));
775
+ $record->country_code = $this->GEOIP_COUNTRY_CODES[$char];
776
+ $record->country_code3 = $this->GEOIP_COUNTRY_CODES3[$char];
777
+ $record->country_name = $this->GEOIP_COUNTRY_NAMES[$char];
778
+ $record->continent_code = $this->GEOIP_CONTINENT_CODES[$char];
779
+ $record_buf_pos++;
780
+ $str_length = 0;
781
+ // Get region
782
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
783
+ while ($char != 0) {
784
+ $str_length++;
785
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
786
+ }
787
+ if ($str_length > 0) {
788
+ $record->region = substr($record_buf,$record_buf_pos,$str_length);
789
+ }
790
+ $record_buf_pos += $str_length + 1;
791
+ $str_length = 0;
792
+ // Get city
793
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
794
+ while ($char != 0) {
795
+ $str_length++;
796
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
797
+ }
798
+ if ($str_length > 0) {
799
+ $record->city = substr($record_buf,$record_buf_pos,$str_length);
800
+ }
801
+ $record_buf_pos += $str_length + 1;
802
+ $str_length = 0;
803
+ // Get postal code
804
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
805
+ while ($char != 0) {
806
+ $str_length++;
807
+ $char = ord(substr($record_buf,$record_buf_pos+$str_length,1));
808
+ }
809
+ if ($str_length > 0) {
810
+ $record->postal_code = substr($record_buf,$record_buf_pos,$str_length);
811
+ }
812
+ $record_buf_pos += $str_length + 1;
813
+ $str_length = 0;
814
+ // Get latitude and longitude
815
+ $latitude = 0;
816
+ $longitude = 0;
817
+ for ($j = 0;$j < 3; ++$j) {
818
+ $char = ord(substr($record_buf,$record_buf_pos++,1));
819
+ $latitude += ($char << ($j * 8));
820
+ }
821
+ $record->latitude = ($latitude/10000) - 180;
822
+ for ($j = 0;$j < 3; ++$j) {
823
+ $char = ord(substr($record_buf,$record_buf_pos++,1));
824
+ $longitude += ($char << ($j * 8));
825
+ }
826
+ $record->longitude = ($longitude/10000) - 180;
827
+ if (self::GEOIP_CITY_EDITION_REV1 == $this->databaseType) {
828
+ $metroarea_combo = 0;
829
+ if ($record->country_code == "US") {
830
+ for ($j = 0;$j < 3;++$j) {
831
+ $char = ord(substr($record_buf,$record_buf_pos++,1));
832
+ $metroarea_combo += ($char << ($j * 8));
833
+ }
834
+ $record->metro_code = $record->dma_code = floor($metroarea_combo/1000);
835
+ $record->area_code = $metroarea_combo%1000;
836
+ }
837
+ }
838
+ mb_internal_encoding($enc);
839
+ return $record;
840
+ }
841
+
842
+ public function geoip_record_by_addr_v6 ($addr) {
843
+ if ($addr == NULL) {
844
+ return 0;
845
+ }
846
+ $ipnum = inet_pton($addr);
847
+ return $this->_get_record_v6($ipnum);
848
+ }
849
+
850
+ public function _get_record($ipnum) {
851
+ $seek_country = $this->_geoip_seek_country($ipnum);
852
+ if ($seek_country == $this->databaseSegments) {
853
+ return NULL;
854
+ }
855
+ return $this->_common_get_record($seek_country);
856
+ }
857
+
858
+ public function geoip_record_by_addr($addr) {
859
+ if ($addr == NULL) {
860
+ return 0;
861
+ }
862
+ $ipnum = ip2long($addr);
863
+
864
+ return $this->_get_record($ipnum);
865
+ }
866
+
867
+ public function get(){
868
+
869
+ $customerIp = Mage::helper('core/http')->getRemoteAddr(false);
870
+
871
+ if ($customerIp == '127.0.0.1'){
872
+ $ip = "96.30.30.149"; //Mage::helper('core/http')->getRemoteAddr(true);
873
+ }else{
874
+ $ip = $customerIp;
875
+ }
876
+
877
+ $this->geoip_open(self::GEOIP_STANDARD);
878
+ //$this->geoip_close();
879
+
880
+ $country_code = $this->geoip_country_code_by_addr( $ip );
881
+
882
+ $countries = Mage::getModel('directory/country')->getCollection();
883
+
884
+ $country_code = trim($country_code);
885
+ $country_code = strtoupper($country_code);
886
+
887
+ foreach($countries as $country){
888
+ if ($country->getCountryId()==$country_code){
889
+ return $country_code;
890
+ }
891
+ }
892
+
893
+ return false;
894
+ }
895
+
896
+ }
897
+
app/code/community/Abserve/Opc/Helper/Data.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Helper_Data extends Mage_Core_Helper_Abstract{
3
+
4
+ private $_version = 'CE';
5
+
6
+ const XML_PATH_VAT_FRONTEND_VISIBILITY = 'customer/create_account/vat_frontend_visibility';
7
+
8
+ const XML_PATH_SHIPPING_VISIBILITY = 'opc/default/show_shipping';
9
+
10
+ const XML_PATH_TERMS_TYPE = 'opc/default/terms_type';
11
+
12
+ const XML_PATH_COMMENT = 'opc/default/comment';
13
+
14
+ const XML_PATH_DISCOUNT = 'opc/default/discount';
15
+
16
+ const XML_PAYPAL_LIGHTBOX_SANDBOX = 'opc/paypal/sandbox';
17
+
18
+ const XML_PAYPAL_LIGHTBOX_ENABLED = 'opc/paypal/status';
19
+
20
+ public function isAvailableVersion(){
21
+
22
+ $mage = new Mage();
23
+ if (!is_callable(array($mage, 'getEdition'))){
24
+ $edition = 'Community';
25
+ }else{
26
+ $edition = Mage::getEdition();
27
+ }
28
+ unset($mage);
29
+
30
+ if ($edition=='Enterprise' && $this->_version=='CE'){
31
+ return false;
32
+ }
33
+ return true;
34
+
35
+ }
36
+
37
+ public function isEnable(){
38
+ $status = Mage::getStoreConfig('opc/global/status');
39
+ return $status;
40
+ }
41
+
42
+ /**
43
+ * Get string with frontend validation classes for attribute
44
+ *
45
+ * @param string $attributeCode
46
+ * @return string
47
+ */
48
+ public function getAttributeValidationClass($attributeCode){
49
+ /** @var $attribute Mage_Customer_Model_Attribute */
50
+ $attribute = isset($this->_attributes[$attributeCode]) ? $this->_attributes[$attributeCode]
51
+ : Mage::getSingleton('eav/config')->getAttribute('customer_address', $attributeCode);
52
+ $class = $attribute ? $attribute->getFrontend()->getClass() : '';
53
+
54
+ if (in_array($attributeCode, array('firstname', 'middlename', 'lastname', 'prefix', 'suffix', 'taxvat'))) {
55
+ if ($class && !$attribute->getIsVisible()) {
56
+ $class = ''; // address attribute is not visible thus its validation rules are not applied
57
+ }
58
+
59
+ /** @var $customerAttribute Mage_Customer_Model_Attribute */
60
+ $customerAttribute = Mage::getSingleton('eav/config')->getAttribute('customer', $attributeCode);
61
+ $class .= $customerAttribute && $customerAttribute->getIsVisible()
62
+ ? $customerAttribute->getFrontend()->getClass() : '';
63
+ $class = implode(' ', array_unique(array_filter(explode(' ', $class))));
64
+ }
65
+
66
+ return $class;
67
+ }
68
+
69
+ public function isVatAttributeVisible(){
70
+ return (bool)Mage::getStoreConfig(self::XML_PATH_VAT_FRONTEND_VISIBILITY);
71
+ }
72
+
73
+
74
+ public function isEnterprise(){
75
+ return Mage::getConfig()->getModuleConfig('Enterprise_Enterprise') && Mage::getConfig()->getModuleConfig('Enterprise_AdminGws') && Mage::getConfig()->getModuleConfig('Enterprise_Checkout') && Mage::getConfig()->getModuleConfig('Enterprise_Customer');
76
+ }
77
+
78
+
79
+ public function isShowShippingForm(){
80
+ return (bool) Mage::getStoreConfig(self::XML_PATH_SHIPPING_VISIBILITY);
81
+ }
82
+
83
+ public function getTermsType(){
84
+ return Mage::getStoreConfig(self::XML_PATH_TERMS_TYPE);
85
+ }
86
+
87
+ public function isShowComment(){
88
+ return Mage::getStoreConfig(self::XML_PATH_COMMENT);
89
+ }
90
+
91
+ public function isShowDiscount(){
92
+ return Mage::getStoreConfig(self::XML_PATH_DISCOUNT);
93
+ }
94
+
95
+ public function getPayPalExpressUrl($token){
96
+
97
+ if (Mage::getStoreConfig(self::XML_PAYPAL_LIGHTBOX_SANDBOX)){
98
+ return 'https://www.sandbox.paypal.com/checkoutnow?token='.$token;
99
+ }else{
100
+ return 'https://www.paypal.com/checkoutnow?token='.$token;
101
+ }
102
+
103
+ }
104
+
105
+ public function getPayPalLightboxEnabled(){
106
+ return (bool)Mage::getStoreConfig(self::XML_PAYPAL_LIGHTBOX_ENABLED);
107
+ }
108
+
109
+ public function getAvailablePaymentMethods()
110
+ {
111
+ $payment_methods = array();
112
+ $methods = Mage::app()->getLayout()->createBlock('checkout/onepage_payment_methods')->getMethods();
113
+ foreach ($methods as $_method)
114
+ {
115
+ $_code = $_method->getCode();
116
+ $payment_methods[] = $_code;
117
+ }
118
+
119
+ return $payment_methods;
120
+ }
121
+
122
+ public function getSelectedPaymentMethod()
123
+ {
124
+ return Mage::app()->getLayout()->createBlock('checkout/onepage_payment_methods')->getSelectedMethodCode();
125
+ }
126
+
127
+ /**
128
+ * check if list of available methods was changed
129
+ *
130
+ * @param array $methods_before
131
+ * @param array $methods_after
132
+ * @return string - method to use
133
+ */
134
+ public function checkUpdatedPaymentMethods($methods_before, $methods_after)
135
+ {
136
+ // check if need to reload payment methods
137
+ $selected_method_code = $this->getSelectedPaymentMethod();
138
+ if(!in_array($selected_method_code, $methods_after))
139
+ $selected_method_code = false;
140
+
141
+ $pm_changed = false;
142
+ if(count($methods_before) != count($methods_after))
143
+ $pm_changed = true;
144
+
145
+ $free_available = false;
146
+ foreach($methods_after as $_code)
147
+ {
148
+ if($_code == 'free')
149
+ $free_available = $_code;
150
+ if(!$pm_changed)
151
+ {
152
+ if(!in_array($_code, $methods_before))
153
+ $pm_changed = true;
154
+ }
155
+ }
156
+
157
+ if($pm_changed)
158
+ {
159
+ $use_method = $selected_method_code;
160
+ if($free_available)
161
+ $use_method = $free_available;
162
+ return $use_method;
163
+ }
164
+ //////
165
+
166
+ return -1; // no changes
167
+ }
168
+
169
+ public function getGrandTotal(){
170
+ $quote = Mage::getModel('checkout/session')->getQuote();
171
+ $total = $quote->getGrandTotal();
172
+
173
+ return Mage::helper('checkout')->formatPrice($total);
174
+ }
175
+
176
+ }
app/code/community/Abserve/Opc/Helper/Paypal.php ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Helper_Paypal extends Mage_Customer_Helper_Data {
3
+
4
+ const RETURN_URL = 'onepage/paypal/return';
5
+
6
+ const XML_PATH_ENABLED = 'opc/paypallogin/status';
7
+
8
+ const XML_PATH_SANDBOX_MODE = 'opc/paypallogin/sandbox';
9
+
10
+ const XML_PATH_CLIENT_ID = 'opc/paypallogin/clientid';
11
+
12
+ const XML_PATH_CLIENT_SECRET = 'opc/paypallogin/secret';
13
+
14
+ private $_clientId;
15
+
16
+ private $_clientSecret;
17
+
18
+ private $_sandbox;
19
+
20
+ private $_scopes = 'openid email profile address phone https://uri.paypal.com/services/expresscheckout';
21
+
22
+ private $_returnUrl;
23
+
24
+ private $_paypalSandboxUrl = 'https://www.sandbox.paypal.com/';
25
+
26
+ private $_paypalSandboxApiUrl = 'https://api.sandbox.paypal.com/';
27
+
28
+ private $_paypalLiveUrl = 'https://www.paypal.com/';
29
+
30
+ private $_paypalLiveApiUrl = 'https://api.paypal.com/';
31
+
32
+ public function __construct() {
33
+
34
+ $this->_sandbox = Mage::getStoreConfig ( self::XML_PATH_SANDBOX_MODE );
35
+ $this->_clientId = Mage::getStoreConfig ( self::XML_PATH_CLIENT_ID );
36
+ $this->_clientSecret = Mage::getStoreConfig ( self::XML_PATH_CLIENT_SECRET );
37
+ }
38
+
39
+ /**
40
+ * Return url with image for PayPal Access button
41
+ *
42
+ * @return string
43
+ */
44
+ public function getPayPalButtonUrl() {
45
+ return "https://www.paypalobjects.com/webstatic/en_US/developer/docs/lipp/loginwithpaypalbutton.png";
46
+ }
47
+
48
+
49
+ public function getAuthUrl() {
50
+ $token = new stdClass ();
51
+
52
+ $token->nonce = time () . uniqid ();
53
+
54
+ $token->state = time () . uniqid ();
55
+
56
+ Mage::getSingleton ( 'core/session' )->setPayPalAuthToken ( $token );
57
+
58
+ $authUrl = sprintf ( "%s?client_id=%s&response_type=code&scope=%s&redirect_uri=%s&nonce=%s&state=%s", $this->getAuthorizationEndPoint (), Mage::getStoreConfig ( self::XML_PATH_CLIENT_ID ), urlencode ( $this->_scopes ), urlencode ( Mage::getBaseUrl ( Mage_Core_Model_Store::URL_TYPE_LINK, true ) . self::RETURN_URL ), $token->nonce, $token->state );
59
+ return $authUrl;
60
+ }
61
+
62
+
63
+ private function getAuthorizationEndPoint() {
64
+ if ($this->_sandbox) {
65
+ $url = $this->_paypalSandboxUrl;
66
+ } else {
67
+ $url = $this->_paypalLiveUrl;
68
+ }
69
+
70
+ return $url . 'webapps/auth/protocol/openidconnect/v1/authorize';
71
+ }
72
+
73
+
74
+ private function getAccessTokenEndPoint() {
75
+
76
+ if ($this->_sandbox) {
77
+ $url = $this->_paypalSandboxApiUrl;
78
+ } else {
79
+ $url = $this->_paypalLiveApiUrl;
80
+ }
81
+
82
+ return $url . 'v1/identity/openidconnect/tokenservice';
83
+ }
84
+
85
+
86
+ private function getProfileEndPoint() {
87
+ if ($this->_sandbox) {
88
+ $url = $this->_paypalSandboxApiUrl;
89
+ } else {
90
+ $url = $this->_paypalLiveApiUrl;
91
+ }
92
+
93
+ return $url . 'v1/identity/openidconnect/userinfo';
94
+ }
95
+
96
+
97
+ private function getLogoutEndPoint() {
98
+ if ($this->_sandbox) {
99
+ $url = $this->_paypalSandboxUrl;
100
+ } else {
101
+ $url = $this->_paypalLiveUrl;
102
+ }
103
+
104
+ return $url . 'webapps/auth/protocol/openidconnect/v1/endsession';
105
+ }
106
+
107
+
108
+ private function getValidateEndPoint() {
109
+ if ($this->_sandbox) {
110
+ $url = $this->_paypalSandboxApiUrl;
111
+ } else {
112
+ $url = $this->_paypalLiveApiUrl;
113
+ }
114
+
115
+ return $url . 'webapps/auth/protocol/openidconnect/v1/checkid';
116
+ }
117
+
118
+
119
+ public function getAccessToken($params) {
120
+ $_code = $params ['code'];
121
+
122
+ $_state = $params ['state'];
123
+
124
+ $_token = Mage::getSingleton ( 'core/session' )->getPayPalAuthToken ();
125
+
126
+ if ($_token->state == $_state) {
127
+
128
+ $request = new Varien_Object ();
129
+ $request->setData ( 'grant_type', 'authorization_code' );
130
+ $request->setData ( 'code', $_code );
131
+ $request->setData ( 'redirect_uri', Mage::getBaseUrl ( Mage_Core_Model_Store::URL_TYPE_LINK, true ) . self::RETURN_URL );
132
+
133
+ $response = $this->_tokenWorker ( $_token, $request );
134
+
135
+ $_token->received_time = time ();
136
+ $_token->refresh_token = $response->getRefreshToken ();
137
+ $_token->access_token = $response->getAccessToken ();
138
+ $_token->expires_in = $response->getExpiresIn ();
139
+
140
+ Mage::getSingleton ( 'core/session' )->setPayPalAuthToken ( $_token );
141
+ }
142
+
143
+ return $_token;
144
+ }
145
+
146
+
147
+ public function getPayPalProfile() {
148
+ $_token = Mage::getSingleton ( 'core/session' )->getPayPalAuthToken ();
149
+
150
+ $request = new Varien_Object ();
151
+ $client = new Varien_Http_Client ();
152
+ $result = new Varien_Object ();
153
+
154
+ $_config = array (
155
+ 'maxredirects' => 5,
156
+ 'timeout' => 5
157
+ );
158
+
159
+ $url = $this->getProfileEndPoint ();
160
+ $params ['schema'] = 'openid';
161
+
162
+ $requestUrl = $url . '/?' . $this->_buildQuery ( $params );
163
+
164
+ $debugData = array (
165
+ 'url' => $requestUrl,
166
+ 'params' => $params,
167
+ 'access_token' => $_token->access_token
168
+ );
169
+ $this->_debug ( $debugData );
170
+ $client->setUri ( $requestUrl )->setConfig ( $_config )->setMethod ( Zend_Http_Client::GET )->setHeaders ( 'Content-Type: application/json' )->setHeaders ( 'Authorization: Bearer ' . $_token->access_token );
171
+
172
+ try {
173
+
174
+ $response = $client->setUrlEncodeBody ( true )->request ();
175
+ } catch ( Exception $e ) {
176
+ $result->setResponseCode ( - 1 )->setResponseReasonCode ( $e->getCode () )->setResponseReasonText ( $e->getMessage () );
177
+
178
+ $debugData ['result'] = $result->getData ();
179
+ $this->_debug ( $debugData );
180
+ throw new Exception ( $e->getMessage () );
181
+ }
182
+
183
+ $body = $response->getBody ();
184
+
185
+ if (empty ( $body )) {
186
+ throw new Exception ( $this->__ ( 'Unable to communicate with the PayPal gateway.' ) );
187
+ }
188
+
189
+ $profile = Mage::helper ( 'core' )->jsonDecode ( $body );
190
+
191
+ $result->addData ( $profile );
192
+
193
+ $debugData ['result'] = $result->getData ();
194
+
195
+ $this->_debug ( $debugData );
196
+
197
+ return $result;
198
+ }
199
+
200
+
201
+ public function linkAccounts($_profile, $customer) {
202
+ $customerId = $customer->getId ();
203
+
204
+ if (! $customer->getAddresses ()) {
205
+ $this->addPaypalAddress ( $customer, $_profile, true );
206
+ }
207
+
208
+ $payerId = $_profile->getUserId ();
209
+ $email = $_profile->getEmail ();
210
+
211
+ $paypalCustomer = Mage::getModel ( 'opc/paypal_customer' )->load ( $customerId, 'customer_id' );
212
+
213
+ if ($paypalCustomer->getId ()) {
214
+ return $paypalCustomer;
215
+ }
216
+
217
+ $paypalCustomer->setData ( 'payer_id', $payerId );
218
+ $paypalCustomer->setData ( 'customer_id', $customerId );
219
+ $paypalCustomer->setData ( 'email', $email );
220
+ $paypalCustomer->save ();
221
+
222
+ return $paypalCustomer;
223
+ }
224
+
225
+
226
+ public function addPaypalAddress($customer, $response, $default = false) {
227
+ $customerId = $customer->getId ();
228
+
229
+ $paypalAddress = $response->getAddress ();
230
+
231
+ $regionId = Mage::getModel ( 'directory/region' )->loadByCode ( $paypalAddress ['region'], $paypalAddress ['country'] )->getId ();
232
+
233
+ $address = Mage::getModel ( 'customer/address' );
234
+ $address->setCustomerId ( $customerId );
235
+ $address->setFirstname ( $response->getGivenName () );
236
+ $address->setLastname ( $response->getFamilyName () );
237
+ $address->setCountryId ( $paypalAddress ['country'] );
238
+ $address->setCity ( $paypalAddress ['locality'] );
239
+
240
+ if ($regionId) {
241
+ $address->setRegionId ( $regionId );
242
+ }
243
+ $address->setPostcode ( $paypalAddress ['postal_code'] );
244
+ $address->setStreet ( $paypalAddress ['street_address'] );
245
+ $address->setTelephone ( $response->getPhoneNumber () );
246
+
247
+ if ($default == true) {
248
+ $address->setIsDefaultBilling ( true );
249
+ $address->setIsDefaultShipping ( true );
250
+ }
251
+
252
+ $address->save ();
253
+ $customer->addAddress ( $address );
254
+ return $address;
255
+ }
256
+
257
+
258
+
259
+ public function createMagentoCustomer($response) {
260
+ $customer = Mage::getModel ( 'customer/customer' )->setId ( null );
261
+ $password = $customer->generatePassword ();
262
+
263
+ $customer->setData ( 'firstname', $response->getGivenName () );
264
+ $customer->setData ( 'lastname', $response->getFamilyName () );
265
+ $customer->setData ( 'email', $response->getEmail () );
266
+ $customer->setData ( 'password', $password );
267
+ $customer->save ();
268
+
269
+ $customerId = $customer->getId ();
270
+ $this->addPaypalAddress ( $customer, $response, true );
271
+
272
+ return $customer;
273
+ }
274
+
275
+
276
+ protected function _getCustomerSession() {
277
+ return Mage::getSingleton ( 'customer/session' );
278
+ }
279
+
280
+
281
+ protected function _debug($debugData) {
282
+ if ($this->_sandbox) {
283
+ Mage::getModel ( 'core/log_adapter', 'paypal_login.log' )->log ( $debugData );
284
+ }
285
+ }
286
+
287
+
288
+ protected function _buildQuery($request) {
289
+ return http_build_query ( $request );
290
+ }
291
+ public function getLoginUrl() {
292
+ return $this->_getUrl ( 'onepage/paypal/login', array (
293
+ '_secure' => true
294
+ ) );
295
+ }
296
+
297
+
298
+ public function getAskLinkPostActionUrl() {
299
+ $params = array ();
300
+ if ($this->_getRequest ()->getParam ( self::REFERER_QUERY_PARAM_NAME )) {
301
+ $params = array (
302
+ self::REFERER_QUERY_PARAM_NAME => $this->_getRequest ()->getParam ( self::REFERER_QUERY_PARAM_NAME ),
303
+ '_secure' => true
304
+ );
305
+ }
306
+ return $this->_getUrl ( 'onepage/paypal/askLinkPost', $params );
307
+ }
308
+
309
+
310
+ public function refreshAccessToken() {
311
+ $_token = Mage::getSingleton ( 'core/session' )->getPayPalAuthToken ();
312
+
313
+ if ($this->isTokenExpired ( $_token ) && isset ( $_token->refresh_token )) {
314
+
315
+ $request = new Varien_Object ();
316
+ $request->setData ( 'grant_type', 'refresh_token' );
317
+ $request->setData ( 'refresh_token', $_token->refresh_token );
318
+
319
+ $response = $this->_tokenWorker ( $_token, $request );
320
+ if ($response) {
321
+
322
+ $_token->received_time = time ();
323
+ $_token->access_token = $response->getAccessToken ();
324
+ $_token->expires_in = $response->getExpiresIn ();
325
+ Mage::getSingleton ( 'core/session' )->setPayPalAuthToken ( $_token );
326
+ }
327
+ }
328
+
329
+ return $_token;
330
+ }
331
+
332
+
333
+ private function _tokenWorker($token, $request) {
334
+ $base64ClientID = base64_encode ( $this->_clientId . ":" . $this->_clientSecret );
335
+
336
+ $client = new Varien_Http_Client ();
337
+ $result = new Varien_Object ();
338
+
339
+ $_config = array (
340
+ 'maxredirects' => 5,
341
+ 'timeout' => 5
342
+ );
343
+
344
+ $client->setUri ( $this->getAccessTokenEndPoint () )->setConfig ( $_config )->setMethod ( Zend_Http_Client::POST )->setParameterPost ( $request->getData () )->setHeaders ( 'User-Agent: Varien_Http_Client' )->setHeaders ( 'Authorization: Basic ' . $base64ClientID )->setHeaders ( 'Accept: */*' );
345
+
346
+ try {
347
+
348
+ $response = $client->setUrlEncodeBody ( false )->request ();
349
+ } catch ( Exception $e ) {
350
+
351
+ $result->setResponseCode ( - 1 )->setResponseReasonCode ( $e->getCode () )->setResponseReasonText ( $e->getMessage () );
352
+
353
+ $debugData ['result'] = $result->getData ();
354
+ $this->_debug ( $debugData );
355
+ throw new Mage_Exception ( $e->getMessage () );
356
+ return false;
357
+ }
358
+
359
+ $body = Mage::helper ( 'core' )->jsonDecode ( $response->getBody () );
360
+
361
+ $result->addData ( $body );
362
+
363
+ $debugData ['result'] = $result->getData ();
364
+
365
+ $this->_debug ( $debugData );
366
+
367
+ if (isset ( $debugData ['result'] ['error'] )) {
368
+ Mage::log ( $debugData ['result'] ['error_description'] );
369
+
370
+ return false;
371
+ }
372
+
373
+ return $result;
374
+ }
375
+
376
+
377
+ private function isTokenExpired($token) {
378
+ $token_expired = true;
379
+ if (! isset ( $token->expires_in )) {
380
+ return $token_expired;
381
+ }
382
+ $expires_in = $token->expires_in;
383
+ $received_time = $token->received_time;
384
+ if (isset ( $expires_in ) && isset ( $received_time )) {
385
+ $now = time ();
386
+ if (($received_time + $expires_in) > $now) {
387
+ $token_expired = false;
388
+ }
389
+ }
390
+ return $token_expired;
391
+ }
392
+
393
+
394
+ public function end_session() {
395
+ $token = Mage::getSingleton ( 'core/session' )->getPayPalAuthToken ();
396
+ $logout_url = sprintf ( "%s?id_token=%s&state=%s&redirect_uri=%s", $this->getLogoutEndPoint (), $token->id_token, $token->state, $this->returnUrl . "&logout=true" );
397
+
398
+ $this->run_curl ( $logout_url );
399
+ }
400
+
401
+
402
+
403
+
404
+ public function removeToken(){
405
+ Mage::getSingleton('core/session')->unsPayPalExpressToKen();
406
+ }
407
+
408
+ }
app/code/community/Abserve/Opc/Helper/Url.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Helper_Url extends Mage_Checkout_Helper_Url{
3
+
4
+ /**
5
+ * Retrieve checkout url
6
+ *
7
+ * @return string
8
+ */
9
+ public function getCheckoutUrl(){
10
+ if (Mage::helper('opc')->isEnable()){
11
+ return $this->_getUrl('onepage', array('_secure'=>true));
12
+ }else{
13
+ return parent::getCheckoutUrl();
14
+ }
15
+ }
16
+
17
+
18
+
19
+
20
+ /**
21
+ * One Page (OP) checkout urls
22
+ */
23
+ public function getOPCheckoutUrl(){
24
+ if (Mage::helper('opc')->isEnable()){
25
+ return $this->_getUrl('onepage', array('_secure'=>true));
26
+ }else{
27
+ return parent::getOPCheckoutUrl();
28
+ }
29
+ }
30
+ }
app/code/community/Abserve/Opc/Model/Api/Nvp.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Model_Api_Nvp extends Mage_Paypal_Model_Api_Nvp
3
+ {
4
+
5
+
6
+
7
+ /**
8
+ * Return Paypal Api version
9
+ *
10
+ * @return string
11
+ */
12
+ public function getVersion()
13
+ {
14
+ return '94.0';
15
+ }
16
+
17
+
18
+ /**
19
+ * SetExpressCheckout call
20
+ * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout
21
+ * TODO: put together style and giropay settings
22
+ */
23
+ public function callSetExpressCheckout()
24
+ {
25
+
26
+ $this->_prepareExpressCheckoutCallRequest($this->_setExpressCheckoutRequest);
27
+ $request = $this->_exportToRequest($this->_setExpressCheckoutRequest);
28
+ $this->_exportLineItems($request);
29
+
30
+ // import/suppress shipping address, if any
31
+ $options = $this->getShippingOptions();
32
+ if ($this->getAddress()) {
33
+ $request = $this->_importAddresses($request);
34
+ $request['ADDROVERRIDE'] = 1;
35
+ } elseif ($options && (count($options) <= 10)) { // doesn't support more than 10 shipping options
36
+ $request['CALLBACK'] = $this->getShippingOptionsCallbackUrl();
37
+ $request['CALLBACKTIMEOUT'] = 6; // max value
38
+ $request['MAXAMT'] = $request['AMT'] + 999.00; // it is impossible to calculate max amount
39
+ $this->_exportShippingOptions($request);
40
+ }
41
+
42
+ // add recurring profiles information
43
+ $i = 0;
44
+ foreach ($this->_recurringPaymentProfiles as $profile) {
45
+ $request["L_BILLINGTYPE{$i}"] = 'RecurringPayments';
46
+ $request["L_BILLINGAGREEMENTDESCRIPTION{$i}"] = $profile->getScheduleDescription();
47
+ $i++;
48
+ }
49
+
50
+
51
+
52
+ $paypaltoken = Mage::helper('opc/paypal')->refreshAccessToken();
53
+ if(isset($paypaltoken->access_token) && !empty($paypaltoken->access_token)) {
54
+ $request["IDENTITYACCESSTOKEN"] = $paypaltoken->access_token;
55
+ }
56
+
57
+
58
+
59
+
60
+ $response = $this->call(self::SET_EXPRESS_CHECKOUT, $request);
61
+ $this->_importFromResponse($this->_setExpressCheckoutResponse, $response);
62
+ }
63
+
64
+
65
+ }
app/code/community/Abserve/Opc/Model/Braintree/Paymentmethod.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $file = Mage::getBaseDir('code').'/local/Braintree/Payments/Model/Paymentmethod.php';
3
+ if(file_exists($file)){
4
+ if(!class_exists('Braintree_Payments_Model_Paymentmethod', false))
5
+ include_once($file);
6
+ class Abserve_Opc_Model_Braintree_Paymentmethod extends Braintree_Payments_Model_Paymentmethod{
7
+
8
+ /**
9
+ * Format param "channel" for transaction
10
+ *
11
+ * @return string
12
+ */
13
+ protected function _getChannel()
14
+ {
15
+ return 'Magento-Abserve';
16
+ }
17
+ }
18
+ }
app/code/community/Abserve/Opc/Model/Observer.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Model_Observer{
3
+
4
+ public function checkRequiredModules($observer){
5
+ $cache = Mage::app()->getCache();
6
+
7
+ if (Mage::getSingleton('admin/session')->isLoggedIn()) {
8
+ if (!Mage::getConfig()->getModuleConfig('Abserve_All')->is('active', 'true')){
9
+ //if ($cache->load("abserve_opc")===false)
10
+ if ($cache->load("abserve_opc")===true){
11
+ $message = 'Important: Please setup Abserve_ALL in order to finish <strong>Abserve One Page Checkout</strong> installation.<br />
12
+ Please download <a href="http://abserveextensions.com/media/modules/abserve_all.tgz" target="_blank">Abserve_ALL</a> and setup it via Magento Connect.';
13
+
14
+ Mage::getSingleton('adminhtml/session')->addNotice($message);
15
+ $cache->save('true', 'abserve_opc', array("abserve_opc"), $lifeTime=5);
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+
22
+
23
+ public function newsletter($observer){
24
+ $_session = Mage::getSingleton('core/session');
25
+
26
+ $newsletterFlag = $_session->getIsSubscribed();
27
+ if ($newsletterFlag==true){
28
+
29
+ $email = $observer->getEvent()->getOrder()->getCustomerEmail();
30
+
31
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
32
+ if($subscriber->getStatus() != Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED && $subscriber->getStatus() != Mage_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED) {
33
+ $subscriber->setImportMode(true)->subscribe($email);
34
+
35
+ $subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
36
+ $subscriber->sendConfirmationSuccessEmail();
37
+ }
38
+
39
+ }
40
+
41
+ }
42
+
43
+ public function applyComment($observer){
44
+ $order = $observer->getData('order');
45
+
46
+ $comment = Mage::getSingleton('core/session')->getOpcOrderComment();
47
+ if (!Mage::helper('opc')->isShowComment() || empty($comment)){
48
+ return;
49
+ }
50
+ try{
51
+ $order->setCustomerComment($comment);
52
+ $order->setCustomerNoteNotify(true);
53
+ $order->setCustomerNote($comment);
54
+ $order->addStatusHistoryComment($comment)->setIsVisibleOnFront(true)->setIsCustomerNotified(true);
55
+ $order->save();
56
+ $order->sendOrderUpdateEmail(true, $comment);
57
+ }catch(Exception $e){
58
+ Mage::logException($e);
59
+ }
60
+ }
61
+
62
+ }
app/code/community/Abserve/Opc/Model/Paypal/Config.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Config model that is aware of all Mage_Paypal payment methods
5
+ * Works with PayPal-specific system configuration
6
+ */
7
+
8
+ class Abserve_Opc_Model_Paypal_Config extends Mage_Paypal_Model_Config{
9
+
10
+ /**
11
+ * BN code getter
12
+ *
13
+ * @param string $countryCode ISO 3166-1
14
+ */
15
+ public function getBuildNotationCode($countryCode = null){
16
+ parent::getBuildNotationCode($countryCode);
17
+
18
+ return 'Abserve_SI_Other_OnePage';
19
+ }
20
+ }
app/code/community/Abserve/Opc/Model/Paypal/Customer.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Model_Paypal_Customer extends Mage_Core_Model_Abstract{
3
+
4
+ public function _construct(){
5
+ parent::_construct();
6
+ $this->_init('opc/paypal_customer');
7
+ }
8
+
9
+ /**
10
+ * Log in Magento
11
+ *
12
+ * @return Mage_Core_Model_Abstract
13
+ */
14
+ public function logInMagentoCustomerAccount($customerId){
15
+ $magentoCustomer = Mage::getModel('customer/customer')->load($customerId);
16
+ $magentoCustomer->setConfirmation(null)->save();
17
+ $magentoCustomer->setIsJustConfirmed(true);
18
+ Mage::getModel('customer/session')->setCustomerAsLoggedIn($magentoCustomer);
19
+ return $magentoCustomer;
20
+ }
21
+
22
+ /**
23
+ * Unlink (native magento customer entity and paypal customer entity) from dashboard
24
+ *
25
+ * @return Paypalauth_Identity_Model_Paypal_Customer
26
+ */
27
+ public function unlinkAccount(){
28
+ $customerId = Mage::getSingleton('customer/session')->getCustomer()->getId();
29
+ $this->_getResource()->unlinkAccount($customerId);
30
+ return $this;
31
+ }
32
+
33
+ /**
34
+ * Check paypalauth account existing in the database.
35
+ * Method returns true if exists, false - otherwise.
36
+ *
37
+ * @param $field
38
+ * @param $value
39
+ * @return bool
40
+ */
41
+ public function isPaypalCustomerExists($field, $value){
42
+ return (bool) $this->_getResource()->isPaypalCustomerExists((string) $field, (string) $value);
43
+ }
44
+
45
+ /**
46
+ * Return data array from paypalauth_customer table
47
+ *
48
+ * @param $field
49
+ * @param $value
50
+ * @return
51
+ */
52
+ public function getPaypalCustomerDataByField($field, $value){
53
+ $data = $this->_getResource()->getPaypalCustomerDataByField($field, $value);
54
+ return $data;
55
+ }
56
+
57
+ }
app/code/community/Abserve/Opc/Model/Paypal/Express.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Model_Paypal_Express extends Mage_Paypal_Model_Express{
3
+
4
+
5
+ /**
6
+ * Checkout redirect URL getter for onepage checkout (hardcode)
7
+ *
8
+ * @see Mage_Checkout_OnepageController::savePaymentAction()
9
+ * @see Mage_Sales_Model_Quote_Payment::getCheckoutRedirectUrl()
10
+ * @return string
11
+ */
12
+ public function getCheckoutRedirectUrl()
13
+ {
14
+ if(Mage::getStoreConfig('opc_paypal_status')){
15
+ return Mage::getUrl('onepage/express/start');
16
+ }
17
+
18
+ return parent::getCheckoutRedirectUrl();
19
+ }
20
+
21
+
22
+ }
app/code/community/Abserve/Opc/Model/Resource/Paypal/Customer.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Model_Resource_Paypal_Customer extends Mage_Core_Model_Resource_Db_Abstract{
3
+
4
+ /**
5
+ * Paypal customer resource model initialization
6
+ *
7
+ * @return void
8
+ */
9
+ public function _construct(){
10
+ $this->_init('opc/customer', 'id');
11
+ }
12
+
13
+ /**
14
+ * Unlinks (native magento customer entity and paypal customer entity)
15
+ *
16
+ * @param $customerId
17
+ * @return Paypalauth_Identity_Model_Mysql4_Paypal_Customer
18
+ */
19
+ public function unlinkAccount($customerId){
20
+ $this->_getWriteAdapter()->delete($this->getMainTable(), "customer_id={$customerId}");
21
+ return $this;
22
+ }
23
+
24
+ /**
25
+ * Check PayPal customer existing in the database
26
+ *
27
+ * @param string $customerId
28
+ * @return bool
29
+ */
30
+ public function isPaypalCustomerExists($field, $value){
31
+ return (bool)$this->getPaypalCustomerDataByField($field, $value);
32
+ }
33
+
34
+ /**
35
+ * Return payer_id(PayPal customer id) and customer_id
36
+ *
37
+ * @param $field
38
+ * @param string $value
39
+ * @return mixed
40
+ */
41
+ public function getPaypalCustomerDataByField($field, $value = ''){
42
+ $select = $this->_getReadAdapter()->select()
43
+ ->from($this->getMainTable(), array('customer_id', 'payer_id', 'email'))
44
+ ->where("$field=?", $value);
45
+ $result = $this->_getReadAdapter()->fetchRow($select);
46
+
47
+ return $result;
48
+ }
49
+
50
+ }
app/code/community/Abserve/Opc/Model/Resource/Paypal/Customer/Collection.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_Model_Resource_Paypal_Customer_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract{
3
+ /**
4
+ * Resource initialization.
5
+ *
6
+ * @return void
7
+ */
8
+ protected function _construct()
9
+ {
10
+ $this->_init('opc/paypal_customer');
11
+ }
12
+ }
app/code/community/Abserve/Opc/Model/System/Config/Source/Shipping/Allmethods.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Abserve_Opc_Model_System_Config_Source_Shipping_Allmethods{
4
+ /**
5
+ * Return array of carriers.
6
+ * If $isActiveOnlyFlag is set to true, will return only active carriers
7
+ *
8
+ * @param bool $isActiveOnlyFlag
9
+ * @return array
10
+ */
11
+ public function toOptionArray($isActiveOnlyFlag=false)
12
+ {
13
+ $methods = array(array('value'=>'', 'label'=>''));
14
+ $carriers = Mage::getSingleton('shipping/config')->getAllCarriers();
15
+ foreach ($carriers as $carrierCode=>$carrierModel) {
16
+ //fix for 1.7 magento - or view dhl first need setup config
17
+ if ($carrierCode=='dhl'){
18
+ continue;
19
+ }
20
+ if (!$carrierModel->isActive() && (bool)$isActiveOnlyFlag === true) {
21
+ continue;
22
+ }
23
+ $carrierMethods = $carrierModel->getAllowedMethods();
24
+ if (!$carrierMethods) {
25
+ continue;
26
+ }
27
+ $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title');
28
+ $methods[$carrierCode] = array(
29
+ 'label' => $carrierTitle,
30
+ 'value' => array(),
31
+ );
32
+ foreach ($carrierMethods as $methodCode=>$methodTitle) {
33
+ $methods[$carrierCode]['value'][] = array(
34
+ 'value' => $carrierCode.'_'.$methodCode,
35
+ 'label' => '['.$carrierCode.'] '.$methodTitle,
36
+ );
37
+ }
38
+ }
39
+
40
+ return $methods;
41
+ }
42
+ }
app/code/community/Abserve/Opc/Model/System/Config/Source/Terms.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Abserve_Opc_Model_System_Config_Source_Terms{
4
+ /**
5
+ * Return array of carriers.
6
+ * If $isActiveOnlyFlag is set to true, will return only active carriers
7
+ *
8
+ * @param bool $isActiveOnlyFlag
9
+ * @return array
10
+ */
11
+ public function toOptionArray($isActiveOnlyFlag=false)
12
+ {
13
+ return array(
14
+ array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Popup')),
15
+ array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('Inline')),
16
+ );
17
+
18
+ }
19
+ }
app/code/community/Abserve/Opc/controllers/Checkout/OnepageController.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $abserve_av_class = false;
3
+
4
+ if (! Mage::helper ( 'opc' )->isEnable ()) {
5
+ // check if Abserve AddressValidation exists
6
+ $path = Mage::getBaseDir ( 'app' ) . DS . 'code' . DS . 'local' . DS;
7
+ $file = 'Abserve/AddressVerification/controllers/OnepageController.php';
8
+ // load Abserve OPC class
9
+ if (file_exists ( $path . $file )){
10
+ // check if Abserve AV enabled
11
+ if (Mage::helper ( 'addressverification' )->isAddressVerificationEnabled ()){
12
+ $abserve_av_class = true;
13
+ }
14
+ }
15
+ }
16
+
17
+ if (! $abserve_av_class) {
18
+ require_once Mage::getModuleDir ( 'controllers', 'Mage_Checkout' ) . DS . 'OnepageController.php';
19
+ class Abserve_Opc_Checkout_OnepageController extends Mage_Checkout_OnepageController {
20
+
21
+ /**
22
+ * Checkout page
23
+ */
24
+ public function indexAction() {
25
+ $scheme = Mage::app ()->getRequest ()->getScheme ();
26
+ if ($scheme == 'http') {
27
+ $secure = false;
28
+ } else {
29
+ $secure = true;
30
+ }
31
+
32
+ if (Mage::helper ( 'opc' )->isEnable ()) {
33
+ $this->_redirect ( 'onepage', array (
34
+ '_secure' => $secure
35
+ ) );
36
+ return;
37
+ } else {
38
+ parent::indexAction ();
39
+ }
40
+ }
41
+ }
42
+ } else {
43
+ require_once Mage::getModuleDir ( 'controllers', 'Abserve_AddressVerification' ) . DS . 'OnepageController.php';
44
+ class Abserve_Opc_Checkout_OnepageController extends Abserve_AddressVerification_OnepageController {
45
+ }
46
+ }
app/code/community/Abserve/Opc/controllers/CouponController.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Abserve_Opc_CouponController extends Mage_Core_Controller_Front_Action{
4
+
5
+ const XML_PATH_DEFAULT_PAYMENT = 'opc/default/payment';
6
+
7
+ /**
8
+ * Retrieve shopping cart model object
9
+ *
10
+ * @return Mage_Checkout_Model_Cart
11
+ */
12
+ protected function _getCart(){
13
+ return Mage::getSingleton('checkout/cart');
14
+ }
15
+
16
+ /**
17
+ * Get checkout session model instance
18
+ *
19
+ * @return Mage_Checkout_Model_Session
20
+ */
21
+ protected function _getSession(){
22
+ return Mage::getSingleton('checkout/session');
23
+ }
24
+
25
+ /**
26
+ * Get current active quote instance
27
+ *
28
+ * @return Mage_Sales_Model_Quote
29
+ */
30
+ protected function _getQuote(){
31
+ return $this->_getCart()->getQuote();
32
+ }
33
+
34
+
35
+ /**
36
+ * Get payments method step html
37
+ *
38
+ * @return string
39
+ */
40
+ protected function _getPaymentMethodsHtml($use_method = false){
41
+
42
+ /** UPDATE PAYMENT METHOD **/
43
+ // check what method to use
44
+ $apply_method = Mage::getStoreConfig(self::XML_PATH_DEFAULT_PAYMENT);
45
+ if($use_method)
46
+ $apply_method = $use_method;
47
+
48
+ $_cart = $this->_getCart();
49
+ $_quote = $_cart->getQuote();
50
+ $_quote->getPayment()->setMethod($apply_method);
51
+ $_quote->setTotalsCollectedFlag(false)->collectTotals();
52
+ $_quote->save();
53
+
54
+ $layout = $this->getLayout();
55
+ $update = $layout->getUpdate();
56
+ $update->load('checkout_onepage_paymentmethod');
57
+ $layout->generateXml();
58
+ $layout->generateBlocks();
59
+
60
+ $output = $layout->getOutput();
61
+ return $output;
62
+ }
63
+
64
+ public function couponPostAction(){
65
+
66
+ $responseData = array();
67
+ /**
68
+ * No reason continue with empty shopping cart
69
+ */
70
+ if (!$this->_getCart()->getQuote()->getItemsCount()) {
71
+ $this->_redirect('checkout/cart');
72
+ return;
73
+ }
74
+
75
+ $couponCode = (string) $this->getRequest()->getParam('coupon_code');
76
+ if ($this->getRequest()->getParam('remove') == 1) {
77
+ $couponCode = '';
78
+ }
79
+ $oldCouponCode = $this->_getQuote()->getCouponCode();
80
+
81
+ if (!strlen($couponCode) && !strlen($oldCouponCode)) {
82
+ $responseData['message'] = $this->__('Coupon code is not valid.');
83
+ $this->getResponse()->setHeader('Content-type','application/json', true);
84
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($responseData));
85
+ return;
86
+ }
87
+
88
+ /// get list of available methods before discount changes
89
+ $methods_before = Mage::helper('opc')->getAvailablePaymentMethods();
90
+ ///////
91
+
92
+ try {
93
+ $this->_getQuote()->getShippingAddress()->setCollectShippingRates(true);
94
+ $this->_getQuote()->setCouponCode(strlen($couponCode) ? $couponCode : '')
95
+ ->collectTotals()
96
+ ->save();
97
+
98
+ /// get list of available methods after discount changes
99
+ $methods_after = Mage::helper('opc')->getAvailablePaymentMethods();
100
+ ///////
101
+
102
+ if ($couponCode) {
103
+ if ($couponCode == $this->_getQuote()->getCouponCode()) {
104
+ $responseData['message'] = $this->__('Coupon code "%s" was applied.', Mage::helper('core')->htmlEscape($couponCode));
105
+ }else {
106
+ $responseData['message'] = $this->__('Coupon code "%s" is not valid.', Mage::helper('core')->htmlEscape($couponCode));
107
+ }
108
+ } else {
109
+ $responseData['message'] = $this->__('Coupon code was canceled.');
110
+ }
111
+
112
+ $layout= $this->getLayout();
113
+ $block = $layout->createBlock('checkout/cart_coupon');
114
+ $block->setTemplate('opc/onepage/coupon.phtml');
115
+ $responseData['coupon'] = $block->toHtml();
116
+
117
+ // check if need to reload payment methods
118
+ $use_method = Mage::helper('opc')->checkUpdatedPaymentMethods($methods_before, $methods_after);
119
+ if($use_method != -1)
120
+ $responseData['payments'] = $this->_getPaymentMethodsHtml($use_method);
121
+ /////
122
+
123
+ } catch (Mage_Core_Exception $e) {
124
+ $this->_getSession()->addError($e->getMessage());
125
+ } catch (Exception $e) {
126
+ $responseData['message'] = $this->__('Cannot apply the coupon code.');
127
+ Mage::logException($e);
128
+ }
129
+
130
+
131
+ $this->getResponse()->setHeader('Content-type','application/json', true);
132
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($responseData));
133
+
134
+ }
135
+ }
app/code/community/Abserve/Opc/controllers/ExpressController.php ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_ExpressController extends Mage_Core_Controller_Front_Action{
3
+
4
+
5
+ /**
6
+ * @var Mage_Paypal_Model_Express_Checkout
7
+ */
8
+ protected $_checkout = null;
9
+
10
+ /**
11
+ * @var Mage_Paypal_Model_Config
12
+ */
13
+ protected $_config = null;
14
+
15
+ /**
16
+ * @var Mage_Sales_Model_Quote
17
+ */
18
+ protected $_quote = false;
19
+
20
+ /**
21
+ * Config mode type
22
+ *
23
+ * @var string
24
+ */
25
+ protected $_configType = 'paypal/config';
26
+
27
+ /**
28
+ * Config method type
29
+ *
30
+ * @var string
31
+ */
32
+ protected $_configMethod = Mage_Paypal_Model_Config::METHOD_WPP_EXPRESS;
33
+
34
+ /**
35
+ * Checkout mode type
36
+ *
37
+ * @var string
38
+ */
39
+ protected $_checkoutType = 'paypal/express_checkout';
40
+
41
+ /**
42
+ * Instantiate config
43
+ */
44
+ protected function _construct(){
45
+ parent::_construct();
46
+ $this->_config = Mage::getModel($this->_configType, array($this->_configMethod));
47
+ }
48
+
49
+ /**
50
+ * Start Express Checkout by requesting initial token and dispatching customer to PayPal
51
+ */
52
+ public function startAction(){
53
+ $responseData = array();
54
+ try {
55
+
56
+ $_scheme = Mage::app()->getRequest()->getScheme();
57
+ if ($_scheme=='https'){
58
+ $_secure = true;
59
+ }else{
60
+ $_secure = false;
61
+ }
62
+
63
+ $this->_initCheckout();
64
+
65
+ if ($this->_getQuote()->getIsMultiShipping()) {
66
+ $this->_getQuote()->setIsMultiShipping(false);
67
+ $this->_getQuote()->removeAllAddresses();
68
+ }
69
+
70
+ $customer = Mage::getSingleton('customer/session')->getCustomer();
71
+ $quoteCheckoutMethod = $this->_getQuote()->getCheckoutMethod();
72
+ if ($customer && $customer->getId()) {
73
+ $this->_checkout->setCustomerWithAddressChange(
74
+ $customer, $this->_getQuote()->getBillingAddress(), $this->_getQuote()->getShippingAddress()
75
+ );
76
+ } elseif ((!$quoteCheckoutMethod
77
+ || $quoteCheckoutMethod != Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER)
78
+ && !Mage::helper('checkout')->isAllowedGuestCheckout(
79
+ $this->_getQuote(),
80
+ $this->_getQuote()->getStoreId()
81
+ )) {
82
+ Mage::getSingleton('core/session')->addNotice(
83
+ Mage::helper('paypal')->__('To proceed to Checkout, please log in using your email address.')
84
+ );
85
+ $this->redirectLogin();
86
+ Mage::getSingleton('customer/session')
87
+ ->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_current' => true)));
88
+ return;
89
+ }
90
+
91
+ // billing agreement
92
+ $isBARequested = (bool)$this->getRequest()->getParam(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT);
93
+ if ($customer && $customer->getId()) {
94
+ $this->_checkout->setIsBillingAgreementRequested($isBARequested);
95
+ }
96
+
97
+ $new_mage = $this->isNewMagento();
98
+
99
+ // Bill Me Later
100
+ if($new_mage)
101
+ $this->_checkout->setIsBml((bool)$this->getRequest()->getParam('bml'));
102
+
103
+ // giropay
104
+ $this->_checkout->prepareGiropayUrls(
105
+ Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $_secure) . 'checkout/onepage/success',
106
+ Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $_secure). 'onepage/express/cancel',
107
+ Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $_secure) . 'checkout/onepage/success'
108
+ );
109
+
110
+ // fix for newer magentos
111
+ if($new_mage){
112
+ $token = $this->_checkout->start(
113
+ Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $_secure) . 'onepage/express/return',
114
+ Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $_secure) . 'onepage/express/cancel',
115
+ 1
116
+ );
117
+ }
118
+ else{
119
+ $token = $this->_checkout->start(
120
+ Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $_secure) . 'onepage/express/return',
121
+ Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK, $_secure) . 'onepage/express/cancel'
122
+ );
123
+ }
124
+ //
125
+
126
+ $this->_initToken($token);
127
+
128
+ $paypalUrl = Mage::helper('opc')->getPayPalExpressUrl($token);
129
+
130
+ $this->_redirectUrl($paypalUrl);
131
+
132
+ } catch (Mage_Core_Exception $e) {
133
+ $this->_getSession()->addError($e->getMessage());
134
+ } catch (Exception $e) {
135
+ $this->_getSession()->addError($this->__('Unable to start Express Checkout.'));
136
+ Mage::logException($e);
137
+ }
138
+
139
+
140
+ }
141
+
142
+
143
+ /**
144
+ * Cancel Express Checkout
145
+ */
146
+ public function cancelAction(){
147
+ try {
148
+ $this->_initToken(false);
149
+ // TODO verify if this logic of order cancelation is deprecated
150
+ // if there is an order - cancel it
151
+ $orderId = $this->_getCheckoutSession()->getLastOrderId();
152
+ $order = ($orderId) ? Mage::getModel('sales/order')->load($orderId) : false;
153
+ if ($order && $order->getId() && $order->getQuoteId() == $this->_getCheckoutSession()->getQuoteId()) {
154
+ $order->cancel()->save();
155
+ $this->_getCheckoutSession()
156
+ ->unsLastQuoteId()
157
+ ->unsLastSuccessQuoteId()
158
+ ->unsLastOrderId()
159
+ ->unsLastRealOrderId()
160
+ ->addSuccess($this->__('Express Checkout and Order have been canceled.'))
161
+ ;
162
+ } else {
163
+ $this->_getCheckoutSession()->addSuccess($this->__('Express Checkout has been canceled.'));
164
+ }
165
+ } catch (Mage_Core_Exception $e) {
166
+ $this->_getCheckoutSession()->addError($e->getMessage());
167
+ } catch (Exception $e) {
168
+ $this->_getCheckoutSession()->addError($this->__('Unable to cancel Express Checkout.'));
169
+ Mage::logException($e);
170
+ }
171
+
172
+
173
+ $this->_redirect('checkout/cart', array('_secure'=>true));
174
+
175
+ }
176
+
177
+ /**
178
+ * Return from PayPal and dispatch customer to order review page
179
+ */
180
+ public function returnAction(){
181
+ $new_mage = $this->isNewMagento();
182
+ if($new_mage){ // for newer magentos
183
+ if ($this->getRequest()->getParam('retry_authorization') == 'true'
184
+ && is_array($this->_getCheckoutSession()->getPaypalTransactionData())
185
+ ) {
186
+ $this->_forward('placeOrder');
187
+ return;
188
+ }
189
+
190
+ try {
191
+ $this->_getCheckoutSession()->unsPaypalTransactionData();
192
+ $this->_checkout = $this->_initCheckout();
193
+ $this->_checkout->returnFromPaypal($this->_initToken());
194
+
195
+ if ($this->_checkout->canSkipOrderReviewStep()) {
196
+ $this->_forward('placeOrder');
197
+ } else {
198
+ Mage::getSingleton ( 'core/session' )->unsPplRedirect ( );
199
+ $this->_redirect('paypal/express/review', array('_secure'=>true));
200
+ }
201
+ return;
202
+ } catch (Mage_Core_Exception $e) {
203
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
204
+ }
205
+ catch (Exception $e) {
206
+ Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Express Checkout approval.'));
207
+ Mage::logException($e);
208
+ }
209
+ $this->_redirect('checkout/cart');
210
+ }
211
+ else{ // for older magentos
212
+ try {
213
+ $this->_initCheckout();
214
+ $this->_checkout->returnFromPaypal($this->_initToken());
215
+ Mage::getSingleton ( 'core/session' )->unsPplRedirect ( );
216
+ echo "<script>parent.parent.location.href='" . Mage::getUrl('paypal/express/review', array('_secure'=>true)) . "'</script>";
217
+ return;
218
+ }
219
+ catch (Mage_Core_Exception $e) {
220
+ Mage::getSingleton('checkout/session')->addError($e->getMessage());
221
+ }
222
+ catch (Exception $e) {
223
+ Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Express Checkout approval.'));
224
+ Mage::logException($e);
225
+ }
226
+ $this->_redirect('checkout/cart', array('_secure'=>true));
227
+ }
228
+ }
229
+
230
+ /**
231
+ * Instantiate quote and checkout
232
+ * @throws Mage_Core_Exception
233
+ */
234
+ private function _initCheckout(){
235
+ $quote = $this->_getQuote();
236
+ if (!$quote->hasItems() || $quote->getHasError()) {
237
+ $this->getResponse()->setHeader('HTTP/1.1','403 Forbidden');
238
+ Mage::throwException(Mage::helper('paypal')->__('Unable to initialize Express Checkout.'));
239
+ }
240
+ $this->_checkout = Mage::getSingleton($this->_checkoutType, array(
241
+ 'config' => $this->_config,
242
+ 'quote' => $quote,
243
+ ));
244
+ return $this->_checkout;
245
+ }
246
+
247
+ /**
248
+ * Search for proper checkout token in request or session or (un)set specified one
249
+ * Combined getter/setter
250
+ *
251
+ * @param string $setToken
252
+ * @return Mage_Paypal_ExpressController|string
253
+ */
254
+ protected function _initToken($setToken = null){
255
+ if (null !== $setToken) {
256
+ if (false === $setToken) {
257
+ // security measure for avoid unsetting token twice
258
+ if (!$this->_getSession()->getExpressCheckoutToken()) {
259
+ Mage::throwException($this->__('PayPal Express Checkout Token does not exist.'));
260
+ }
261
+ $this->_getSession()->unsExpressCheckoutToken();
262
+ } else {
263
+ $this->_getSession()->setExpressCheckoutToken($setToken);
264
+ }
265
+ return $this;
266
+ }
267
+ if ($setToken = $this->getRequest()->getParam('token')) {
268
+ if ($setToken !== $this->_getSession()->getExpressCheckoutToken()) {
269
+ Mage::throwException($this->__('Wrong PayPal Express Checkout Token specified.'));
270
+ }
271
+ } else {
272
+ $setToken = $this->_getSession()->getExpressCheckoutToken();
273
+ }
274
+ return $setToken;
275
+ }
276
+
277
+ /**
278
+ * PayPal session instance getter
279
+ *
280
+ * @return Mage_PayPal_Model_Session
281
+ */
282
+ private function _getSession(){
283
+ return Mage::getSingleton('paypal/session');
284
+ }
285
+
286
+ /**
287
+ * Return checkout session object
288
+ *
289
+ * @return Mage_Checkout_Model_Session
290
+ */
291
+ private function _getCheckoutSession(){
292
+ return Mage::getSingleton('checkout/session');
293
+ }
294
+
295
+ /**
296
+ * Return checkout quote object
297
+ *
298
+ * @return Mage_Sale_Model_Quote
299
+ */
300
+ private function _getQuote(){
301
+ if (!$this->_quote) {
302
+ $this->_quote = $this->_getCheckoutSession()->getQuote();
303
+ }
304
+ return $this->_quote;
305
+ }
306
+
307
+ /**
308
+ * Redirect to login page
309
+ *
310
+ */
311
+ public function redirectLogin()
312
+ {
313
+ $this->setFlag('', 'no-dispatch', true);
314
+ $this->getResponse()->setRedirect(
315
+ Mage::helper('core/url')->addRequestParam(
316
+ Mage::helper('customer')->getLoginUrl(),
317
+ array('context' => 'checkout')
318
+ )
319
+ );
320
+ }
321
+
322
+ public function isNewMagento(){
323
+ $mage = new Mage();
324
+ if (!is_callable(array($mage, 'getEdition'))){
325
+ $edition = 'Community';
326
+ }else{
327
+ $edition = Mage::getEdition();
328
+ }
329
+ unset($mage);
330
+
331
+ $version = Mage::getVersionInfo();
332
+ $m1 = $version['major'];
333
+ $m2 = $version['minor'];
334
+ $v = $m1*1000+$m2*10;
335
+
336
+ if($edition == 'Enterprise'){
337
+ if($v >= 1140) // 1.14
338
+ return true;
339
+ }
340
+ else
341
+ {
342
+ if($v >= 1090) // 1.9
343
+ return true;
344
+ }
345
+
346
+ return false;
347
+ }
348
+ }
app/code/community/Abserve/Opc/controllers/IndexController.php ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_IndexController extends Mage_Checkout_Controller_Action{
3
+
4
+ const XML_PATH_TITLE = 'opc/global/title';
5
+
6
+ const XML_PATH_DEFAULT_PAYMENT = 'opc/default/payment';
7
+
8
+ const XML_PATH_GEO_COUNTRY = 'opc/geo/country';
9
+
10
+ const XML_PATH_GEO_CITY = 'opc/geo/city';
11
+
12
+ /**
13
+ * Get one page checkout model
14
+ *
15
+ * @return Mage_Checkout_Model_Type_Onepage
16
+ */
17
+ public function getOnepage(){
18
+ return Mage::getSingleton('checkout/type_onepage');
19
+ }
20
+
21
+ protected function _getCart(){
22
+ return Mage::getSingleton('checkout/cart');
23
+ }
24
+
25
+
26
+ /**
27
+ * Predispatch: should set layout area
28
+ *
29
+ * @return Mage_Checkout_OnepageController
30
+ */
31
+ public function preDispatch()
32
+ {
33
+ parent::preDispatch();
34
+ $this->_preDispatchValidateCustomer();
35
+
36
+ $checkoutSessionQuote = Mage::getSingleton('checkout/session')->getQuote();
37
+ if ($checkoutSessionQuote->getIsMultiShipping()) {
38
+ $checkoutSessionQuote->setIsMultiShipping(false);
39
+ $checkoutSessionQuote->removeAllAddresses();
40
+ }
41
+
42
+ if (!$this->_canShowForUnregisteredUsers()) {
43
+ $this->norouteAction();
44
+ $this->setFlag('',self::FLAG_NO_DISPATCH,true);
45
+ return;
46
+ }
47
+
48
+ return $this;
49
+ }
50
+
51
+ protected function updateDefaultPayment(){
52
+ $defaultPaymentMethod = Mage::getStoreConfig(self::XML_PATH_DEFAULT_PAYMENT);
53
+ $_cart = $this->_getCart();
54
+ $_quote = $_cart->getQuote();
55
+ $_quote->getPayment()->setMethod($defaultPaymentMethod);
56
+ $_quote->setTotalsCollectedFlag(false)->collectTotals();
57
+ $_quote->save();
58
+ }
59
+
60
+ protected function initDefaultAddress()
61
+ {
62
+ $billing_address = $this->getOnepage()->getQuote()->getBillingAddress();
63
+
64
+ $bill_country = $billing_address->getCountryId();
65
+ if(!empty($bill_country))
66
+ return $this;
67
+
68
+ $countryId = Mage::helper('core')->getDefaultCountry();
69
+ $ip_country = Mage::getStoreConfig(self::XML_PATH_GEO_COUNTRY) ? Mage::helper('opc/country')->get() : $countryId;
70
+ $countryId = !empty($ip_country)?$ip_country:$countryId;
71
+ $ip_city = Mage::getStoreConfig(self::XML_PATH_GEO_CITY) ? Mage::helper('opc/city')->get() : false;
72
+
73
+ $default_billing_addr = array(
74
+ 'country_id' => $countryId,
75
+ 'city' => !empty($ip_city)?$ip_city:null,
76
+ );
77
+
78
+ $billing_address->addData($default_billing_addr);
79
+ $billing_address->implodeStreetAddress();
80
+
81
+ if (!$this->getOnepage()->getQuote()->isVirtual())
82
+ {
83
+ // set shipping address same as billing
84
+ $bill = clone $billing_address;
85
+ $bill->unsAddressId()->unsAddressType();
86
+ $ship = $this->getOnepage()->getQuote()->getShippingAddress();
87
+ $ship_method = $ship->getShippingMethod();
88
+ $ship->addData($bill->getData());
89
+ $ship->setSameAsBilling(1)->setShippingMethod($ship_method)->setCollectShippingRates(true);
90
+ }
91
+
92
+ $this->getOnepage()->getQuote()->collectTotals()->save();
93
+
94
+ return $this;
95
+ }
96
+
97
+
98
+ /**
99
+ * Checkout page
100
+ */
101
+ public function indexAction(){
102
+ if (!Mage::helper('checkout')->canOnepageCheckout()) {
103
+ Mage::getSingleton('checkout/session')->addError($this->__('The onepage checkout is disabled.'));
104
+ $this->_redirect('checkout/cart');
105
+ return;
106
+ }
107
+ $quote = $this->getOnepage()->getQuote();
108
+
109
+ if (!$quote->hasItems() || $quote->getHasError()) {
110
+ $this->_redirect('checkout/cart');
111
+ return;
112
+ }
113
+
114
+ // init default address
115
+ $this->initDefaultAddress();
116
+
117
+ Mage::app()->getCacheInstance()->cleanType('layout');
118
+
119
+ $this->updateDefaultPayment();
120
+
121
+ if (!$quote->validateMinimumAmount()) {
122
+ $error = Mage::getStoreConfig('sales/minimum_order/error_message') ?
123
+ Mage::getStoreConfig('sales/minimum_order/error_message') :
124
+ Mage::helper('checkout')->__('Subtotal must exceed minimum order amount');
125
+
126
+ Mage::getSingleton('checkout/session')->addError($error);
127
+ $this->_redirect('checkout/cart');
128
+ return;
129
+ }
130
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(false);
131
+ Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_secure' => true)));
132
+
133
+
134
+
135
+ $this->getOnepage()->initCheckout();
136
+ $this->loadLayout();
137
+ $this->_initLayoutMessages('customer/session');
138
+ $this->getLayout()->getBlock('head')->setTitle($this->__(Mage::getStoreConfig(self::XML_PATH_TITLE)));
139
+ $this->renderLayout();
140
+ }
141
+
142
+ /**
143
+ * Check can page show for unregistered users
144
+ *
145
+ * @return boolean
146
+ */
147
+ protected function _canShowForUnregisteredUsers()
148
+ {
149
+ return Mage::getSingleton('customer/session')->isLoggedIn()
150
+ || $this->getRequest()->getActionName() == 'index'
151
+ || Mage::helper('checkout')->isAllowedGuestCheckout($this->getOnepage()->getQuote())
152
+ || !Mage::helper('checkout')->isCustomerMustBeLogged();
153
+ }
154
+ }
app/code/community/Abserve/Opc/controllers/JsonController.php ADDED
@@ -0,0 +1,752 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_JsonController extends Mage_Core_Controller_Front_Action{
3
+
4
+ const XML_PATH_DEFAULT_PAYMENT = 'opc/default/payment';
5
+
6
+ /* @var $_order Mage_Sales_Model_Order */
7
+ protected $_order;
8
+
9
+ /**
10
+ * Get Order by quoteId
11
+ *
12
+ * @return Mage_Sales_Model_Order
13
+ */
14
+ protected function _getOrder(){
15
+ if (is_null($this->_order)) {
16
+ $this->_order = Mage::getModel('sales/order')->load($this->getOnepage()->getQuote()->getId(), 'quote_id');
17
+ if (!$this->_order->getId()) {
18
+ throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Can not create invoice. Order was not found."));
19
+ }
20
+ }
21
+ return $this->_order;
22
+ }
23
+
24
+ /**
25
+ * Create invoice
26
+ *
27
+ * @return Mage_Sales_Model_Order_Invoice
28
+ */
29
+ protected function _initInvoice()
30
+ {
31
+ $items = array();
32
+ foreach ($this->_getOrder()->getAllItems() as $item) {
33
+ $items[$item->getId()] = $item->getQtyOrdered();
34
+ }
35
+ /* @var $invoice Mage_Sales_Model_Service_Order */
36
+ $invoice = Mage::getModel('sales/service_order', $this->_getOrder())->prepareInvoice($items);
37
+ $invoice->setEmailSent(true)->register();
38
+
39
+ Mage::register('current_invoice', $invoice);
40
+ return $invoice;
41
+ }
42
+
43
+
44
+
45
+ protected function _getCart(){
46
+ return Mage::getSingleton('checkout/cart');
47
+ }
48
+
49
+
50
+ protected function _getSession(){
51
+ return Mage::getSingleton('checkout/session');
52
+ }
53
+
54
+ protected function _getQuote(){
55
+ return $this->_getCart()->getQuote();
56
+ }
57
+
58
+ /**
59
+ * Get one page checkout model
60
+ *
61
+ * @return Mage_Checkout_Model_Type_Onepage
62
+ */
63
+ public function getOnepage(){
64
+ return Mage::getSingleton('checkout/type_onepage');
65
+ }
66
+
67
+ protected function _ajaxRedirectResponse(){
68
+ $this->getResponse()
69
+ ->setHeader('HTTP/1.1', '403 Session Expired')
70
+ ->setHeader('Login-Required', 'true')
71
+ ->sendResponse();
72
+ return $this;
73
+ }
74
+
75
+ /**
76
+ * Validate ajax request and redirect on failure
77
+ *
78
+ * @return bool
79
+ */
80
+ protected function _expireAjax(){
81
+
82
+ if (!$this->getRequest()->isAjax()){
83
+ $this->_redirectUrl(Mage::getBaseUrl('link', true));
84
+ return;
85
+ }
86
+
87
+ if (!$this->getOnepage()->getQuote()->hasItems() || $this->getOnepage()->getQuote()->getHasError() || $this->getOnepage()->getQuote()->getIsMultiShipping()) {
88
+ $this->_ajaxRedirectResponse();
89
+ return true;
90
+ }
91
+
92
+ $action = $this->getRequest()->getActionName();
93
+ if (Mage::getSingleton('checkout/session')->getCartWasUpdated(true) && !in_array($action, array('index', 'progress'))) {
94
+ $this->_ajaxRedirectResponse();
95
+ return true;
96
+ }
97
+
98
+ return false;
99
+ }
100
+
101
+ /**
102
+ * Get shipping method step html
103
+ *
104
+ * @return string
105
+ */
106
+ protected function _getShippingMethodsHtml(){
107
+ $layout = $this->getLayout();
108
+ $update = $layout->getUpdate();
109
+ $update->load('checkout_onepage_index');
110
+ $layout->generateXml();
111
+ $layout->generateBlocks();
112
+ $shippingMethods = $layout->getBlock('checkout.onepage.shipping_method');
113
+ $shippingMethods->setTemplate('opc/onepage/shipping_method.phtml');
114
+ return $shippingMethods->toHtml();
115
+ }
116
+
117
+ /**
118
+ * Get payments method step html
119
+ *
120
+ * @return string
121
+ */
122
+ protected function _getPaymentMethodsHtml($use_method = false, $just_save = false){
123
+
124
+ /** UPDATE PAYMENT METHOD **/
125
+ if($use_method && $use_method != -1)
126
+ $apply_method = $use_method;
127
+ else
128
+ {
129
+ if($use_method == -1)
130
+ $apply_method = Mage::getStoreConfig(self::XML_PATH_DEFAULT_PAYMENT);
131
+ else
132
+ {
133
+ $apply_method = Mage::helper('opc')->getSelectedPaymentMethod();
134
+ if(empty($apply_method))
135
+ $apply_method = Mage::getStoreConfig(self::XML_PATH_DEFAULT_PAYMENT);
136
+ }
137
+ }
138
+
139
+ $_cart = $this->_getCart();
140
+ $_quote = $_cart->getQuote();
141
+ $_quote->getPayment()->setMethod($apply_method);
142
+ $_quote->setTotalsCollectedFlag(false)->collectTotals();
143
+ $_quote->save();
144
+
145
+ if($just_save)
146
+ return '';
147
+
148
+ $layout = $this->getLayout();
149
+ $update = $layout->getUpdate();
150
+ $update->load('checkout_onepage_paymentmethod');
151
+ $layout->generateXml();
152
+ $layout->generateBlocks();
153
+ $output = $layout->getOutput();
154
+ return $output;
155
+ }
156
+
157
+ /**
158
+ * Get review step html
159
+ *
160
+ * @return string
161
+ */
162
+ protected function _getReviewHtml(){
163
+
164
+ //clear cache
165
+ Mage::app()->getCacheInstance()->cleanType('layout');
166
+
167
+ $layout = $this->getLayout();
168
+ $update = $layout->getUpdate();
169
+ $update->load('checkout_onepage_review');
170
+ $layout->generateXml();
171
+ $layout->generateBlocks();
172
+ $review = $layout->getBlock('root');
173
+ $review->setTemplate('opc/onepage/review/info.phtml');
174
+
175
+ //clear cache
176
+ Mage::app()->getCacheInstance()->cleanType('layout');
177
+ return $review->toHtml();
178
+ }
179
+
180
+
181
+ private function checkNewslatter(){
182
+ $data = $this->getRequest()->getParams();
183
+ if (isset($data['is_subscribed']) && $data['is_subscribed']==1){
184
+ Mage::getSingleton('core/session')->setIsSubscribed(true);
185
+ }else{
186
+ Mage::getSingleton('core/session')->unsIsSubscribed();
187
+ }
188
+ }
189
+
190
+
191
+ public function saveBillingAction(){
192
+
193
+ if ($this->_expireAjax()) {
194
+ return;
195
+ }
196
+
197
+
198
+ if ($this->getRequest()->isPost()) {
199
+
200
+ $data = $this->getRequest()->getPost('billing', array());
201
+
202
+
203
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()){
204
+ if (isset($data['create_account']) && $data['create_account']==1){
205
+ $this->getOnepage()->saveCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER);
206
+ }else{
207
+ $this->getOnepage()->saveCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_GUEST);
208
+ unset($data['customer_password']);
209
+ unset($data['confirm_password']);
210
+ }
211
+ }else{
212
+ $this->getOnepage()->saveCheckoutMethod(Mage_Checkout_Model_Type_Onepage::METHOD_CUSTOMER);
213
+ }
214
+
215
+
216
+
217
+ $this->checkNewslatter();
218
+
219
+
220
+ $customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
221
+
222
+ if (isset($data['email'])) {
223
+ $data['email'] = trim($data['email']);
224
+ }
225
+
226
+ // get grand totals before
227
+ $totals_before = $this->_getSession()->getQuote()->getGrandTotal();
228
+
229
+ /// get list of available methods before billing changes
230
+ $methods_before = Mage::helper('opc')->getAvailablePaymentMethods();
231
+ ///////
232
+
233
+ $result = $this->getOnepage()->saveBilling($data, $customerAddressId);
234
+
235
+ if (!isset($result['error'])) {
236
+ /* check quote for virtual */
237
+ if ($this->getOnepage()->getQuote()->isVirtual()) {
238
+ $result['isVirtual'] = true;
239
+ };
240
+
241
+ //load shipping methods block if shipping as billing;
242
+ $data = $this->getRequest()->getPost('billing', array());
243
+ if (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
244
+ $result['shipping'] = $this->_getShippingMethodsHtml();
245
+ }
246
+
247
+ /// get list of available methods after discount changes
248
+ $methods_after = Mage::helper('opc')->getAvailablePaymentMethods();
249
+ ///////
250
+
251
+ // check if need to reload payment methods
252
+ $use_method = Mage::helper('opc')->checkUpdatedPaymentMethods($methods_before, $methods_after);
253
+
254
+ if($use_method != -1)
255
+ {
256
+ if(empty($use_method))
257
+ $use_method = -1;
258
+
259
+ // just save new method, (because retuned html is empty)
260
+ $result['payments'] = $this->_getPaymentMethodsHtml($use_method, true);
261
+ // and need to send reload method request
262
+ $result['reload_payments'] = true;
263
+ }
264
+ /////
265
+
266
+ // get grand totals after
267
+ $totals_after = $this->_getSession()->getQuote()->getGrandTotal();
268
+
269
+ if($totals_before != $totals_after)
270
+ $result['reload_totals'] = true;
271
+
272
+ }else{
273
+
274
+ $responseData['error'] = true;
275
+ $responseData['message'] = $result['message'];
276
+ }
277
+ $this->getResponse()->setHeader('Content-type','application/json', true);
278
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
279
+ }
280
+ }
281
+
282
+
283
+ /**
284
+ * Shipping save action
285
+ */
286
+ public function saveShippingAction(){
287
+ if ($this->_expireAjax()) {
288
+ return;
289
+ }
290
+
291
+ //TODO create response if post not exist
292
+ $responseData = array();
293
+
294
+ $result = array();
295
+
296
+ if ($this->getRequest()->isPost()) {
297
+ // get grand totals after
298
+ $totals_before = $this->_getSession()->getQuote()->getGrandTotal();
299
+
300
+ $data = $this->getRequest()->getPost('shipping', array());
301
+ $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
302
+ $result = $this->getOnepage()->saveShipping($data, $customerAddressId);
303
+
304
+ if (isset($result['error'])){
305
+ $responseData['error'] = true;
306
+ $responseData['message'] = $result['message'];
307
+ $responseData['messageBlock'] = 'shipping';
308
+ }else{
309
+
310
+ $responseData['shipping'] = $this->_getShippingMethodsHtml();
311
+
312
+ // get grand totals after
313
+ $totals_after = $this->_getSession()->getQuote()->getGrandTotal();
314
+
315
+ if($totals_before != $totals_after)
316
+ $responseData['reload_totals'] = true;
317
+ }
318
+ }
319
+
320
+ $this->getResponse()->setHeader('Content-type','application/json', true);
321
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($responseData));
322
+
323
+ }
324
+
325
+ /**
326
+ * reload available shipping methods based on address
327
+ */
328
+ public function reloadShippingsPaymentsAction(){
329
+
330
+ if ($this->_expireAjax()) {
331
+ return;
332
+ }
333
+
334
+ if ($this->getRequest()->isPost()) {
335
+
336
+ $result = array();
337
+
338
+ $address_type = false;
339
+ $billing = $this->getRequest()->getPost('billing', array());
340
+ if(!empty($billing) && is_array($billing) && isset($billing['address_id'])){
341
+ $address_type = 'billing';
342
+ $data = $billing;
343
+ }
344
+ else{
345
+ $address_type = 'shipping';
346
+ $data = $this->getRequest()->getPost('shipping', array());
347
+ }
348
+
349
+ // get grand totals after
350
+ $totals_before = $this->_getSession()->getQuote()->getGrandTotal();
351
+
352
+ /// get list of available methods before billing changes
353
+ $methods_before = Mage::helper('opc')->getAvailablePaymentMethods();
354
+ ///////
355
+
356
+ $customerAddressId = $this->getRequest()->getPost($address_type.'_address_id', false);
357
+ $cust_addr_id = $customerAddressId;
358
+
359
+ if($address_type == 'billing')
360
+ $address = $this->getOnepage()->getQuote()->getBillingAddress();
361
+ else
362
+ $address = $this->getOnepage()->getQuote()->getShippingAddress();
363
+
364
+ if (!empty($cust_addr_id))
365
+ {
366
+ $cust_addr = Mage::getModel('customer/address')->load($cust_addr_id);
367
+ if ($cust_addr->getId())
368
+ {
369
+ if ($cust_addr->getCustomerId() != $this->getOnepage()->getQuote()->getCustomerId())
370
+ $result = array('error' => 1, 'message' => Mage::helper('checkout')->__('Customer Address is not valid.'));
371
+ else
372
+ $address->importCustomerAddress($cust_addr);
373
+ }
374
+ }
375
+ else
376
+ {
377
+ unset($data['address_id']);
378
+ $address->addData($data);
379
+ }
380
+
381
+ if(!isset($result['error'])){
382
+ $address->implodeStreetAddress();
383
+
384
+ $ufs = 0;
385
+
386
+ if($address_type == 'billing'){
387
+ if (!$this->getOnepage()->getQuote()->isVirtual())
388
+ {
389
+ if(isset($data['use_for_shipping']))
390
+ $ufs = (int) $data['use_for_shipping'];
391
+
392
+ switch($ufs)
393
+ {
394
+ case 0:
395
+ $ship = $this->getOnepage()->getQuote()->getShippingAddress();
396
+ $ship->setSameAsBilling(0);
397
+ break;
398
+ case 1:
399
+ $bill = clone $address;
400
+ $bill->unsAddressId()->unsAddressType();
401
+ $ship = $this->getOnepage()->getQuote()->getShippingAddress();
402
+ $ship_method = $ship->getShippingMethod();
403
+ $ship->addData($bill->getData());
404
+ $ship->setSameAsBilling(1)->setShippingMethod($ship_method)->setCollectShippingRates(true);
405
+ break;
406
+ }
407
+ }
408
+ }
409
+ else
410
+ $address->setCollectShippingRates(true);
411
+
412
+ $this->getOnepage()->getQuote()->collectTotals()->save();
413
+
414
+ if ($this->getOnepage()->getQuote()->isVirtual())
415
+ $result['isVirtual'] = true;
416
+
417
+ if(($address_type == 'billing' && $ufs == 1) || $address_type == 'shipping')
418
+ $result['shipping'] = $this->_getShippingMethodsHtml();
419
+
420
+ /// get list of available methods after discount changes
421
+ $methods_after = Mage::helper('opc')->getAvailablePaymentMethods();
422
+ ///////
423
+
424
+ // check if need to reload payment methods
425
+ $use_method = Mage::helper('opc')->checkUpdatedPaymentMethods($methods_before, $methods_after);
426
+
427
+ if($use_method != -1)
428
+ {
429
+ if(empty($use_method))
430
+ $use_method = -1;
431
+
432
+ // just save new method, (because retuned html is empty)
433
+ $result['payments'] = $this->_getPaymentMethodsHtml($use_method, true);
434
+ // and need to send reload method request
435
+ $result['reload_payments'] = true;
436
+ }
437
+ else{
438
+ // get grand totals after
439
+ $totals_after = $this->_getSession()->getQuote()->getGrandTotal();
440
+
441
+ if($totals_before != $totals_after)
442
+ $result['reload_totals'] = true;
443
+ }
444
+ /////
445
+
446
+ }else{
447
+ $result['error'] = true;
448
+ $result['message'] = $result['message'];
449
+ }
450
+
451
+ $this->getResponse()->setHeader('Content-type','application/json', true);
452
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
453
+ }
454
+ }
455
+
456
+
457
+ /**
458
+ * Shipping method save action
459
+ */
460
+ public function saveShippingMethodAction(){
461
+ if ($this->_expireAjax()) {
462
+ return;
463
+ }
464
+ $responseData = array();
465
+
466
+ if ($this->getRequest()->isPost()) {
467
+
468
+ $this->checkNewslatter();
469
+
470
+ $data = $this->getRequest()->getPost('shipping_method', '');
471
+ $result = $this->getOnepage()->saveShippingMethod($data);
472
+ /*
473
+ $result will have erro data if shipping method is empty
474
+ */
475
+ if(!$result) {
476
+ Mage::dispatchEvent('checkout_controller_onepage_save_shipping_method',
477
+ array('request'=>$this->getRequest(),
478
+ 'quote'=>$this->getOnepage()->getQuote())
479
+ );
480
+
481
+ $this->getOnepage()->getQuote()->collectTotals();
482
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
483
+
484
+ $responseData['review'] = $this->_getReviewHtml();
485
+ $responseData['grandTotal'] = Mage::helper('opc')->getGrandTotal();
486
+ /*$result['update_section'] = array(
487
+ 'name' => 'payment-method',
488
+ 'html' => $this->_getPaymentMethodsHtml()
489
+ );*/
490
+ }
491
+ $this->getOnepage()->getQuote()->collectTotals()->save();
492
+
493
+
494
+
495
+ $this->getResponse()->setHeader('Content-type','application/json', true);
496
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($responseData));
497
+ }
498
+ }
499
+
500
+ public function reviewAction(){
501
+ if ($this->_expireAjax()) {
502
+ return;
503
+ }
504
+ $responseData = array();
505
+ $responseData['review'] = $this->_getReviewHtml();
506
+ $responseData['grandTotal'] = Mage::helper('opc')->getGrandTotal();
507
+ $this->getResponse()->setHeader('Content-type','application/json', true);
508
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($responseData));
509
+ }
510
+
511
+
512
+ public function paymentsAction(){
513
+ if ($this->_expireAjax()) {
514
+ return;
515
+ }
516
+ $responseData = array();
517
+ $responseData['payments'] = $this->_getPaymentMethodsHtml();
518
+ $this->getResponse()->setHeader('Content-type','application/json', true);
519
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($responseData));
520
+ }
521
+
522
+
523
+ public function savePaymentAction()
524
+ {
525
+ if ($this->_expireAjax()) {
526
+ return;
527
+ }
528
+
529
+ try {
530
+ /*if (!$this->getRequest()->isPost()) {
531
+ $this->_ajaxRedirectResponse();
532
+ return;
533
+ }*/
534
+
535
+ // set payment to quote
536
+ $result = array();
537
+ $data = $this->getRequest()->getPost('payment', array());
538
+ $result = $this->getOnepage()->savePayment($data);
539
+
540
+ // get section and redirect data
541
+ $redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
542
+ if (empty($result['error'])) {
543
+ $this->loadLayout('checkout_onepage_review');
544
+ $result['review'] = $this->_getReviewHtml();
545
+ $result['grandTotal'] = Mage::helper('opc')->getGrandTotal();
546
+ }
547
+ if ($redirectUrl) {
548
+ $result['redirect'] = $redirectUrl;
549
+ }
550
+ } catch (Mage_Payment_Exception $e) {
551
+ if ($e->getFields()) {
552
+ $result['fields'] = $e->getFields();
553
+ }
554
+ $result['error'] = $e->getMessage();
555
+ } catch (Mage_Core_Exception $e) {
556
+ $result['error'] = $e->getMessage();
557
+ } catch (Exception $e) {
558
+ Mage::logException($e);
559
+ $result['error'] = $this->__('Unable to set Payment Method.');
560
+ }
561
+
562
+ $this->getResponse()->setHeader('Content-type','application/json', true);
563
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
564
+ }
565
+
566
+
567
+
568
+ /**
569
+ * Create order action
570
+ */
571
+ public function saveOrderAction(){
572
+ if ($this->_expireAjax()) {
573
+ return;
574
+ }
575
+
576
+
577
+ $version = Mage::getVersionInfo();
578
+
579
+ $result = array();
580
+ try {
581
+ if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {
582
+ $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
583
+ if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
584
+ $result['error'] = $this->__('Please agree to all the terms and conditions before placing the order.');
585
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
586
+ return;
587
+ }
588
+ }
589
+
590
+
591
+ $data = $this->getRequest()->getPost('payment', false);
592
+ if ($data) {
593
+ /** Magento CE 1.8 version**/
594
+ if ($version['minor'] == 8){
595
+
596
+ $data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
597
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
598
+ | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
599
+ | Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
600
+ | Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
601
+
602
+ }
603
+ $this->getOnepage()->getQuote()->getPayment()->importData($data);
604
+ }
605
+
606
+ // save comments
607
+ if (Mage::helper('opc')->isShowComment())
608
+ {
609
+ $comment = $this->getRequest()->getPost('customer_comment', '');
610
+ if(empty($comment))
611
+ $comment = Mage::getSingleton('core/session')->getOpcOrderComment();
612
+ else
613
+ Mage::getSingleton('core/session')->setOpcOrderComment($comment);
614
+ }
615
+ ///
616
+
617
+ $this->getOnepage()->saveOrder();
618
+
619
+ /** Magento CE 1.6 version**/
620
+ if ($version['minor']==6){
621
+ $storeId = Mage::app()->getStore()->getId();
622
+ $paymentHelper = Mage::helper("payment");
623
+ $zeroSubTotalPaymentAction = $paymentHelper->getZeroSubTotalPaymentAutomaticInvoice($storeId);
624
+ if ($paymentHelper->isZeroSubTotal($storeId)
625
+ && $this->_getOrder()->getGrandTotal() == 0
626
+ && $zeroSubTotalPaymentAction == Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE
627
+ && $paymentHelper->getZeroSubTotalOrderStatus($storeId) == 'pending') {
628
+ $invoice = $this->_initInvoice();
629
+ $invoice->getOrder()->setIsInProcess(true);
630
+ $transactionSave = Mage::getModel('core/resource_transaction')
631
+ ->addObject($invoice)
632
+ ->addObject($invoice->getOrder());
633
+ $transactionSave->save();
634
+ }
635
+ }
636
+
637
+ $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
638
+
639
+ } catch (Mage_Payment_Model_Info_Exception $e) {
640
+
641
+ $message = $e->getMessage();
642
+
643
+ if (!empty($message)) {
644
+ $result['error'] = $message;
645
+ }
646
+
647
+ $result['payment'] = $this->_getPaymentMethodsHtml();
648
+
649
+ } catch (Mage_Core_Exception $e) {
650
+ Mage::logException($e);
651
+
652
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
653
+
654
+ $result['error'] = $e->getMessage();
655
+
656
+ $gotoSection = $this->getOnepage()->getCheckout()->getGotoSection();
657
+ if ($gotoSection) {
658
+ $this->getOnepage()->getCheckout()->setGotoSection(null);
659
+ }
660
+
661
+ $updateSection = $this->getOnepage()->getCheckout()->getUpdateSection();
662
+
663
+ if ($updateSection) {
664
+ $this->getOnepage()->getCheckout()->setUpdateSection(null);
665
+ }
666
+ } catch (Exception $e) {
667
+ Mage::logException($e);
668
+ Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
669
+ $result['error'] = $this->__('There was an error processing your order. Please contact us or try again later.');
670
+ }
671
+ $this->getOnepage()->getQuote()->save();
672
+ /**
673
+ * when there is redirect to third party, we don't want to save order yet.
674
+ * we will save the order in return action.
675
+ */
676
+ if (isset($redirectUrl) && !empty($redirectUrl)) {
677
+ $result['redirect'] = $redirectUrl;
678
+ }else{
679
+ $result['redirect'] = Mage::getUrl('checkout/onepage/success', array('_secure'=>true)) ;
680
+ }
681
+
682
+ $this->getResponse()->setHeader('Content-type','application/json', true);
683
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
684
+ }
685
+
686
+
687
+ /** TODO MOVE TO CUSTOMER CONTROLLER **/
688
+ protected function _getSessionCustomer(){
689
+ return Mage::getSingleton('customer/session');
690
+ }
691
+
692
+ public function forgotpasswordAction(){
693
+ $response = array();
694
+ $email = (string) $this->getRequest()->getPost('email');
695
+
696
+ if ($email) {
697
+ if (!Zend_Validate::is($email, 'EmailAddress')) {
698
+ $this->_getSessionCustomer()->setForgottenEmail($email);
699
+
700
+ $response['error'] = 1;
701
+ $response['message'] = $this->__('Invalid email address.');
702
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
703
+ return;
704
+ }
705
+
706
+ /** @var $customer Mage_Customer_Model_Customer */
707
+ $customer = Mage::getModel('customer/customer')
708
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
709
+ ->loadByEmail($email);
710
+
711
+ if ($customer->getId()) {
712
+ try {
713
+ $newResetPasswordLinkToken = Mage::helper('customer')->generateResetPasswordLinkToken();
714
+ $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
715
+ $customer->sendPasswordResetConfirmationEmail();
716
+ } catch (Exception $exception) {
717
+
718
+ $response['error'] = 1;
719
+ $response['message'] = $exception->getMessage();
720
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
721
+
722
+ return;
723
+ }
724
+ }
725
+ $response['message'] = Mage::helper('customer')->__('If there is an account associated with %s you will receive an email with a link to reset your password.', Mage::helper('customer')->htmlEscape($email));
726
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
727
+ return;
728
+ } else {
729
+
730
+
731
+ $response['error'] = 1;
732
+ $response['message'] = $this->__('Please enter your email.');
733
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
734
+
735
+ return;
736
+ }
737
+ }
738
+
739
+ public function commentAction(){
740
+ if ($this->_expireAjax()) {
741
+ return;
742
+ }
743
+ $comment = $this->getRequest()->getParam('comment');
744
+ if (!empty($comment)){
745
+ Mage::getSingleton('core/session')->setOpcOrderComment($comment);
746
+ }else{
747
+ Mage::getSingleton('core/session')->unsOpcOrderComment($comment);
748
+ }
749
+ return;
750
+ }
751
+
752
+ }
app/code/community/Abserve/Opc/controllers/PaypalController.php ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_PaypalController extends Mage_Core_Controller_Front_Action{
3
+
4
+ protected function _getSession() {
5
+ return Mage::getSingleton ( 'customer/session' );
6
+ }
7
+
8
+ protected function _getHelper() {
9
+ return Mage::helper ( 'opc/paypal' );
10
+ }
11
+
12
+ /** SHOW LOGIN FORM - REDIRECT FROM MAGENTO STORE TO PAYPAL LOGIN URL**/
13
+ public function loginAction() {
14
+
15
+ $_helper = $this->_getHelper ();
16
+ $this->_redirectUrl($_helper->getAuthUrl ());
17
+ }
18
+
19
+ public function returnAction() {
20
+
21
+ $_helper = $this->_getHelper ();
22
+ $_params = $this->getRequest()->getParams();
23
+
24
+ try{
25
+
26
+ if (isset($_params['code'])){
27
+
28
+ $_helper->getAccessToken ($_params);
29
+ $profile = $_helper->getPayPalProfile ();
30
+
31
+ }else{
32
+
33
+ if (isset ( $_params ['error_uri'] )) {
34
+ $this->_getSession ()->addError ( $_params['error_description']);
35
+ $this->_closePopup ( $this->_getloginPostRedirect () );
36
+ return;;
37
+ } else {
38
+
39
+ $url = $_helper->getAuthUrl ();
40
+ $this->_redirectUrl($url);
41
+ return;;
42
+ }
43
+ }
44
+
45
+ }catch(Exception $e){
46
+ $this->_getSession ()->addError ( $this->__($e->getMessage()) );
47
+ $this->_closePopup ( $this->_getloginPostRedirect () );
48
+ return;;
49
+ }
50
+
51
+
52
+ $paypalCustomerData = Mage::getModel ( 'opc/paypal_customer' )->getPaypalCustomerDataByField ( 'payer_id', $profile->getUserId() );
53
+
54
+ if (! $paypalCustomerData) {
55
+ // No Link exists create the link
56
+ if ($this->_getSession ()->isLoggedIn ()) {
57
+ $customer = $this->_getSession ()->getCustomer ();
58
+ } else {
59
+ $this->_getSession ()->setData ( 'paypalData', $profile );
60
+ $this->_getSession ()->setUsername ( $profile->getEmail() );
61
+ $url = Mage::getUrl ( 'onepage/paypal/askLink' );
62
+ $this->_closePopup ( $url );
63
+ return;
64
+ }
65
+
66
+ $paypalCustomer = $this->_getHelper ()->linkAccounts ( $profile, $customer );
67
+ $customer = $paypalCustomer->logInMagentoCustomerAccount ( $customer->getId () );
68
+ Mage::getSingleton('customer/session')->addSuccess ( $this->__ ( "Your %s account has been linked with your PayPal login.<br /><br />You account details are displayed below. No financial information will ever be shared by PayPal.<br /><br />Simply use Login with PayPal to login when you visit.", Mage::app ()->getStore ()->getFrontendName () ) );
69
+
70
+ } else {
71
+
72
+ // link exists so login to store
73
+ $paypalCustomer = Mage::getModel ( 'opc/paypal_customer' );
74
+ $customer = $paypalCustomer->logInMagentoCustomerAccount ( $paypalCustomerData ['customer_id'] );
75
+ }
76
+
77
+ $url = $this->_getloginPostRedirect ();
78
+ $this->_closePopup ( $url );
79
+
80
+
81
+ }
82
+
83
+ /**
84
+ * Define and return target URL and redirect customer after logging in
85
+ *
86
+ * @return
87
+ *
88
+ */
89
+ protected function _getloginPostRedirect() {
90
+ $session = $this->_getSession ();
91
+ if (! $session->getBeforeAuthUrl () || $session->getBeforeAuthUrl () == Mage::getBaseUrl ()) {
92
+ // Set default URL to redirect customer to
93
+ $session->setBeforeAuthUrl ( Mage::helper ( 'customer' )->getAccountUrl () );
94
+ // Redirect customer to the last page visited after logging in
95
+ if ($session->isLoggedIn ()) {
96
+ if (! Mage::getStoreConfigFlag ( 'customer/startup/redirect_dashboard' )) {
97
+ $referer = $this->getRequest ()->getParam ( Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME );
98
+ if ($referer) {
99
+ $referer = Mage::helper ( 'core' )->urlDecode ( $referer );
100
+ if ($this->_isUrlInternal ( $referer )) {
101
+ $session->setBeforeAuthUrl ( $referer );
102
+ }
103
+ }
104
+ } else if ($session->getAfterAuthUrl ()) {
105
+ $session->setBeforeAuthUrl ( $session->getAfterAuthUrl ( true ) );
106
+ }
107
+ } else {
108
+ $session->setBeforeAuthUrl ( Mage::helper ( 'customer' )->getLoginUrl () );
109
+ }
110
+ } else if ($session->getBeforeAuthUrl () == Mage::helper ( 'customer' )->getLogoutUrl ()) {
111
+ $session->setBeforeAuthUrl ( Mage::helper ( 'customer' )->getDashboardUrl () );
112
+ } else {
113
+ $afterAuthUrl = $session->getAfterAuthUrl ();
114
+ if (! $session->getAfterAuthUrl () || empty ( $afterAuthUrl )) {
115
+ $session->setAfterAuthUrl ( $session->getBeforeAuthUrl () );
116
+ }
117
+ if ($session->isLoggedIn ()) {
118
+ $session->setBeforeAuthUrl ( $session->getAfterAuthUrl ( true ) );
119
+ }
120
+ }
121
+ return $session->getBeforeAuthUrl ( true );
122
+ }
123
+
124
+
125
+ protected function _getLoginPostUrl() {
126
+ $session = $this->_getSession ();
127
+
128
+ if ($this->getRequest ()->isPost ()) {
129
+ $login = $this->getRequest ()->getPost ( 'login' );
130
+ if (! empty ( $login ['username'] ) && ! empty ( $login ['password'] )) {
131
+ try {
132
+ $session->login ( $login ['username'], $login ['password'] );
133
+ if ($session->getCustomer ()->getIsJustConfirmed ()) {
134
+ $this->_welcomeCustomer ( $session->getCustomer (), true );
135
+ }
136
+ } catch ( Mage_Core_Exception $e ) {
137
+ switch ($e->getCode ()) {
138
+ case Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED :
139
+ $value = Mage::helper ( 'customer' )->getEmailConfirmationUrl ( $login ['username'] );
140
+ $message = Mage::helper ( 'customer' )->__ ( 'This account is not confirmed. <a href="%s">Click here</a> to resend confirmation email.', $value );
141
+ break;
142
+ case Mage_Customer_Model_Customer::EXCEPTION_INVALID_EMAIL_OR_PASSWORD :
143
+ $message = $e->getMessage ();
144
+ $redirectUrl = 'onepage/paypal/askLink';
145
+ break;
146
+ default :
147
+ $message = $e->getMessage ();
148
+ }
149
+ $session->addError ( $message );
150
+ $session->setUsername ( $login ['username'] );
151
+ } catch ( Exception $e ) {
152
+ // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password
153
+ }
154
+ } else {
155
+ $session->addError ( $this->__ ( 'Login and password are required.' ) );
156
+ }
157
+ }
158
+ if (empty ( $redirectUrl )) {
159
+ $redirectUrl = $this->_getloginPostRedirect ();
160
+ }
161
+ return $redirectUrl;
162
+ }
163
+
164
+
165
+ public function unlinkAction() {
166
+ if ($this->_getSession ()->getCustomer ()->getId ()) {
167
+ $paypalCustomer = Mage::getModel ( 'opc/paypal_customer' )->unlinkAccount ();
168
+ $this->_getSession ()->addSuccess ( $this->_getHelper ()->__ ( "Your %s account is no longer linked with your PayPal login.", Mage::app ()->getStore ()->getFrontendName () ) );
169
+ }
170
+
171
+ $this->_redirect ( 'customer/account' );
172
+ return;
173
+ }
174
+
175
+
176
+ public function askLinkAction() {
177
+ $paypalData = $this->_getSession ()->getData ( 'paypalData' );
178
+ if (! $paypalData) {
179
+ $this->_redirect ( 'customer/account' );
180
+ return;
181
+ }
182
+
183
+ $msg = $this->_getSession ()->getMessages ( true );
184
+ $this->loadLayout ();
185
+ $this->getLayout ()->getMessagesBlock ()->addMessages ( $msg );
186
+ $this->_initLayoutMessages ( 'core/session' );
187
+ $this->renderLayout ();
188
+ }
189
+
190
+
191
+ public function askLinkPostAction() {
192
+
193
+ $params = $this->getRequest ()->getParams ();
194
+ $paypalData = $this->_getSession ()->getData ( 'paypalData' );
195
+
196
+ if (! $paypalData) {
197
+ $this->_redirect ( 'customer/account' );
198
+ return;
199
+ }
200
+
201
+ $askLinkUrl = 'onepage/paypal/askLink';
202
+
203
+ if (array_key_exists ( 'send', $params )) {
204
+ $login = $this->getRequest ()->getPost ( 'login' );
205
+ $email = $login ['username'];
206
+ $customerId = $this->_getCustomerIdByEmail ( $email );
207
+
208
+ $isPaypalCustomerExists = Mage::getModel ( 'opc/paypal_customer' )->isPaypalCustomerExists ( 'customer_id', $customerId );
209
+
210
+ if ($isPaypalCustomerExists) {
211
+ $this->_getSession ()->addError ( $this->_getHelper ()->__ ( "Your %s account is already linked with your PayPal login.", Mage::app ()->getStore ()->getFrontendName () ) );
212
+ $this->_redirect ( $askLinkUrl );
213
+ return;
214
+ }
215
+
216
+ $url = $this->_getLoginPostUrl ();
217
+ if ($url == 'onepage/paypal/askLink') {
218
+ $this->_redirect ( $url );
219
+ return;
220
+ }
221
+
222
+ $customer = $this->_getSession ()->getCustomer ();
223
+
224
+ $this->_getHelper ()->linkAccounts ( $paypalData, $customer );
225
+ Mage::getSingleton('customer/session')->addSuccess ( $this->__ ( "Your %s account has been linked with your PayPal login<br /><br />You account details are displayed below. No financial information will ever be shared by PayPal.<br /><br />Simply use Login with PayPal to login when you visit.", Mage::app ()->getStore ()->getFrontendName () ) );
226
+ } else {
227
+ $customer = Mage::getModel ( 'customer/customer' );
228
+ $paypalEmail = $paypalData->getEmail();
229
+
230
+ $customerId = $this->_getCustomerIdByEmail ( $paypalEmail );
231
+
232
+ if ($customerId) {
233
+ $this->_getSession ()->setUsername ( $paypalEmail );
234
+ $this->_getSession ()->addError ( $this->_getHelper ()->__ ( "An account already exists with that email address. Please enter the %s credentials to link the account.", Mage::app ()->getStore ()->getFrontendName () ) );
235
+ $this->_redirect ( $askLinkUrl );
236
+ return;
237
+ }
238
+ $url = $this->_getLoginPostRedirect ();
239
+
240
+ try {
241
+ $customer = $this->_getHelper ()->createMagentoCustomer ( $paypalData );
242
+ $paypalCustomer = $this->_getHelper ()->linkAccounts ( $paypalData, $customer );
243
+ $customer = $paypalCustomer->logInMagentoCustomerAccount ( $customer->getId () );
244
+ Mage::getSingleton('customer/session')->addSuccess (
245
+ $this->__ (
246
+ "Your account has been created.<br /><br />You account details are displayed below. No financial information will ever be shared by PayPal.<br /><br />Simply use Login with PayPal to login when you visit.",
247
+ Mage::app ()->getStore ()->getFrontendName () )
248
+ );
249
+ } catch ( Exception $e ) {
250
+ $this->_getSession ()->addError ( $e->getMessage () );
251
+ }
252
+ }
253
+ $this->_redirectUrl ( $url );
254
+ return;
255
+ }
256
+
257
+
258
+ protected function _getCustomerIdByEmail($email) {
259
+ $customer = Mage::getModel ( 'customer/customer' );
260
+ $customer->setWebsiteId ( Mage::app ()->getStore ()->getWebsiteId () )->loadByEmail ( $email );
261
+ if ($customer->getId ()) {
262
+ return $customer->getId ();
263
+ }
264
+ return false;
265
+ }
266
+
267
+
268
+ protected function _closePopUp($url = null) {
269
+ echo '<script type="text/javascript">window.opener.location.href="' . $url . '";self.close();</script>';
270
+ }
271
+ }
app/code/community/Abserve/Opc/controllers/VersionController.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Abserve_Opc_VersionController extends Mage_Core_Controller_Front_Action{
3
+
4
+ public function indexAction(){
5
+ $version = Mage::getConfig()->getModuleConfig("Abserve_Opc")->version;
6
+ echo 'Abserve OPC Version: ' . $version;
7
+ return;
8
+ }
9
+ }
app/code/community/Abserve/Opc/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <opc translate="title" module="opc">
12
+ <title>Abserve One Page Checkout</title>
13
+ <sort_order>70</sort_order>
14
+ </opc>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/Abserve/Opc/etc/config.xml ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Abserve_Opc>
5
+ <version>4.0.6</version>
6
+ </Abserve_Opc>
7
+ </modules>
8
+
9
+ <adminhtml>
10
+
11
+ <events>
12
+ <controller_action_predispatch>
13
+ <observers>
14
+ <opc_check_related>
15
+ <type>singleton</type>
16
+ <class>opc/observer</class>
17
+ <method>checkRequiredModules</method>
18
+ </opc_check_related>
19
+ </observers>
20
+ </controller_action_predispatch>
21
+ </events>
22
+
23
+ </adminhtml>
24
+
25
+ <frontend>
26
+ <routers>
27
+ <opc>
28
+ <use>standard</use>
29
+ <args>
30
+ <module>Abserve_Opc</module>
31
+ <frontName>onepage</frontName>
32
+ </args>
33
+ </opc>
34
+
35
+ <checkout>
36
+ <args>
37
+ <modules>
38
+ <opc before="Mage_Checkout_OnepageController">Abserve_Opc_Checkout</opc>
39
+ </modules>
40
+ </args>
41
+ </checkout>
42
+ </routers>
43
+
44
+ <layout>
45
+ <updates>
46
+ <opc>
47
+ <file>abserve_opc.xml</file>
48
+ </opc>
49
+ </updates>
50
+ </layout>
51
+
52
+ <translate>
53
+ <modules>
54
+ <Abserve_Opc>
55
+ <files>
56
+ <default>Abserve_Opc.csv</default>
57
+ </files>
58
+ </Abserve_Opc>
59
+ </modules>
60
+ </translate>
61
+
62
+ <events>
63
+
64
+ <controller_action_postdispatch_opc_json_saveOrder>
65
+ <observers>
66
+ <hss_save_order_onepage>
67
+ <class>paypal/observer</class>
68
+ <method>setResponseAfterSaveOrder</method>
69
+ </hss_save_order_onepage>
70
+ </observers>
71
+ </controller_action_postdispatch_opc_json_saveOrder>
72
+
73
+ <sales_order_place_after>
74
+ <observers>
75
+ <newsletter_order_place_after>
76
+ <class>opc/observer</class>
77
+ <method>newsletter</method>
78
+ </newsletter_order_place_after>
79
+ </observers>
80
+ </sales_order_place_after>
81
+
82
+ <checkout_type_onepage_save_order>
83
+ <observers>
84
+ <checkout_type_onepage_save_order>
85
+ <class>opc/observer</class>
86
+ <method>applyComment</method>
87
+ </checkout_type_onepage_save_order>
88
+ </observers>
89
+ </checkout_type_onepage_save_order>
90
+
91
+ </events>
92
+
93
+ </frontend>
94
+
95
+
96
+ <global>
97
+ <models>
98
+
99
+ <paypal>
100
+ <rewrite>
101
+ <api_nvp>Abserve_Opc_Model_Api_Nvp</api_nvp>
102
+ <express>Abserve_Opc_Model_Paypal_Express</express>
103
+ <config>Abserve_Opc_Model_Paypal_Config</config>
104
+ </rewrite>
105
+ </paypal>
106
+
107
+ <braintree_payments>
108
+ <rewrite>
109
+ <paymentmethod>Abserve_Opc_Model_Braintree_Paymentmethod</paymentmethod>
110
+ </rewrite>
111
+ </braintree_payments>
112
+
113
+ <opc>
114
+ <class>Abserve_Opc_Model</class>
115
+ <resourceModel>opc_resource</resourceModel>
116
+ </opc>
117
+
118
+ <opc_resource>
119
+ <class>Abserve_Opc_Model_Resource</class>
120
+ <entities>
121
+ <customer>
122
+ <table>paypalauth_customer</table>
123
+ </customer>
124
+ </entities>
125
+ </opc_resource>
126
+ </models>
127
+
128
+ <resources>
129
+
130
+ <opc_write>
131
+ <connection>
132
+ <use>core_write</use>
133
+ </connection>
134
+ </opc_write>
135
+
136
+ <opc_read>
137
+ <connection>
138
+ <use>core_read</use>
139
+ </connection>
140
+ </opc_read>
141
+
142
+ <opc_setup>
143
+ <setup>
144
+ <module>Abserve_Opc</module>
145
+ </setup>
146
+ <connection>
147
+ <use>core_setup</use>
148
+ </connection>
149
+ </opc_setup>
150
+
151
+ </resources>
152
+
153
+ <helpers>
154
+ <opc>
155
+ <class>Abserve_Opc_Helper</class>
156
+ </opc>
157
+ <checkout>
158
+ <rewrite>
159
+ <url>Abserve_Opc_Helper_Url</url>
160
+ </rewrite>
161
+ </checkout>
162
+ </helpers>
163
+
164
+ <blocks>
165
+
166
+ <opc>
167
+ <class>Abserve_Opc_Block</class>
168
+ </opc>
169
+
170
+ <customer>
171
+ <rewrite>
172
+ <account_dashboard_info>Abserve_Opc_Block_Customer_Account_Dashboard_Info</account_dashboard_info>
173
+ </rewrite>
174
+ </customer>
175
+
176
+ <checkout>
177
+ <rewrite>
178
+ <onepage_link>Abserve_Opc_Block_Onepage_Link</onepage_link>
179
+ </rewrite>
180
+ </checkout>
181
+
182
+ <paypal>
183
+ <rewrite>
184
+ <standard_form>Abserve_Opc_Block_Paypal_Standard_Form</standard_form>
185
+ <express_form>Abserve_Opc_Block_Paypal_Express_Form</express_form>
186
+ </rewrite>
187
+ </paypal>
188
+
189
+ </blocks>
190
+ </global>
191
+
192
+ <default>
193
+ <opc>
194
+ <global>
195
+ <title>Onepage Checkout</title>
196
+ <status>1</status>
197
+ </global>
198
+ <default>
199
+ <shipping>freeshipping_freeshipping</shipping>
200
+ <payment>checkmo</payment>
201
+ <subscribe>0</subscribe>
202
+ <subscribe_default>0</subscribe_default>
203
+ <show_shipping>1</show_shipping>
204
+ <terms_type>1</terms_type>
205
+ <comment>0</comment>
206
+ <discount>1</discount>
207
+ </default>
208
+ <geo>
209
+ <country>0</country>
210
+ <country_file>GeoIP.dat</country_file>
211
+ <city>0</city>
212
+ <city_file>GeoLiteCity.dat</city_file>
213
+ </geo>
214
+ <paypal>
215
+ <status>1</status>
216
+ <sandbox>0</sandbox>
217
+ </paypal>
218
+
219
+ <paypallogin>
220
+ <status>0</status>
221
+ <sandbox>0</sandbox>
222
+ </paypallogin>
223
+ </opc>
224
+ </default>
225
+ </config>
app/code/community/Abserve/Opc/etc/system.xml ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <abserveall>
5
+ <label>Abserve Extensions</label>
6
+ <sort_order>210</sort_order>
7
+ <class>abserve-block</class>
8
+ </abserveall>
9
+ </tabs>
10
+ <sections>
11
+ <opc translate="label" module="contacts">
12
+ <label>One Page Checkout</label>
13
+ <tab>abserveall</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>100</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <global translate="label">
21
+ <label>Global</label>
22
+ <sort_order>5</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
+ <expanded>1</expanded>
27
+ <fields>
28
+ <info>
29
+ <label>Version</label>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>0</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <frontend_model>opc/system_config_form_fieldset_extensions
34
+ </frontend_model>
35
+ </info>
36
+ <status>
37
+ <label>Enable Module?</label>
38
+ <frontend_type>select</frontend_type>
39
+ <source_model>adminhtml/system_config_source_yesno</source_model>
40
+ <sort_order>10</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ <validate>required-entry</validate>
45
+ </status>
46
+ <title translate="label">
47
+ <label>Title</label>
48
+ <frontend_type>text</frontend_type>
49
+ <isrequired>true</isrequired>
50
+ <sort_order>20</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
+ </title>
55
+ </fields>
56
+ </global>
57
+
58
+ <default translate="label">
59
+ <label>Default Settings</label>
60
+ <sort_order>20</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
+ <expanded>0</expanded>
65
+ <fields>
66
+ <!-- shipping translate="label">
67
+ <label>Default Shipping Method</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>opc/system_config_source_shipping_allmethods</source_model>
70
+ <isrequired>true</isrequired>
71
+ <sort_order>10</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ </shipping -->
74
+
75
+ <payment translate="label">
76
+ <label>Default Payment Method</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>adminhtml/system_config_source_payment_allmethods</source_model>
79
+ <isrequired>true</isrequired>
80
+ <sort_order>20</sort_order>
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ </payment>
85
+
86
+ <subscribe>
87
+ <label>Show Subscribe to Newsletter</label>
88
+ <frontend_type>select</frontend_type>
89
+ <source_model>adminhtml/system_config_source_yesno</source_model>
90
+ <isrequired>true</isrequired>
91
+ <sort_order>30</sort_order>
92
+ <show_in_default>1</show_in_default>
93
+ <show_in_website>1</show_in_website>
94
+ <show_in_store>1</show_in_store>
95
+ </subscribe>
96
+
97
+ <subscribe_default>
98
+ <label>Check Subscribe to Newsletter by default</label>
99
+ <frontend_type>select</frontend_type>
100
+ <source_model>adminhtml/system_config_source_yesno</source_model>
101
+ <isrequired>true</isrequired>
102
+ <sort_order>40</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </subscribe_default>
107
+
108
+ <show_shipping>
109
+ <label>Show Shipping Address Form</label>
110
+ <frontend_type>select</frontend_type>
111
+ <source_model>adminhtml/system_config_source_yesno</source_model>
112
+ <isrequired>true</isrequired>
113
+ <sort_order>50</sort_order>
114
+ <show_in_default>1</show_in_default>
115
+ <show_in_website>1</show_in_website>
116
+ <show_in_store>1</show_in_store>
117
+ </show_shipping>
118
+
119
+
120
+ <terms_type>
121
+ <label>Terms and Conditions Output type</label>
122
+ <frontend_type>select</frontend_type>
123
+ <source_model>opc/system_config_source_terms</source_model>
124
+ <isrequired>true</isrequired>
125
+ <sort_order>60</sort_order>
126
+ <show_in_default>1</show_in_default>
127
+ <show_in_website>1</show_in_website>
128
+ <show_in_store>1</show_in_store>
129
+ </terms_type>
130
+
131
+ <comment>
132
+ <label>Show comment field? </label>
133
+ <frontend_type>select</frontend_type>
134
+ <source_model>adminhtml/system_config_source_yesno</source_model>
135
+ <isrequired>true</isrequired>
136
+ <sort_order>70</sort_order>
137
+ <show_in_default>1</show_in_default>
138
+ <show_in_website>1</show_in_website>
139
+ <show_in_store>1</show_in_store>
140
+ </comment>
141
+
142
+ <discount>
143
+ <label>Show discount form? </label>
144
+ <frontend_type>select</frontend_type>
145
+ <source_model>adminhtml/system_config_source_yesno</source_model>
146
+ <isrequired>true</isrequired>
147
+ <sort_order>80</sort_order>
148
+ <show_in_default>1</show_in_default>
149
+ <show_in_website>1</show_in_website>
150
+ <show_in_store>1</show_in_store>
151
+ </discount>
152
+
153
+ </fields>
154
+ </default>
155
+
156
+ <geo>
157
+ <label>GEO IP</label>
158
+ <sort_order>30</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>1</show_in_store>
162
+ <expanded>1</expanded>
163
+ <fields>
164
+ <country>
165
+ <label>Enable Country Detection</label>
166
+ <frontend_type>select</frontend_type>
167
+ <source_model>adminhtml/system_config_source_yesno</source_model>
168
+ <isrequired>true</isrequired>
169
+ <sort_order>10</sort_order>
170
+ <show_in_default>1</show_in_default>
171
+ <show_in_website>1</show_in_website>
172
+ <show_in_store>1</show_in_store>
173
+ </country>
174
+ <country_file translate="label comment">
175
+ <label>GeoIp filename</label>
176
+ <comment><![CDATA[<a href='http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz' title='Download GeoIP database'>Download</a> and unzip file under the 'MAGETO_ROOT/lib/MaxMind/GeoIP/data' folder if you don't have it]]></comment>
177
+ <frontend_type>text</frontend_type>
178
+ <sort_order>20</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>1</show_in_website>
181
+ <show_in_store>1</show_in_store>
182
+ </country_file>
183
+ <city>
184
+ <label>Enable City Detection</label>
185
+ <frontend_type>select</frontend_type>
186
+ <source_model>adminhtml/system_config_source_yesno</source_model>
187
+ <isrequired>true</isrequired>
188
+ <sort_order>30</sort_order>
189
+ <show_in_default>1</show_in_default>
190
+ <show_in_website>1</show_in_website>
191
+ <show_in_store>1</show_in_store>
192
+ </city>
193
+ <city_file translate="label comment">
194
+ <label>GeoCity filename</label>
195
+ <comment><![CDATA[<a href='http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz' title='Download GeoCity database'>Download</a> and unzip file under the 'MAGETO_ROOT/lib/MaxMind/GeoIP/data' folder if you don't have it]]></comment>
196
+ <frontend_type>text</frontend_type>
197
+ <sort_order>40</sort_order>
198
+ <show_in_default>1</show_in_default>
199
+ <show_in_website>1</show_in_website>
200
+ <show_in_store>1</show_in_store>
201
+ </city_file>
202
+ </fields>
203
+ </geo>
204
+
205
+ <paypal>
206
+ <label>Paypal Express LightBox</label>
207
+ <sort_order>40</sort_order>
208
+ <show_in_default>1</show_in_default>
209
+ <expanded>1</expanded>
210
+ <fields>
211
+ <status>
212
+ <label>Enable Paypal Express Lightbox</label>
213
+ <frontend_type>select</frontend_type>
214
+ <source_model>adminhtml/system_config_source_yesno</source_model>
215
+ <isrequired>true</isrequired>
216
+ <sort_order>10</sort_order>
217
+ <show_in_default>1</show_in_default>
218
+ <show_in_website>1</show_in_website>
219
+ <show_in_store>1</show_in_store>
220
+ <comment><![CDATA[<span class="notice">The site must be securely hosted on an HTTPS server.</span>]]></comment>
221
+ </status>
222
+
223
+ <sandbox translate="label">
224
+ <label>Sandbox</label>
225
+ <frontend_type>select</frontend_type>
226
+ <source_model>adminhtml/system_config_source_yesno</source_model>
227
+ <sort_order>20</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ </sandbox>
232
+
233
+ </fields>
234
+ </paypal>
235
+
236
+ <paypallogin>
237
+ <label>Log in with PayPal</label>
238
+ <sort_order>50</sort_order>
239
+ <show_in_default>1</show_in_default>
240
+ <expanded>1</expanded>
241
+ <fields>
242
+ <status>
243
+ <label>Enable Log in with PayPal</label>
244
+ <frontend_type>select</frontend_type>
245
+ <source_model>adminhtml/system_config_source_yesno</source_model>
246
+ <isrequired>true</isrequired>
247
+ <sort_order>10</sort_order>
248
+ <show_in_default>1</show_in_default>
249
+ <show_in_website>1</show_in_website>
250
+ <show_in_store>1</show_in_store>
251
+ <comment><![CDATA[<span>To enable Log in with PayPal please add your SSL secured website to the PayPal whitelist. It is easy to setup by visiting <a href='https://developer.paypal.com/webapps/developer/docs/integration/direct/log-in-with-paypal/' target="_blank">this url</a> and following the instructions. After you are whitelisted you can enable your customers to Log in with PayPal.</span>]]></comment>
252
+ </status>
253
+
254
+ <clientid translate="label">
255
+ <label>Client ID</label>
256
+ <frontend_type>text</frontend_type>
257
+ <sort_order>20</sort_order>
258
+ <show_in_default>1</show_in_default>
259
+ <show_in_website>1</show_in_website>
260
+ <show_in_store>1</show_in_store>
261
+ </clientid>
262
+
263
+ <secret translate="label">
264
+ <label>Secret</label>
265
+ <frontend_type>text</frontend_type>
266
+ <sort_order>30</sort_order>
267
+ <show_in_default>1</show_in_default>
268
+ <show_in_website>1</show_in_website>
269
+ <show_in_store>1</show_in_store>
270
+ </secret>
271
+
272
+ <sandbox translate="label">
273
+ <label>Sandbox</label>
274
+ <frontend_type>select</frontend_type>
275
+ <source_model>adminhtml/system_config_source_yesno</source_model>
276
+ <sort_order>40</sort_order>
277
+ <show_in_default>1</show_in_default>
278
+ <show_in_website>1</show_in_website>
279
+ <show_in_store>1</show_in_store>
280
+ </sandbox>
281
+
282
+ </fields>
283
+ </paypallogin>
284
+
285
+ <design>
286
+ <label>Buttons color</label>
287
+ <sort_order>60</sort_order>
288
+ <show_in_default>1</show_in_default>
289
+ <expanded>1</expanded>
290
+ <fields>
291
+ <plbgcolor translate="label">
292
+ <label>Place Order and Login buttons background color</label>
293
+ <frontend_type>text</frontend_type>
294
+ <sort_order>20</sort_order>
295
+ <show_in_default>1</show_in_default>
296
+ <show_in_website>1</show_in_website>
297
+ <show_in_store>1</show_in_store>
298
+ <comment><![CDATA[<span>Please enter color HEX code, or leave empty.</span>]]></comment>
299
+ </plbgcolor>
300
+
301
+ <plovercolor translate="label">
302
+ <label>Place Order and Login buttons rollover color</label>
303
+ <frontend_type>text</frontend_type>
304
+ <sort_order>30</sort_order>
305
+ <show_in_default>1</show_in_default>
306
+ <show_in_website>1</show_in_website>
307
+ <show_in_store>1</show_in_store>
308
+ <comment><![CDATA[<span>Please enter color HEX code, or leave empty.</span>]]></comment>
309
+ </plovercolor>
310
+
311
+ <pltextcolor translate="label">
312
+ <label>Place Order and Login buttons text color</label>
313
+ <frontend_type>text</frontend_type>
314
+ <sort_order>40</sort_order>
315
+ <show_in_default>1</show_in_default>
316
+ <show_in_website>1</show_in_website>
317
+ <show_in_store>1</show_in_store>
318
+ <comment><![CDATA[<span>Please enter color HEX code, or leave empty.</span>]]></comment>
319
+ </pltextcolor>
320
+
321
+ <plhovertextcolor translate="label">
322
+ <label>Place Order and Login buttons text rollover color</label>
323
+ <frontend_type>text</frontend_type>
324
+ <sort_order>50</sort_order>
325
+ <show_in_default>1</show_in_default>
326
+ <show_in_website>1</show_in_website>
327
+ <show_in_store>1</show_in_store>
328
+ <comment><![CDATA[<span>Please enter color HEX code, or leave empty.</span>]]></comment>
329
+ </plhovertextcolor>
330
+
331
+ <btnbgcolor translate="label">
332
+ <label>Other buttons background color</label>
333
+ <frontend_type>text</frontend_type>
334
+ <sort_order>60</sort_order>
335
+ <show_in_default>1</show_in_default>
336
+ <show_in_website>1</show_in_website>
337
+ <show_in_store>1</show_in_store>
338
+ <comment><![CDATA[<span>Please enter color HEX code, or leave empty.</span>]]></comment>
339
+ </btnbgcolor>
340
+
341
+ <btnovercolor translate="label">
342
+ <label>Other buttons rollover color</label>
343
+ <frontend_type>text</frontend_type>
344
+ <sort_order>70</sort_order>
345
+ <show_in_default>1</show_in_default>
346
+ <show_in_website>1</show_in_website>
347
+ <show_in_store>1</show_in_store>
348
+ <comment><![CDATA[<span>Please enter color HEX code, or leave empty.</span>]]></comment>
349
+ </btnovercolor>
350
+
351
+ <btntextcolor translate="label">
352
+ <label>Other buttons text color</label>
353
+ <frontend_type>text</frontend_type>
354
+ <sort_order>80</sort_order>
355
+ <show_in_default>1</show_in_default>
356
+ <show_in_website>1</show_in_website>
357
+ <show_in_store>1</show_in_store>
358
+ <comment><![CDATA[<span>Please enter color HEX code, or leave empty.</span>]]></comment>
359
+ </btntextcolor>
360
+
361
+ <btnhovertextcolor translate="label">
362
+ <label>Other buttons text rollover color</label>
363
+ <frontend_type>text</frontend_type>
364
+ <sort_order>90</sort_order>
365
+ <show_in_default>1</show_in_default>
366
+ <show_in_website>1</show_in_website>
367
+ <show_in_store>1</show_in_store>
368
+ <comment><![CDATA[<span>Please enter color HEX code, or leave empty.</span>]]></comment>
369
+ </btnhovertextcolor>
370
+ </fields>
371
+ </design>
372
+
373
+ </groups>
374
+
375
+ </opc>
376
+ </sections>
377
+ </config>
app/code/community/Abserve/Opc/sql/opc_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $installer Mage_Catalog_Model_Resource_Eav_Mysql4_Setup */
3
+ $installer = $this;
4
+
5
+ $installer->startSetup();
6
+
7
+ $installer->run("
8
+ CREATE TABLE IF NOT EXISTS `{$installer->getTable('opc/customer')}`(
9
+ `id` INT(10) NOT NULL AUTO_INCREMENT,
10
+ `payer_id` VARCHAR(255) NOT NULL DEFAULT '',
11
+ `customer_id` INT(10) UNSIGNED NOT NULL,
12
+ `email` VARCHAR(255) NOT NULL DEFAULT '',
13
+ PRIMARY KEY (`id`),
14
+ UNIQUE KEY `IDX_UNIQUE_PAYER_ID` (`payer_id`),
15
+ UNIQUE KEY `IDX_UNIQUE_CUSTOMER_ID` (`customer_id`),
16
+ KEY `FK_CUSTOMER_PAYPAL_CUSTOMER_ID` (`customer_id`),
17
+ CONSTRAINT `FK_CUSTOMER_PAYPAL_CUSTOMER_ID` FOREIGN KEY (`customer_id`) REFERENCES `{$installer->getTable('customer_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19
+ ");
20
+
21
+ $installer->endSetup();
app/code/community/Abserve/Settings/controllers/IndexController.php CHANGED
@@ -6,6 +6,87 @@ class Abserve_Settings_IndexController extends Mage_Core_Controller_Front_Action
6
  $this->renderLayout();
7
  }
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  public function BannerAction(){
10
  $this->loadLayout();
11
  $this->renderLayout();
6
  $this->renderLayout();
7
  }
8
 
9
+ public function GetorderAction(){
10
+ ?>
11
+ <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
12
+ <script type="text/javascript">
13
+ stLight.options({
14
+ publisher:'12345',
15
+ });
16
+ </script>
17
+ <span class="st_facebook" st_summary="Nice meet" st_image="http://shoppezzy.com/yudala/skin/frontend/ma_bonnie/ma_bonnie3/images/logo.jpg" st_url="http://192.168.1.11/shoestore/settings/index/getorder" st_title="Testing!">
18
+ <img src="http://shoppezzy.com/yudala/skin/frontend/ma_bonnie/ma_bonnie3/images/logo.jpg" width="100">
19
+ </span>
20
+
21
+
22
+ <!-- <span class="st_twitter" st_url="http://sharethis.com" st_title="Testing!"></span>
23
+ <span class="st_linkedin" st_url="http://sharethis.com" st_title="Testing!"></span> -->
24
+ <?php
25
+ echo $currentUrl = Mage::helper('core/url')->getCurrentUrl();
26
+ echo "<br>";
27
+ echo $url = Mage::getSingleton('core/url')->parseUrl($currentUrl);
28
+ echo "<br>";
29
+ echo $path = $url->getPath();
30
+
31
+ /*$orderIncrementId = 100000006;
32
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
33
+ echo "order subtotal: ".$order->getSubtotal()."<br>";
34
+ echo "shipping: ".$order->getShippingAmount()."<br>";
35
+ echo "discount: ".$order->getDiscountAmount()."<br>";
36
+ echo "tax: ".$order->getTaxAmount()."<br>";
37
+ echo "grand total".$order->getGrandTotal()."<br><br><br>";
38
+
39
+ $orderItems = array();
40
+ foreach($order->getItemsCollection() as $item)
41
+ {
42
+
43
+ $row=array();
44
+ $row['sku'] = $item->getSku();
45
+ $row['original_price'] = $item->getOriginalPrice();
46
+ $row['price'] = $item->getPrice();
47
+ $row['qty_ordered']= (int)$item->getQtyOrdered();
48
+ $row['subtotal']= $item->getSubtotal();
49
+ $row['tax_amount']= $item->getTaxAmount();
50
+ $row['tax_percent']= $item->getTaxPercent();
51
+ $row['discount_amount']= $item->getDiscountAmount();
52
+ $row['row_total']= $item->getRowTotal();
53
+ $orderItems[]=$row;
54
+ }*/
55
+ /*echo "All items in the order:<br>".print_r($orderItems,true)."<br><br><br>";
56
+ echo 'Payment Method - '.$payment_method_code = $order->getPayment()->getMethodInstance()->getCode(); */
57
+ /*echo "name : ";
58
+ if($order->getCustomerId() === NULL){
59
+ echo "vddddd";
60
+ echo $order->getBillingAddress()->getFirstname();
61
+ echo "<br/>";
62
+ echo $order->getBillingAddress()->getLastname();
63
+ } else {
64
+ $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
65
+ echo $customer->getDefaultBillingAddress()->getFirstname();
66
+ echo "name : ";
67
+ echo "<br/>";
68
+ echo $customer->getDefaultBillingAddress()->getLastname();
69
+ }
70
+ echo "<br/>";echo "<br/>";echo "<br/>";echo "<br/>";
71
+
72
+ echo "sybmol".$orderSymbolCode = Mage::app()->getLocale()->currency($order->getOrderCurrencyCode())->getSymbol();*/
73
+
74
+ /*echo $order->getId();
75
+ echo "<br>";
76
+ echo $order->getCreatedAt();
77
+ $ordered_items = $order->getAllItems();
78
+ foreach($ordered_items as $item){
79
+ echo $item->getItemId();
80
+ echo "<br>";
81
+ echo $item->getSku();
82
+ echo "<br>";
83
+ echo $item->getQtyOrdered();
84
+ echo "<br>";
85
+ echo $item->getName();
86
+ echo "<br>";
87
+ } */
88
+ }
89
+
90
  public function BannerAction(){
91
  $this->loadLayout();
92
  $this->renderLayout();
app/design/adminhtml/default/default/layout/magenotification.xml DELETED
@@ -1,16 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <default>
4
- <reference name="head">
5
- <action method="addJs"><script>tinybox/tinybox.js</script></action>
6
- <action method="addCss"><stylesheet>css/tinybox/style.css</stylesheet></action>
7
- <action method="addCss"><stylesheet>css/abserve/magenotification.css</stylesheet></action>
8
- </reference>
9
- </default>
10
- <magenotification_adminhtml_feedback_index>
11
- <reference name="content">
12
- <block type="magenotification/adminhtml_feedback" name="extension_feedback" />
13
- </reference>
14
- </magenotification_adminhtml_feedback_index>
15
-
16
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/layout/onestepcheckout.xml DELETED
@@ -1,98 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout>
3
- <!-- <adminhtml_sales_order_view>
4
- <update handle="order_tab_info" />
5
- <reference name="order_tab_info">
6
- <action method="setTemplate"><template>onestepcheckout/info.phtml</template></action>
7
- </reference>
8
- </adminhtml_sales_order_view> -->
9
-
10
- <!-- Order -->
11
- <adminhtml_sales_order_view>
12
- <reference name="order_totals">
13
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
14
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckoutdiscount" />
15
- </reference>
16
- <reference name="order_item_extra_info">
17
- <block type="onestepcheckout/adminhtml_sales_order_view_tab_survey"
18
- as="onestepcheckout_order" />
19
- <block type="onestepcheckout/adminhtml_sales_order_view_tab_delivery"
20
- as="onestepcheckout_order" />
21
- </reference>
22
- </adminhtml_sales_order_view>
23
- <adminhtml_sales_order_invoice_new>
24
- <reference name="invoice_totals">
25
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
26
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckoutdiscount" />
27
- </reference>
28
- <!-- <reference name="order_item_extra_info">
29
- <block type="onestepcheckout/adminhtml_sales_order_view_tab_survey"
30
- as="onestepcheckout_invoice" />
31
- </reference> -->
32
- </adminhtml_sales_order_invoice_new>
33
- <adminhtml_sales_order_invoice_view>
34
- <reference name="invoice_totals">
35
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
36
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckoutdiscount" />
37
- </reference>
38
- </adminhtml_sales_order_invoice_view>
39
- <adminhtml_sales_order_creditmemo_new>
40
- <reference name="creditmemo_totals">
41
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
42
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckoutdiscount" />
43
- </reference>
44
- </adminhtml_sales_order_creditmemo_new>
45
- <adminhtml_sales_order_creditmemo_view>
46
- <reference name="creditmemo_totals">
47
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
48
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckoutdiscount" />
49
- </reference>
50
- </adminhtml_sales_order_creditmemo_view>
51
-
52
- <!-- Geoip -->
53
- <onestepcheckoutadmin_adminhtml_geoip_showgeoip>
54
- <reference name="content">
55
- <block type="onestepcheckout/adminhtml_geoip" template="onestepcheckout/geoip.phtml" name="geoip" />
56
- </reference>
57
- </onestepcheckoutadmin_adminhtml_geoip_showgeoip>
58
- <onestepcheckoutadmin_adminhtml_country_showcountryip>
59
- <reference name="content">
60
- <block type="onestepcheckout/adminhtml_country" template="onestepcheckout/country.phtml" name="country" />
61
- </reference>
62
- </onestepcheckoutadmin_adminhtml_country_showcountryip>
63
- <onestepcheckoutadmin_adminhtml_geoip_index>
64
- <reference name="head">
65
- <action method="addJs"><script>abserve/adminhtml/onestepcheckout/geoip.js</script></action>
66
- </reference>
67
- <reference name="head">
68
- <action method="addCss"><stylesheet>css/abserve/onestepcheckout.css</stylesheet></action>
69
- </reference>
70
- <reference name="content">
71
- <block type="onestepcheckout/adminhtml_geoipgrid" name="geoipgrid" />
72
- </reference>
73
- </onestepcheckoutadmin_adminhtml_geoip_index>
74
- <onestepcheckoutadmin_adminhtml_country_index>
75
- <reference name="head">
76
- <action method="addJs"><script>abserve/adminhtml/onestepcheckout/geoip.js</script></action>
77
- </reference>
78
- <reference name="head">
79
- <action method="addCss"><stylesheet>css/abserve/onestepcheckout.css</stylesheet></action>
80
- </reference>
81
- <reference name="content">
82
- <block type="onestepcheckout/adminhtml_countrygrid" name="countrygrid" />
83
- </reference>
84
- </onestepcheckoutadmin_adminhtml_country_index>
85
- <adminhtml_system_config_edit>
86
- <reference name="head">
87
- <action method="addJs">
88
- <script>abserve/onestepcheckout/colorpicker/prototype_colorpicker.js</script>
89
- </action>
90
- <action method="addJs">
91
- <script>abserve/onestepcheckout/colorpicker/config.js</script>
92
- </action>
93
- <action method="addCss">
94
- <stylesheet>css/abserve/onestepcheckout/prototype_colorpicker.css</stylesheet>
95
- </action>
96
- </reference>
97
- </adminhtml_system_config_edit>
98
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/magenotification/feedback/files.phtml DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
-
3
- ?>
4
- <div id="feedback_files">
5
- <input type="file" class="input-file" value="" name="file0" id="file0" >
6
- <button onclick="magenotificationAddMoreFile();" class="scalable add" type="button">
7
- <span><?php echo $this->__('Add More')?></span>
8
- </button>
9
- </div>
10
- <script type="text/javascript">
11
- var currentfile = 0;
12
- function magenotificationAddMoreFile(){
13
- currentfile++;
14
- var inputFile = '<br/><input type="file" class="input-file" value="" name="file'+currentfile+'" id="file'+currentfile+'">';
15
- $('feedback_files').insert(inputFile);
16
- }
17
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/magenotification/feedback/history.phtml DELETED
@@ -1,31 +0,0 @@
1
- <?php $messages = $this->getMessages() ?>
2
- <?php if(count($messages)): ?>
3
- <?php foreach($messages as $message): ?>
4
- <?php if((int)$message->getIsCustomer() == 1): ?>
5
- <br/>
6
- <?php if((int)$message->getIsSent() == 1): ?>
7
- <span class="grid-severity-notice" style="width: 150px;">
8
- <span><?php echo $this->__('Sent to').' '.Abserve_Magenotification_Model_Keygen::SERVER_NAME?></span>
9
- </span>
10
- <?php else: ?>
11
- <table><tr><td width="170">
12
- <span class="grid-severity-critical" style="width: 150px;"><span><?php echo $this->__('Not Sent')?></span></span>
13
- </td><td>
14
- <a href='<?php echo $this->getUrl('magenotification/adminhtml_feedback/resendmessage',array('id'=>$message->getId(),'feedback_id'=>$this->getFeedback()->getId(),'_secure'=>true)) ?>' >
15
- <?php echo $this->__('Resend')?>
16
- </a>
17
- </td></tr></table>
18
- <?php endif; ?>
19
- <?php endif; ?>
20
- <?php echo $this->getMessageTitle($message) ?>
21
- <br/>
22
- <pre><?php echo $message->getMessage() ?></pre>
23
- <br/>
24
- <?php if($attachedfiles = $message->getAttachedFile()): ?>
25
- <b><?php echo $this->__('Attached Files')?></b>
26
- <?php echo $attachedfiles ?>
27
- <?php endif; ?>
28
- <br/>
29
- <hr style="border: 1px dashed rgb(204, 204, 204);"/>
30
- <?php endforeach; ?>
31
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/magenotification/license/licenseinfo.phtml DELETED
@@ -1,68 +0,0 @@
1
- <?php
2
- /**
3
- * License Info Template
4
- * @see Abserve_Magenotification_Block_Config_Licenseinfo
5
- */
6
- ?>
7
- <strong><label for="<?php echo $this->getExtensionName() ?>_license_info"><?php echo $this->__('License Serial') ?>:</label></strong>
8
- <?php if ($this->getLicenseSerial()): ?>
9
- <?php echo $this->getLicenseSerial() ?>
10
- <br/>
11
- <?php else: ?>
12
- <?php $_serial = $this->getConfigLicenseSerial() ?>
13
- <a href="#" onclick="return <?php echo $this->getExtensionName() ?>ChangeLicense(this);" style="text-decoration: none;<?php if (!$_serial): ?> display: none;<?php endif ?>">
14
- <?php echo $_serial ?>
15
- <br/>
16
- </a>
17
- <span id="<?php echo $this->getExtensionName() ?>_license_input"<?php if ($_serial): ?> style="display: none;"<?php endif ?>>
18
- <input id="<?php echo $this->getExtensionName() ?>_license_info" name="groups[extension_serials][fields][<?php echo $this->getExtensionName() ?>][value]" value="<?php echo $_serial ?>" style="width: 154px;" type="text" class="input-text" />
19
- <p class="note" style="margin-left: 86px;">
20
- <?php echo $this->__('get license serial from') ?>
21
- <a href="https://www.abserve.com/licensemanager/license/certificates" title="<?php echo $this->__('get license serial') ?>" target="_blank"><?php echo $this->__('here') ?></a>
22
- </p>
23
- </span>
24
- <script type="text/javascript">
25
- function <?php echo $this->getExtensionName() ?>ChangeLicense(el) {
26
- el.hide();
27
- $('<?php echo $this->getExtensionName() ?>_license_input').show();
28
- return false;
29
- }
30
- </script>
31
- <?php endif ?>
32
-
33
- <strong><?php echo $this->__('License Type') ?>:</strong>
34
- <?php
35
- switch ($this->getLicenseType()) {
36
- case Abserve_Magenotification_Model_Config::COMMERCIAL_LICENSE:
37
- echo $this->__('commercial for one Magento Installation');
38
- break;
39
- case Abserve_Magenotification_Model_Config::TRIAL_LICENSE:
40
- echo $this->__('Trial for one Magento Installation');
41
- break;
42
- case Abserve_Magenotification_Model_Config::FREE_LICENSE:
43
- echo $this->__('Free License');
44
- break;
45
- default :
46
- echo $this->__('N/A');
47
- }
48
- ?>
49
-
50
- <br/>
51
- <strong><?php echo $this->__('Activation Date') ?>:</strong>
52
- <?php if ($this->getActivationDate()): ?>
53
- <?php echo $this->formatDate($this->getActivationDate(), 'medium', false) ?>
54
- <?php else: ?>
55
- <?php echo $this->__('N/A') ?>
56
- <?php endif ?>
57
-
58
- <br/>
59
- <strong><?php echo $this->__('Expiration Date') ?>:</strong>
60
- <?php if ($this->getExpirationDate()): ?>
61
- <?php echo $this->formatDate($this->getExpirationDate(), 'medium', false) ?>
62
- <?php else: ?>
63
- <?php echo $this->__('N/A') ?>
64
- <?php endif ?>
65
-
66
- <br/>
67
- <?php echo $this->__('Check license information') ?>
68
- <a href="https://www.abserve.com/licensemanager/license/check" title="<?php echo $this->__('check license information') ?>" target="_blank"><?php echo $this->__('here') ?></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/magenotification/license/purchaseform.phtml DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- ?>
4
-
5
- <button style="margin-top:5px;" onclick="location.href='<?php echo $this->getPurchaseUrl() ?>'" class="scalable add" type="button" >
6
- <span><?php echo $this->__('Purchase now')?></span>
7
- </button><br/><br/>
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/magenotification/license/updateform.phtml DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
-
3
- ?>
4
- <table width="300">
5
- <tr>
6
- <td colspan="2">
7
- <?php echo $this->__('Upgrade License to')?><br/>
8
- <select style="margin:5px 0 5px 0;"class="input-text" name="<?php echo $this->getExtensionName() ?>_licensetype" id="<?php echo $this->getExtensionName() ?>_licensetype">
9
- <?php foreach($this->getLicenseTypeOption() as $key=>$label): ?>
10
- <option value="<?php echo $key?>"><?php echo $label?></option>
11
- <?php endforeach; ?>
12
- </select>
13
- </td>
14
- </tr>
15
- <tr>
16
- <td>
17
- <button style="" onclick="updateLicenseViewPrice('<?php echo $this->getLicensekey() ?>','<?php echo $this->getExtensionName() ?>_licensetype')" class="scalable" type="button" >
18
- <span><?php echo $this->__('View Price')?></span>
19
- </button>
20
- </td>
21
- <td>
22
- <button style="" onclick="updateLicensePurchase('<?php echo $this->getLicensekey() ?>','<?php echo $this->getExtensionName() ?>_licensetype')" class="scalable add" type="button" >
23
- <span><?php echo $this->__('Upgrade Now')?></span>
24
- </button>
25
- </td>
26
- </tr>
27
- </table><br/>
28
-
29
- <script type="text/javascript">
30
- function updateLicenseViewPrice(licensekey,licensetype_selector){
31
- var licensetype = $(licensetype_selector).value;
32
- var url = '<?php echo $this->getViewPriceUrl()?>'+'licensekey/'+licensekey+'/licensetype/'+licensetype;
33
- TINY.box.show(url, 1, 300, 100, 1);
34
- }
35
-
36
- function updateLicensePurchase(licensekey,licensetype_selector){
37
- var licensetype = $(licensetype_selector).value;
38
- var url = '<?php echo $this->getUpdateUrl()?>'+'licensekey/'+licensekey+'/licensetype/'+licensetype;
39
- location.href=url;
40
- }
41
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/onestepcheckout/country.phtml DELETED
@@ -1,183 +0,0 @@
1
- <?php //Zend_Debug::dump($this->checkDataImport());?>
2
- <style>
3
- body{
4
- color: #000;
5
- font-size: 15px;
6
- }
7
- #first{
8
- width:75%;
9
- }
10
- table{
11
- width:100%;
12
- }
13
- td{
14
- width: 25%;
15
- }
16
- .log-import{
17
- background: #DDDDFF;
18
- color: #fff;
19
- }
20
- ul {
21
- list-style-type: none;
22
- margin: 0;
23
- padding: 0;
24
- }
25
- li {
26
- border: 1px solid #CCCCCC;
27
- font: 12px sans-serif;
28
- margin: 2px;
29
- padding: 2px;
30
- }
31
- img {
32
- margin-right: 5px;
33
- }
34
- .log-failed{
35
- background-color:#FDD;
36
- }
37
- .log-success{
38
- background-color:#DDF;
39
- }
40
- </style>
41
- <?php
42
- $url = trim($this->actionImport(), '/');
43
- ?>
44
- <script type="text/javascript">
45
- var ilog = 0;
46
- var log = new Array();
47
- var conti = true;
48
- var resumeImport = function(el){
49
- var label = {
50
- pause: '<?php echo $this->__('Pause') ?>',
51
- resume: '<?php echo $this->__('Resume') ?>'
52
- };
53
- if(conti){
54
- conti = false;
55
- el.innerHTML = label.resume;
56
- } else {
57
- conti=true;
58
- el.innerHTML = label.pause;
59
- $('image-import').setAttribute('src', '<?php echo $this->getImageLink() ?>');
60
- importData(conti);
61
- }
62
- }
63
- var processResult=function(text){
64
- if(text!=""){
65
- var re=new Array();
66
- re=text.split('-');
67
- return re;
68
- }
69
- return null;
70
- }
71
- var addImage=function(id){
72
- var path='<?php echo $this->getImageLink() ?>';
73
- $(id).innerHTML+="<span id='ajax-import'><img id='image-import' src='"+path+"' /></span>";
74
- }
75
-
76
- var total = 0;
77
- var importData=function(con){
78
- if(con){
79
- var importGeoip=new Ajax.Request(
80
- '<?php echo $url ?>',
81
- {
82
- method:'post',
83
- onComplete:function(xhr){
84
- if(xhr.responseText){
85
- var res=processResult(xhr.responseText);
86
- if(res[1]!='complete'){
87
- total = total + res[1]/1;
88
- if(total > 0){
89
- $('data-importing').innerHTML=" &nbsp;&nbsp;&nbsp;"+total+" "+res[0];
90
- $('status-import').innerHTML='<?php echo $this->__('Processed ') ?>';
91
- $('image-import').setAttribute('src', '<?php echo $this->getSkinUrl('images/ajax-loader.gif') ?>');
92
- }
93
- // else{
94
- // $('data-importing').innerHTML='';
95
- // $('status-import').innerHTML='';
96
- // $('image-import').setAttribute('text', '');
97
- // }
98
- // alert('total');
99
- }else{
100
- $('status-import').innerHTML='<?php echo $this->__('Complete updating!') ?>';
101
- $('image-import').setAttribute('src', '<?php echo $this->getImageLinkStop() ?>');
102
- $('data-importing').innerHTML='';
103
- $('pause_button').hide();
104
- conti=false;
105
- return;
106
- }
107
- if(res[0]){
108
- if(res[2]=='failed'){
109
- log[ilog]="<li class='log-failed'><img class='v-middle' src='<?php echo $this->getSkinUrl('images/error_msg_icon.gif') ?>'>"+total+" "+res[0]+"</li>";
110
- }else{
111
- if(total > 0){
112
- log[ilog]="<li class='log-success'><img class='v-middle' src='<?php echo $this->getSkinUrl('images/fam_bullet_success.gif') ?>'>"+total+" "+res[0]+"</li>";
113
- }else{
114
- log[ilog]='';
115
- }
116
- }
117
- ilog++;
118
- }
119
-
120
- var temp="";
121
- var k=log.length-1;
122
- var t=1;
123
- while(t<=5&&k>=0){
124
- temp+=log[k];
125
- k--;
126
- t++;
127
- }
128
- $('body_import').innerHTML=temp;
129
- }
130
- if(conti){
131
- importData(con);
132
- }else{
133
- $('image-import').setAttribute('src', '<?php echo $this->getImageLinkStop() ?>');
134
- $('status-import').innerHTML='<?php echo $this->__('Paused ') ?>';
135
- }
136
- }
137
- }
138
- )
139
- }
140
- }
141
-
142
- var index=1;
143
- var a=setInterval(showRow, 1000);
144
- function showRow(){
145
- var row=$('row-'+index);
146
- if(row)
147
- row.style.display='block';
148
- index++;
149
- if(index>4){
150
- clearInterval(a) ;
151
- <?php if (!$this->checkDataImport()): ?>
152
- conti=false;
153
- $('status-import').innerHTML='<?php echo $this->__("No data to update!") ?>';
154
- $('image-import').setAttribute('src', '<?php echo $this->getImageLinkStop() ?>');
155
- <?php endif; ?>
156
- importData(conti);
157
- }
158
- }
159
-
160
- </script>
161
- <body id="body">
162
- <ul>
163
- <li style="height:25px;">
164
- <button id="pause_button" type="buton" style="float:right;width: 100px;height: 25px;" onclick="resumeImport(this)"><?php echo $this->__('Pause') ?></button>
165
- </li>
166
- <li id="row-1" style="display:none;">
167
- <img style="margin-right:5px" class="v-middle" src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif') ?>" /><?php echo $this->__('Updating data to GeoIP system, please wait...') ?>
168
- </li>
169
- <li id="row-2" style="background-color:#FFD;display:none;">
170
- <img style="margin-right:5px" class="v-middle" src="<?php echo $this->getSkinUrl('images/fam_bullet_error.gif') ?>"><?php echo $this->__('Please note: Do not close this window until data is fully updated!') ?>
171
- </li>
172
- <li id="row-3" style="background-color:#DDF;display:none; ">
173
- <img class="v-middle" src="<?php echo $this->getSkinUrl('images/fam_bullet_success.gif') ?>"><?php echo $this->__('Start checking data') ?>
174
- </li>
175
- <li id="row-4" style="background-color: #FFD;display:none;">
176
- <img style="margin-right:5px" id="image-import" class="v-middle" src="<?php echo $this->getSkinUrl('images/ajax-loader.gif') ?>" id="updatedRows_img">
177
- <span class="text" id="updatedRows_status">
178
- <span id="status-import"></span> <strong id="data-importing"></strong>
179
- </span>
180
- </li>
181
- </ul>
182
- <ul id="body_import"></ul>
183
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/onestepcheckout/geoip.phtml DELETED
@@ -1,171 +0,0 @@
1
- <?php //Zend_Debug::dump($this->checkDataImport());?>
2
- <style>
3
- body{
4
- color: #000;
5
- font-size: 15px;
6
- }
7
- #first{
8
- width:75%;
9
- }
10
- table{
11
- width:100%;
12
- }
13
- td{
14
- width: 25%;
15
- }
16
- .log-import{
17
- background: #DDDDFF;
18
- color: #fff;
19
- }
20
- ul {
21
- list-style-type: none;
22
- margin: 0;
23
- padding: 0;
24
- }
25
- li {
26
- border: 1px solid #CCCCCC;
27
- font: 12px sans-serif;
28
- margin: 2px;
29
- padding: 2px;
30
- }
31
- img {
32
- margin-right: 5px;
33
- }
34
- .log-failed{
35
- background-color:#FDD;
36
- }
37
- .log-success{
38
- background-color:#DDF;
39
- }
40
- </style>
41
- <?php
42
- $url = trim($this->actionImport(), '/');
43
- ?>
44
- <script type="text/javascript">
45
- var ilog = 0;
46
- var log = new Array();
47
- var conti = true;
48
- var resumeImport = function(el){
49
- var label = {
50
- pause: '<?php echo $this->__('Pause') ?>',
51
- resume: '<?php echo $this->__('Resume') ?>'
52
- };
53
- if(conti){
54
- conti = false;
55
- el.innerHTML = label.resume;
56
- } else {
57
- conti=true;
58
- el.innerHTML = label.pause;
59
- $('image-import').setAttribute('src', '<?php echo $this->getImageLink() ?>');
60
- importData(conti);
61
- }
62
- }
63
- var processResult=function(text){
64
- if(text!=""){
65
- var re=new Array();
66
- re=text.split('-');
67
- return re;
68
- }
69
- return null;
70
- }
71
- var addImage=function(id){
72
- var path='<?php echo $this->getImageLink() ?>';
73
- $(id).innerHTML+="<span id='ajax-import'><img id='image-import' src='"+path+"' /></span>";
74
- }
75
-
76
- var total = 0;
77
- var importData=function(con){
78
- if(con){
79
- var importGeoip=new Ajax.Request(
80
- '<?php echo $url ?>',
81
- {
82
- method:'post',
83
- onComplete:function(xhr){
84
- if(xhr.responseText){
85
- var res=processResult(xhr.responseText);
86
- if(res[1]!='complete'){
87
- total = total + res[1]/1;
88
- $('data-importing').innerHTML=" &nbsp;&nbsp;&nbsp;"+total+" "+res[0];
89
- $('status-import').innerHTML='<?php echo $this->__('Processed ') ?>';
90
- $('image-import').setAttribute('src', '<?php echo $this->getSkinUrl('images/ajax-loader.gif') ?>');
91
- }else{
92
- $('status-import').innerHTML='<?php echo $this->__('Complete updating!') ?>';
93
- $('image-import').setAttribute('src', '<?php echo $this->getImageLinkStop() ?>');
94
- $('data-importing').innerHTML='';
95
- $('pause_button').hide();
96
- conti=false;
97
- return;
98
- }
99
- if(res[0]){
100
- if(res[2]=='failed'){
101
- log[ilog]="<li class='log-failed'><img class='v-middle' src='<?php echo $this->getSkinUrl('images/error_msg_icon.gif') ?>'>"+total+" "+res[0]+"</li>";
102
- }else{
103
- log[ilog]="<li class='log-success'><img class='v-middle' src='<?php echo $this->getSkinUrl('images/fam_bullet_success.gif') ?>'>"+total+" "+res[0]+"</li>";
104
- }
105
- ilog++;
106
- }
107
-
108
- var temp="";
109
- var k=log.length-1;
110
- var t=1;
111
- while(t<=5&&k>=0){
112
- temp+=log[k];
113
- k--;
114
- t++;
115
- }
116
- $('body_import').innerHTML=temp;
117
- }
118
- if(conti){
119
- importData(con);
120
- }else{
121
- $('image-import').setAttribute('src', '<?php echo $this->getImageLinkStop() ?>');
122
- $('status-import').innerHTML='<?php echo $this->__('Paused ') ?>';
123
- }
124
- }
125
- }
126
- )
127
- }
128
- }
129
-
130
- var index=1;
131
- var a=setInterval(showRow, 1000);
132
- function showRow(){
133
- var row=$('row-'+index);
134
- if(row)
135
- row.style.display='block';
136
- index++;
137
- if(index>4){
138
- clearInterval(a) ;
139
- <?php if (!$this->checkDataImport()): ?>
140
- conti=false;
141
- $('status-import').innerHTML='<?php echo $this->__("No data to update!") ?>';
142
- $('image-import').setAttribute('src', '<?php echo $this->getImageLinkStop() ?>');
143
- <?php endif; ?>
144
- importData(conti);
145
- }
146
- }
147
-
148
- </script>
149
- <body id="body">
150
- <ul>
151
- <li style="height:25px;">
152
- <button id="pause_button" type="buton" style="float:right;width: 100px;height: 25px;" onclick="resumeImport(this)"><?php echo $this->__('Pause') ?></button>
153
- </li>
154
- <li id="row-1" style="display:none;">
155
- <img style="margin-right:5px" class="v-middle" src="<?php echo $this->getSkinUrl('images/note_msg_icon.gif') ?>" /><?php echo $this->__('Updating data to GeoIP system, please wait...') ?>
156
- </li>
157
- <li id="row-2" style="background-color:#FFD;display:none;">
158
- <img style="margin-right:5px" class="v-middle" src="<?php echo $this->getSkinUrl('images/fam_bullet_error.gif') ?>"><?php echo $this->__('Please note: Do not close this window until data is fully updated!') ?>
159
- </li>
160
- <li id="row-3" style="background-color:#DDF;display:none; ">
161
- <img class="v-middle" src="<?php echo $this->getSkinUrl('images/fam_bullet_success.gif') ?>"><?php echo $this->__('Start checking data') ?>
162
- </li>
163
- <li id="row-4" style="background-color: #FFD;display:none;">
164
- <img style="margin-right:5px" id="image-import" class="v-middle" src="<?php echo $this->getSkinUrl('images/ajax-loader.gif') ?>" id="updatedRows_img">
165
- <span class="text" id="updatedRows_status">
166
- <span id="status-import"></span> <strong id="data-importing"></strong>
167
- </span>
168
- </li>
169
- </ul>
170
- <ul id="body_import"></ul>
171
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/onestepcheckout/geoipgrid.phtml DELETED
@@ -1,74 +0,0 @@
1
- <?php
2
- $user_guide = Mage::helper('onestepcheckout')->__('
3
- GeoIP is used to auto detect country of Purchaser by their IP address. Follow these steps to update GeoIP:<br/>
4
- 1. Click "Upload new GeoIP Database version" and upload the file we provide. Please note that a version was already uploaded when you first install the extension.<br/>
5
- 2. Come back to this page, in the section below, "Latest version available" will display the version you just upload.<br/>
6
- 3. Click "Update to Latest version" and the system will update database for you.
7
- ');
8
- ?>
9
- <?php $geoip = $this->getGeoip();?>
10
- <div class="entry-edit">
11
- <div class="entry-edit-head">
12
- <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('onestepcheckout')->__('Instructions')?></h4>
13
- <div class="form-buttons"></div>
14
- </div>
15
- <div id="import_form" class="fieldset ">
16
- <div class="hor-scroll">
17
- <?php echo $user_guide?>
18
- </div>
19
- </div>
20
- </div>
21
- <div class="entry-edit">
22
- <div class="entry-edit-head">
23
- <h4 class="icon-head head-edit-form fieldset-legend"><?php echo Mage::helper('onestepcheckout')->__('Database information')?></h4>
24
- <div class="form-buttons"></div>
25
- </div>
26
- <div id="import_form" class="fieldset ">
27
- <div class="hor-scroll">
28
- <table cellspacing="0" class="form-list">
29
- <tbody>
30
- <tr>
31
- <td class="label"><label for="csv_geoip"><strong><?php echo Mage::helper('onestepcheckout')->__('Records Updated')?>:</strong><span class="required"></span></label></td>
32
- <td class="value">
33
- <?php echo $geoip->getCurrentRecords();?>
34
- </td>
35
- </tr>
36
- <tr>
37
- <td class="label"><label for="csv_geoip"><strong><?php echo Mage::helper('onestepcheckout')->__('Records Total')?>:</strong><span class="required"></span></label></td>
38
- <td class="value">
39
- <?php echo $geoip->getTotalRecords();?>
40
- </td>
41
- </tr>
42
- <tr>
43
- <td class="label"><label for="csv_geoip"><strong><?php echo Mage::helper('onestepcheckout')->__('You are using version')?>:</strong><span class="required"></span></label></td>
44
- <td class="value">
45
- <?php echo $geoip->getCurrentVersion();?>
46
- </td>
47
- </tr>
48
- <tr>
49
- <td class="label"><label for="csv_geoip"><strong><?php echo Mage::helper('onestepcheckout')->__('Latest version available')?>:</strong><span class="required"></span></label></td>
50
- <td class="value">
51
- <?php echo $geoip->getLastVersion();?>
52
- </td>
53
- </tr>
54
- <tr>
55
- <td class="label"><label for="csv_geoip"><strong><?php echo Mage::helper('onestepcheckout')->__('Status')?>:</strong><span class="required"></span></label></td>
56
- <td class="value">
57
- <span class="<?php if($geoip->getStatus()) echo 'grid-severity-notice'; else echo 'grid-severity-major'?>">
58
- <span><?php echo Mage::getModel('onestepcheckout/countrylist')->getStatusLabel($geoip->getStatus());?> </span>
59
- </span>
60
- </td>
61
- </tr>
62
- <br/>
63
- <tr>
64
- <td class="label"><label for="csv_geoip"><span class="required"></span></label></td>
65
- <td class="value">
66
- <button onclick="importGeoIp('<?php echo $this->linkUpdateGeoip()?>')" type="button"><?php echo Mage::helper('onestepcheckout')->__('Update to latest version')?></button>
67
- </td>
68
- </tr>
69
- </tbody>
70
- </table>
71
- </div>
72
- </div>
73
- </div>
74
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/onestepcheckout/info.phtml DELETED
@@ -1,162 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-3.0.php
11
- * If you did not receive a copy of the license and are unable to
12
- * obtain it through the world-wide-web, please send an email
13
- * to license@magentocommerce.com so we can send you a copy immediately.
14
- *
15
- * DISCLAIMER
16
- *
17
- * Do not edit or add to this file if you wish to upgrade Magento to newer
18
- * versions in the future. If you wish to customize Magento for your
19
- * needs please refer to http://www.magentocommerce.com for more information.
20
- *
21
- * @category design
22
- * @package default_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
- <?php $_order = $this->getOrder() ?>
28
- <div>
29
- <div id="order-messages">
30
- <?php echo $this->getChildHtml('order_messages') ?>
31
- </div>
32
- <?php echo $this->getChildHtml('order_info') ?>
33
- <input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
34
- <?php if ($_order->getIsVirtual()): ?>
35
- <div class="box-right">
36
- <?php else: ?>
37
- <div class="box-left">
38
- <?php endif; ?>
39
- <!--Payment Method-->
40
- <div class="entry-edit">
41
- <div class="entry-edit-head">
42
- <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
43
- </div>
44
- <fieldset>
45
- <?php echo $this->getPaymentHtml() ?>
46
- <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
47
- </fieldset>
48
- </div>
49
- </div>
50
- <?php if (!$_order->getIsVirtual()): ?>
51
- <div class="box-right">
52
- <!--Shipping Method-->
53
- <div class="entry-edit">
54
- <div class="entry-edit-head">
55
- <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping &amp; Handling Information') ?></h4>
56
- </div>
57
- <fieldset>
58
- <?php if ($_order->getTracksCollection()->count()) : ?>
59
- <a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
60
- <br/>
61
- <?php endif; ?>
62
- <?php if ($_order->getShippingDescription()): ?>
63
- <strong><?php echo $_order->getShippingDescription() ?></strong>
64
-
65
- <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
66
- <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
67
- <?php else: ?>
68
- <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
69
- <?php endif; ?>
70
- <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
71
-
72
- <?php echo $_excl; ?>
73
- <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
74
- (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
75
- <?php endif; ?>
76
- <?php else: ?>
77
- <?php echo $this->helper('sales')->__('No shipping information available'); ?>
78
- <?php endif; ?>
79
- </fieldset>
80
- </div>
81
- </div>
82
- <?php endif; ?>
83
- <div class="clear"></div>
84
-
85
- <!-- Survey -->
86
- <?php
87
- $orderId=Mage::app()->getRequest()->getParam('order_id');
88
- $survey = Mage::getModel('onestepcheckout/survey')->load($orderId, 'order_id');
89
- ?>
90
- <?php if($survey->getId()):?>
91
- <div class="box-left">
92
- <div class="entry-edit">
93
- <div class="entry-edit-head">
94
- <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Survey Information') ?></h4>
95
- </div>
96
- <fieldset>
97
- <div class="grid">
98
- <div class="hor-scroll">
99
- <table cellspacing="0" class="data">
100
- <tbody>
101
- <tr class="odd">
102
- <td class="a-left" style="width:25%;border-right:none !important;font-weight:bold" ><?php echo Mage::helper('onestepcheckout')->__('Survey Question :') ?></td>
103
- <td class="a-left">
104
- <?php echo $survey->getQuestion();?>
105
- </td>
106
- </tr>
107
- <tr class="even">
108
- <td class="a-left" style="width:25%;border-right:none !important;font-weight:bold"><?php echo Mage::helper('onestepcheckout')->__('Answer: ') ?></td>
109
- <td class="a-left">
110
- <?php echo $survey->getAnswer();?>
111
- </td>
112
- </tr>
113
- </tbody>
114
- </table>
115
-
116
- </div>
117
- </div>
118
- </fieldset>
119
- </div>
120
- </div>
121
- <?php endif;?>
122
-
123
- <!-- begin of customer comment -->
124
- <?php if($_order->getOnestepcheckoutOrderComment()):?>
125
- <div class="box-right">
126
- <div class="entry-edit">
127
- <div class="entry-edit-head">
128
- <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Customer Comment') ?></h4>
129
- </div>
130
- <fieldset>
131
- <?php echo $_order->getOnestepcheckoutOrderComment();?>
132
- </fieldset>
133
- </div>
134
- </div>
135
- <!-- end of customer comment -->
136
- <?php endif;?>
137
- <div class="clear"></div>
138
- <?php echo $this->getGiftmessageHtml() ?>
139
-
140
- <div class="clear"></div>
141
- <div class="entry-edit">
142
- <div class="entry-edit-head">
143
- <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
144
- </div>
145
- </div>
146
- <?php echo $this->getItemsHtml() ?>
147
- <div class="clear"></div>
148
-
149
- <div class="box-left">
150
- <div class="entry-edit">
151
- <div class="entry-edit-head">
152
- <h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
153
- </div>
154
- <fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
155
- </div>
156
- </div>
157
- <div class="box-right entry-edit">
158
- <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
159
- <div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
160
- </div>
161
- <div class="clear"></div>
162
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/onestepcheckout/sales/order/view/tab/delivery.phtml DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- $orderId=Mage::app()->getRequest()->getParam('order_id');
3
- $delivery = Mage::getModel('onestepcheckout/delivery')->load($orderId, 'order_id');
4
- ?>
5
- <?php if($this->getLastItem()) {?>
6
- </table>
7
-
8
- <?php if($delivery->getId()):?>
9
- <div class="entry-edit">
10
- <fieldset>
11
- <div class="delivery">
12
- <div class="entry-edit-head">
13
- <h4 class="icon-head head-account">
14
- <?php echo Mage::helper('onestepcheckout')->__('Time of Delivery') ?>
15
- </h4>
16
- </div>
17
- </div>
18
- <div class="grid">
19
- <div class="hor-scroll">
20
- <table cellspacing="0" class="data">
21
- <tbody>
22
- <tr class="odd">
23
-
24
- <td class="a-left" style="height:35px;line-height:35px;font-weight:bold;padding-left:10px;">
25
- <?php echo $delivery->getDeliveryTimeDate();?>
26
- </td>
27
- </tr>
28
-
29
- </tbody>
30
- </table>
31
- </div>
32
- </div>
33
- </fieldset>
34
- </div>
35
- <?php endif;?>
36
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/adminhtml/default/default/template/onestepcheckout/sales/order/view/tab/survey.phtml DELETED
@@ -1,69 +0,0 @@
1
-
2
- <?php
3
- $orderId=Mage::app()->getRequest()->getParam('order_id');
4
- $survey = Mage::getModel('onestepcheckout/survey')->load($orderId, 'order_id');
5
- $comment = Mage::getModel('sales/order')->load($orderId)->getOnestepcheckoutOrderComment();
6
- //echo 'LAN';
7
- ?>
8
- <?php if($this->getLastItem()) {?>
9
- </table>
10
- <?php if($survey->getId()):?>
11
- <div class="entry-edit">
12
- <fieldset>
13
- <div class="survey">
14
- <div class="entry-edit-head">
15
- <h4 class="icon-head head-account">
16
- <?php echo Mage::helper('onestepcheckout')->__('Survey Information') ?>
17
- </h4>
18
- </div>
19
- </div>
20
- <div class="grid">
21
- <div class="hor-scroll">
22
- <table cellspacing="0" class="data">
23
- <tbody>
24
- <tr class="odd">
25
- <td class="a-left" style="width:25%;border-right:none !important;font-weight:bold" ><?php echo Mage::helper('onestepcheckout')->__('Survey Question :') ?></td>
26
- <td class="a-left">
27
- <?php echo $survey->getQuestion();?>
28
- </td>
29
- </tr>
30
- <tr class="even">
31
- <td class="a-left" style="width:25%;border-right:none !important;font-weight:bold"><?php echo Mage::helper('onestepcheckout')->__('Answer: ') ?></td>
32
- <td class="a-left">
33
- <?php echo $survey->getAnswer();?>
34
- </td>
35
- </tr>
36
- </tbody>
37
- </table>
38
- </div>
39
- </div>
40
- </fieldset>
41
- </div>
42
- <?php endif;?>
43
- <?php if($comment):?>
44
- <div class="entry-edit" >
45
- <fieldset>
46
- <div class="survey">
47
- <div class="entry-edit-head">
48
- <h4 class="icon-head head-account">
49
- <?php echo Mage::helper('onestepcheckout')->__('Comment') ?>
50
- </h4>
51
- </div>
52
- </div>
53
- <div class="grid">
54
- <div class="hor-scroll">
55
- <table cellspacing="0" class="data">
56
- <tbody>
57
- <tr class="even">
58
- <td class="a-left">
59
- <?php echo $comment;?>
60
- </td>
61
- </tr>
62
- </tbody>
63
- </table>
64
- </div>
65
- </div>
66
- </fieldset>
67
- </div>
68
- <?php endif;?>
69
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/layout/abserve_opc.xml ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout>
3
+
4
+ <default>
5
+ <reference name="top.links">
6
+ <remove name="checkout_cart_link"/>
7
+ <block type="checkout/links" name="checkout_cart_link_custom"><action method="addCartLink" ></action></block>
8
+ <block type="opc/links" name="checkout_cart_link_custom"><action method="addCheckoutLink"></action></block>
9
+ </reference>
10
+ <!-- LOGIN WITH PAYPAL -->
11
+ <reference name="head">
12
+ <action method="addItem" ifconfig="opc/paypallogin/status"><type>skin_js</type><name>js/abserve/opc/login.js</name></action>
13
+ <action method="addItem" ifconfig="opc/paypallogin/status"><type>skin_css</type><name>css/abserve/opc/paypal.css</name><params/></action>
14
+ </reference>
15
+ </default>
16
+
17
+ <opc_index_index translate="label">
18
+ <label>Onepage Checkout</label>
19
+
20
+ <reference name="root">
21
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
22
+ </reference>
23
+
24
+ <reference name="head">
25
+ <action method="addItem"><type>skin_js</type><name>js/abserve/opc/checkout.js</name></action>
26
+ <action method="addItem"><type>skin_js</type><name>js/abserve/opc/extend.js</name></action>
27
+ <action method="addJs"><file>mage/directpost.js</file></action>
28
+ <action method="addJs"><script>mage/centinel.js</script></action>
29
+ <action method="addItem"><type>skin_js</type><name>js/opcheckout.js</name></action>
30
+ <action method="addItem" ifconfig="opc/paypal/status"><type>skin_js</type><name>js/abserve/opc/lipp.js</name></action>
31
+ <action method="addCss"><stylesheet>css/abserve/opc/opc.css</stylesheet></action>
32
+ <action method="addJs" ifconfig="payment/braintree/active"><file>braintree/braintree-1.3.4.js</file></action>
33
+ <action method="addCss" ifconfig="payment/braintree/active"><stylesheet>braintree/css/braintree.css</stylesheet></action>
34
+ </reference>
35
+
36
+ <reference name="content">
37
+ <block type="opc/wrapper" name="es.checkout.container" template="opc/wrapper.phtml">
38
+
39
+ <block type="page/html_wrapper" name="paypal.button" translate="label">
40
+ <label>PayPal Express Checkout Shortcut Wrapper</label>
41
+ <block type="paypal/express_shortcut" name="product.info.addtocart.paypal" template="opc/paypal/express/shortcut.phtml">
42
+ <!-- action method="setIsInCatalogProduct"><value>1</value></action -->
43
+ </block>
44
+ </block>
45
+
46
+
47
+ <!-- LOGIN FORM -->
48
+ <block type="opc/onepage_login" name="checkout.onepage.login" as="login" template="opc/onepage/login.phtml">
49
+ <block type="customer/account_forgotpassword" name="forgotPassword" template="opc/customer/form/forgotpassword.phtml"/>
50
+ </block>
51
+ <!-- BILLING FORM -->
52
+ <block type="opc/onepage_billing" name="checkout.onepage.billing" as="billing" template="opc/onepage/billing.phtml"/>
53
+
54
+ <!-- SHIPPING FORM -->
55
+ <block type="opc/onepage_shipping" name="checkout.onepage.shipping" as="shipping" template="opc/onepage/shipping.phtml"/>
56
+
57
+ <!-- COUPON FORM -->
58
+ <block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="opc/onepage/coupon.phtml"/>
59
+
60
+ <!-- COMMENT FORM -->
61
+ <block type="opc/onepage_comment" name="checkout.order.comment" as="customer.comment"/>
62
+
63
+ <!-- SHIPPING METHODS FORM -->
64
+ <block type="checkout/onepage_shipping_method" name="checkout.onepage.shipping_method" as="shipping_method" template="opc/onepage/shipping_method.phtml">
65
+ <block type="checkout/onepage_shipping_method_available" name="checkout.onepage.shipping_method.available" as="available" template="checkout/onepage/shipping_method/available.phtml"/>
66
+ <block type="checkout/onepage_shipping_method_additional" name="checkout.onepage.shipping_method.additional" as="additional" template="checkout/onepage/shipping_method/additional.phtml"/>
67
+ </block>
68
+
69
+ <!-- PAYMENTS METHOD FORM -->
70
+ <block type="checkout/onepage_payment" name="checkout.onepage.payment" as="payment" template="opc/onepage/payment.phtml">
71
+ <block type="checkout/onepage_payment_methods" name="checkout.payment.methods" as="methods" template="checkout/onepage/payment/methods.phtml">
72
+ <action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
73
+ </block>
74
+ </block>
75
+
76
+ <block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="opc/onepage/agreements.phtml"/>
77
+ <block type="opc/onepage_subscribed" template="opc/onepage/review/subscribed.phtml" name="opc.newsletters" />
78
+
79
+ </block>
80
+ </reference>
81
+
82
+ <!-- PAYPAL EXPRESS LIGHTBOX -->
83
+ <reference name="before_body_end">
84
+ <block type="opc/lipp" name="opc.lipp.js" as="">
85
+ <action method="setTemplate" ifconfig="opc/paypal/status"><template>opc/lipp-js.phtml</template></action>
86
+ </block>
87
+ <block type="opc/braintree_datajs" name="braintree_payments_data_js">
88
+ <action method="setTemplate" ifconfig="payment/braintree/active"><template>braintree/data_js.phtml</template></action>
89
+ </block>
90
+ <block type="opc/braintree_form" name="payment.form.braintree">
91
+ <action method="setTemplate" ifconfig="payment/braintree/active"><template>braintree/review_js.phtml</template></action>
92
+ <action method="setMethodInfo"></action>
93
+ </block>
94
+ </reference>
95
+ </opc_index_index>
96
+
97
+ <checkout_onepage_review>
98
+ <reference name="checkout.onepage.review.button">
99
+ <action method="setTemplate" ifconfig="opc/global/status"><template>opc/onepage/review/button.phtml</template></action>
100
+ </reference>
101
+ <reference name="checkout.onepage.agreements">
102
+ <action method="setTemplate" ifconfig="opc/global/status"><template>opc/onepage/agreements.phtml</template></action>
103
+ </reference>
104
+ </checkout_onepage_review>
105
+
106
+ <!-- 3D SECURE (CENTINEL) -->
107
+ <opc_json_savepayment>
108
+ <reference name="checkout.onepage.review.info.items.before">
109
+ <block type="centinel/authentication" name="centinel.frame" template="centinel/authentication.phtml">
110
+ <action method="addRelatedBlock"><blockId>checkout-review-submit</blockId></action>
111
+ <action method="addRelatedBlock"><blockId>checkout-review-table-wrapper</blockId></action>
112
+ <action method="setAuthenticationStartMode"><mode>instant</mode></action>
113
+ </block>
114
+ </reference>
115
+ </opc_json_savepayment>
116
+
117
+ <!-- 3D SECURE (CENTINEL) - COMPLETE-->
118
+ <centinel_index_authenticationcomplete>
119
+ <reference name="root">
120
+ <action method="setTemplate"><template>opc/centinel/authentication/complete.phtml</template></action>
121
+ </reference>
122
+ </centinel_index_authenticationcomplete>
123
+
124
+
125
+ <!-- PAYPAL EXPRESS LIGHTBOX -->
126
+ <checkout_cart_index>
127
+ <reference name="head">
128
+ <action method="addItem" ifconfig="opc/paypal/status"><type>skin_js</type><name>js/abserve/opc/lipp.js</name></action>
129
+ </reference>
130
+ <reference name="before_body_end">
131
+ <block type="opc/lipp" name="opc.lipp.js" as="">
132
+ <action method="setTemplate" ifconfig="opc/paypal/status"><template>opc/lipp-js.phtml</template></action>
133
+ </block>
134
+ </reference>
135
+ </checkout_cart_index>
136
+
137
+
138
+ <!-- LOGIN WITH PAYPAL -->
139
+ <customer_logged_out>
140
+ <reference name="top.links">
141
+ <action method="addLink" translate="label title" module="opc" ifconfig="opc/paypallogin/status"><label></label><url helper="opc/paypal/getLoginUrl"/><title>Log In With Paypal</title><prepare/><urlParams/><position>100</position><liParams/><aParams><id>topPayPalIn</id><class>paypal-auth</class></aParams></action>
142
+ </reference>
143
+ </customer_logged_out>
144
+
145
+ <customer_account_index>
146
+ <reference name="customer_account_dashboard_info">
147
+ <block type="opc/customer_account_dashboard_info" name="customer_account_dashboard_info_paypal" as="paypalauth_dashboard" template="opc/customer/account/dashboard/info.phtml"/>
148
+ </reference>
149
+ </customer_account_index>
150
+
151
+ <customer_account_login>
152
+ <reference name="head">
153
+ <action method="addItem" ifconfig="opc/paypallogin/status"><type>skin_js</type><name>js/abserve/opc/login.js</name></action>
154
+ </reference>
155
+ <reference name="customer_form_login">
156
+ <action method="setTemplate"><template>opc/customer/form/login.phtml</template></action>
157
+ <block type="opc/paypal_login" name="paypalauth.login" template="opc/paypal/paypal_login.phtml" />
158
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
159
+ <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
160
+ </reference>
161
+ </customer_account_login>
162
+
163
+ <customer_account_create>
164
+ <reference name="head">
165
+ <action method="addItem" ifconfig="opc/paypallogin/status"><type>skin_js</type><name>js/abserve/opc/login.js</name></action>
166
+ </reference>
167
+ <reference name="customer_form_register">
168
+ <action method="setTemplate"><template>opc/customer/form/register.phtml</template></action>
169
+ <block type="opc/paypal_login" name="paypalauth.register" template="opc/paypal/paypal_register.phtml" />
170
+ <block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
171
+ <block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
172
+ </reference>
173
+ </customer_account_create>
174
+
175
+ <opc_paypal_asklink>
176
+ <reference name="root">
177
+ <action method="setTemplate"><template>page/1column.phtml</template></action>
178
+ </reference>
179
+ <reference name="content">
180
+ <block type="opc/customer_account_asklink" name="opc.paypal.auth" template="opc/customer/account/asklink.phtml"/>
181
+ </reference>
182
+ </opc_paypal_asklink>
183
+
184
+ </layout>
app/design/frontend/abserve/shoestore/layout/onestepcheckout.xml DELETED
@@ -1,328 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!--
3
- /**
4
- * @category Abserve
5
- * @package Abserve_Module
6
- * @author Abserve Developer
7
- * @license http://abservetech.com/license-agreement/
8
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
9
- */
10
- -->
11
- <layout version="0.1.0">
12
- <onestepcheckout_index_index>
13
- <reference name="root">
14
- <action method="setTemplate">
15
- <template>page/1column.phtml</template>
16
- </action>
17
- </reference>
18
- <reference name="head">
19
- <!-- Amazon payment-->
20
- <action method="addJs" ifconfig="payment/amazon_payments/enabled"><script>prototype/window.js</script></action>
21
- <action method="addItem" ifconfig="payment/amazon_payments/enabled"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
22
- <action method="addItem" ifconfig="payment/amazon_payments/enabled"><type>js_css</type><name>prototype/windows/themes/alphacube.css</name></action>
23
- <action method="addItem" ifconfig="payment/amazon_payments/enabled"><type>skin_css</type><name>amazon_payments/css/popup_alphacube.css</name><params/></action>
24
- <block type="core/template" name="amazon_payments.script" template="amazon_payments/script.phtml" />
25
- <!-- /Amazon scripts-->
26
- <action method="removeItem">
27
- <type>js</type>
28
- <name>varien/form.js</name>
29
- <params />
30
- </action>
31
- <action method="addJs">
32
- <script>abserve/varien/form.js</script>
33
- </action>
34
- <action method="addJs">
35
- <script>abserve/onestepcheckout.js</script>
36
- </action>
37
- <action method="addJs">
38
- <script>calendar/calendar.js</script>
39
- </action>
40
- <action method="addJs">
41
- <script>calendar/calendar-setup.js</script>
42
- </action>
43
- <!--action method="addItem">
44
- <type>js</type>
45
- <name>abserve/responsive/jquery.mediaqueries.js</name>
46
- <if>lt IE 9</if>
47
- </action-->
48
-
49
- <action method="addJs">
50
- <script>abserve/tinybox.js</script>
51
- </action>
52
- <action method="addJs">
53
- <script>abserve/window.js</script>
54
- </action>
55
- <action method="addJs">
56
- <script>abserve/geoip.js</script>
57
- </action>
58
- <action method="addCss">
59
- <stylesheet>css/abserve/onestepcheckout.css</stylesheet>
60
- </action>
61
- <action method="addCss"><stylesheet>css/phoenix/wirecard_checkout_page/stylesheet.css</stylesheet></action>
62
- <action method="addCss">
63
- <stylesheet>css/abserve/mobileonestepcheckout.css</stylesheet>
64
- <!--params>media="only screen and (min-width: 0px) and (max-width: 680px)"</params-->
65
- </action>
66
- <action method="addCss">
67
- <stylesheet>css/abserve/tinybox.css</stylesheet>
68
- </action>
69
- <action method="removeItem">
70
- <type>skin_js</type>
71
- <name>sagepaysuite/js/sagePaySuite_Checkout.js</name>
72
- <params />
73
- </action>
74
- <action method="addItem">
75
- <type>skin_js</type>
76
- <name>onestepcheckout/js/sagePaySuite_Checkout.js</name>
77
- </action>
78
- <action method="addItem">
79
- <type>skin_js</type>
80
- <name>js/opcheckout.js</name>
81
- </action>
82
- <block type="page/html_head" name="mobie_view" template="onestepcheckout/head.phtml"/>
83
- </reference>
84
- <reference name="content">
85
- <block type="onestepcheckout/onestepcheckout" name="onestepcheckout" template="onestepcheckout/onestepcheckout.phtml">
86
- <block type="onestepcheckout/onestepcheckout" name="onestepcheckout_billing" as="onestepcheckout.billing" template="onestepcheckout/onestepcheckout/billing.phtml" />
87
- <block type="onestepcheckout/onestepcheckout" name="onestepcheckout_shipping" as="onestepcheckout.shipping" template="onestepcheckout/onestepcheckout/shipping.phtml" />
88
- <block type="checkout/onepage_shipping_method_available" name="onestepcheckout_shipping_method" as="onestepcheckout.shipping_method" template="onestepcheckout/onestepcheckout/shipping_method.phtml"/>
89
- <block type="checkout/onepage_payment_methods" name="onestepcheckout_payment_method" as="onestepcheckout.payment_method" template="onestepcheckout/onestepcheckout/payment_method.phtml">
90
- <action method="setMethodFormTemplate">
91
- <method>purchaseorder</method>
92
- <template>payment/form/purchaseorder.phtml</template>
93
- </action>
94
- </block>
95
- <block type="checkout/onepage_review" name="onestepcheckout.onestepcheckout.review" as="onestepcheckout.review" template="onestepcheckout/onestepcheckout/review.phtml">
96
- <block type="checkout/agreements" name="onestepcheckout.onestepcheckout.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>
97
- <block type="checkout/onepage_review_info" name="review_info" as="info" template="onestepcheckout/onestepcheckout/review/info.phtml">
98
- <action method="addItemRender">
99
- <type>default</type>
100
- <block>checkout/cart_item_renderer</block>
101
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
102
- </action>
103
- <action method="addItemRender">
104
- <type>grouped</type>
105
- <block>checkout/cart_item_renderer_grouped</block>
106
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
107
- </action>
108
- <action method="addItemRender">
109
- <type>configurable</type>
110
- <block>checkout/cart_item_renderer_configurable</block>
111
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
112
- </action>
113
- <action method="addItemRender"><type>bundle</type><block>bundle/checkout_cart_item_renderer</block><template>onestepcheckout/onestepcheckout/review/item.phtml</template></action>
114
- <block type="checkout/cart_totals" name="checkout.onepage.review.info.totals" as="totals" template="onestepcheckout/onestepcheckout/review/totals.phtml"/>
115
- </block>
116
- </block>
117
- <block type="tco/iframe" name="tco.iframe" as="tco_iframe">
118
- <action method="setBlockId">
119
- <block_id>tcoiframe</block_id>
120
- </action>
121
- </block>
122
- <!-- Amazon payment button-->
123
- <block type="amazon_payments/button" name="amazon_button" template="amazon_payments/button.phtml"/>
124
- <!-- /Amazon payment button-->
125
- </block>
126
- </reference>
127
- <reference name="before_body_end">
128
- <block type="core/template" template="onestepcheckout/login_popup.phtml" name="login-popup" />
129
- <block type="wirecard_checkout_page/seamless_script" name="wirecard_checkout_page_js" template="wirecard_checkout_page/seamless/script.phtml" />
130
- </reference>
131
- </onestepcheckout_index_index>
132
-
133
- <onestepcheckout_index_show_login>
134
- <reference name="root">
135
- <action method="setTemplate">
136
- <template>page/empty.phtml</template>
137
- </action>
138
- <reference name="content">
139
- <block type="onestepcheckout/onestepcheckout" name="onestepcheckout_login" template="onestepcheckout/onestepcheckout/login.phtml"/>
140
- </reference>
141
- </reference>
142
- </onestepcheckout_index_show_login>
143
-
144
- <onestepcheckout_index_show_password>
145
- <reference name="root">
146
- <action method="setTemplate">
147
- <template>page/empty.phtml</template>
148
- </action>
149
- <reference name="content">
150
- <block type="onestepcheckout/onestepcheckout" name="onestepcheckout_login" template="onestepcheckout/onestepcheckout/forgotpassword.phtml"/>
151
- </reference>
152
- </reference>
153
- </onestepcheckout_index_show_password>
154
- <!--<checkout_cart_index>
155
- <reference name="checkout.cart.methods">
156
- <update handle="checkout.cart.methods.onepage" />
157
- <reference name="checkout.cart.methods.onepage">
158
- <action method="setTemplate"><template>onestepcheckout/link.phtml</template></action>
159
- </reference>
160
- </reference>
161
- </checkout_cart_index>-->
162
- <onestepcheckout_onestepcheckout_shippingmethod>
163
- <block type="checkout/onepage_shipping_method_available" name="shippingmethod" output="toHtml" template="onestepcheckout/onestepcheckout/shipping_method.phtml"/>
164
- </onestepcheckout_onestepcheckout_shippingmethod>
165
- <onestepcheckout_onestepcheckout_paymentmethod>
166
- <block type="checkout/onepage_payment_methods" name="paymentmethod" output="toHtml" template="onestepcheckout/onestepcheckout/payment_method.phtml">
167
- <action method="setMethodFormTemplate">
168
- <method>purchaseorder</method>
169
- <template>payment/form/purchaseorder.phtml</template>
170
- </action>
171
- </block>
172
- </onestepcheckout_onestepcheckout_paymentmethod>
173
- <onestepcheckout_onestepcheckout_review>
174
- <block type="checkout/onepage_review_info" name="review" output="toHtml" template="onestepcheckout/onestepcheckout/review/info.phtml">
175
- <action method="addItemRender">
176
- <type>default</type>
177
- <block>checkout/cart_item_renderer</block>
178
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
179
- </action>
180
- <action method="addItemRender">
181
- <type>grouped</type>
182
- <block>checkout/cart_item_renderer_grouped</block>
183
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
184
- </action>
185
- <action method="addItemRender">
186
- <type>configurable</type>
187
- <block>checkout/cart_item_renderer_configurable</block>
188
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
189
- </action>
190
- <action method="addItemRender"><type>bundle</type><block>bundle/checkout_cart_item_renderer</block><template>onestepcheckout/onestepcheckout/review/item.phtml</template></action>
191
- <block type="checkout/cart_totals" name="checkout.onepage.review.info.totals" as="totals" template="onestepcheckout/onestepcheckout/review/totals.phtml"/>
192
- </block>
193
- </onestepcheckout_onestepcheckout_review>
194
- <onestepcheckout_index_saveaddressonestepcheckout>
195
- <block type="onestepcheckout/reload" output="toHtml" name="onestepcheckout_reload" as="onestepcheckout_reload" template="onestepcheckout/onestepcheckout/reload_data.phtml">
196
- <block type="checkout/onepage_shipping_method_available" name="onestepcheckout_shipping_method" as="onestepcheckout_shipping_method" template="onestepcheckout/onestepcheckout/shipping_method.phtml" />
197
- <block type="checkout/onepage_payment_methods" name="onestepcheckout_payment_method" as="onestepcheckout_payment_method" template="onestepcheckout/onestepcheckout/payment_method.phtml">
198
- <action method="setMethodFormTemplate">
199
- <method>purchaseorder</method>
200
- <template>payment/form/purchaseorder.phtml</template>
201
- </action>
202
- </block>
203
- <block type="checkout/onepage_review_info" name="onestepcheckout_review" as="onestepcheckout_review" template="onestepcheckout/onestepcheckout/review/info.phtml">
204
- <action method="addItemRender">
205
- <type>default</type>
206
- <block>checkout/cart_item_renderer</block>
207
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
208
- </action>
209
- <action method="addItemRender">
210
- <type>grouped</type>
211
- <block>checkout/cart_item_renderer_grouped</block>
212
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
213
- </action>
214
- <action method="addItemRender">
215
- <type>configurable</type>
216
- <block>checkout/cart_item_renderer_configurable</block>
217
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
218
- </action>
219
- <action method="addItemRender"><type>bundle</type><block>bundle/checkout_cart_item_renderer</block><template>onestepcheckout/onestepcheckout/review/item.phtml</template></action>
220
- <block type="checkout/cart_totals" name="checkout.onepage.review.info.totals" as="totals" template="onestepcheckout/onestepcheckout/review/totals.phtml"/>
221
- </block>
222
- </block>
223
- </onestepcheckout_index_saveaddressonestepcheckout>
224
-
225
- <onestepcheckout_index_save_shipping>
226
- <block type="onestepcheckout/reload" name="onestepcheckout_reload" as="onestepcheckout_reload" output="toHtml" template="onestepcheckout/onestepcheckout/reload_payment.phtml">
227
- <block type="checkout/onepage_payment_methods" name="onestepcheckout_payment_method" as="onestepcheckout_payment_method" template="onestepcheckout/onestepcheckout/payment_method.phtml">
228
- <action method="setMethodFormTemplate">
229
- <method>purchaseorder</method>
230
- <template>payment/form/purchaseorder.phtml</template>
231
- </action>
232
- </block>
233
- <block type="checkout/onepage_review_info" name="onestepcheckout_review" as="onestepcheckout_review" template="onestepcheckout/onestepcheckout/review/info.phtml">
234
- <action method="addItemRender">
235
- <type>default</type>
236
- <block>checkout/cart_item_renderer</block>
237
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
238
- </action>
239
- <action method="addItemRender">
240
- <type>grouped</type>
241
- <block>checkout/cart_item_renderer_grouped</block>
242
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
243
- </action>
244
- <action method="addItemRender">
245
- <type>configurable</type>
246
- <block>checkout/cart_item_renderer_configurable</block>
247
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
248
- </action>
249
- <action method="addItemRender"><type>bundle</type><block>bundle/checkout_cart_item_renderer</block><template>onestepcheckout/onestepcheckout/review/item.phtml</template></action>
250
- <block type="checkout/cart_totals" name="checkout.onepage.review.info.totals" as="totals" template="onestepcheckout/onestepcheckout/review/totals.phtml"/>
251
- </block>
252
- </block>
253
- </onestepcheckout_index_save_shipping>
254
-
255
- <onestepcheckout_ajax_add_giftwrap>
256
- <block type="checkout/onepage_review_info" output="toHtml" name="onestepcheckout_review" as="onestepcheckout_review" template="onestepcheckout/onestepcheckout/review/info.phtml">
257
- <action method="addItemRender">
258
- <type>default</type>
259
- <block>checkout/cart_item_renderer</block>
260
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
261
- </action>
262
- <action method="addItemRender">
263
- <type>grouped</type>
264
- <block>checkout/cart_item_renderer_grouped</block>
265
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
266
- </action>
267
- <action method="addItemRender">
268
- <type>configurable</type>
269
- <block>checkout/cart_item_renderer_configurable</block>
270
- <template>onestepcheckout/onestepcheckout/review/item.phtml</template>
271
- </action>
272
- <action method="addItemRender"><type>bundle</type><block>bundle/checkout_cart_item_renderer</block><template>onestepcheckout/onestepcheckout/review/item.phtml</template></action>
273
- <block type="checkout/cart_totals" name="checkout.onepage.review.info.totals" as="totals" template="onestepcheckout/onestepcheckout/review/totals.phtml"/>
274
- </block>
275
- </onestepcheckout_ajax_add_giftwrap>
276
-
277
- <!--Order -->
278
- <sales_order_invoice>
279
- <reference name="invoice_totals">
280
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
281
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckout_discount" />
282
- </reference>
283
- </sales_order_invoice>
284
- <sales_order_print>
285
- <reference name="order_totals">
286
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
287
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckout_discount" />
288
- </reference>
289
- </sales_order_print>
290
- <sales_order_printinvoice>
291
- <reference name="invoice_totals">
292
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
293
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckout_discount" />
294
- </reference>
295
- </sales_order_printinvoice>
296
- <!--Email -->
297
- <sales_email_order_items>
298
- <reference name="items">
299
- <action method="setTemplate">
300
- <template>onestepcheckout/onestepcheckout/email_onestepcheckout.phtml</template>
301
- </action>
302
- </reference>
303
- <reference name="order_totals">
304
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
305
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckout_discount" />
306
- </reference>
307
- </sales_email_order_items>
308
- <sales_email_order_invoice_items>
309
- <reference name="invoice_totals">
310
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
311
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckout_discount" />
312
- </reference>
313
- </sales_email_order_invoice_items>
314
- <sales_email_order_creditmemo_items>
315
- <reference name="creditmemo_totals">
316
- <block type="onestepcheckout/sales_order_totals_giftwrap" name="giftwrap" />
317
- <block type="onestepcheckout/sales_order_totals_discount" name="onestepcheckout_discount" />
318
- </reference>
319
- </sales_email_order_creditmemo_items>
320
-
321
- <sales_order_view translate="label">
322
- <reference name="order_items">
323
- <action method="setTemplate">
324
- <template>onestepcheckout/onestepcheckout/order_onestepcheckout.phtml</template>
325
- </action>
326
- </reference>
327
- </sales_order_view>
328
- </layout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/template/onestepcheckout/geoip/postcode.phtml DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- /**
3
- * @category Abserve
4
- * @package Abserve_Module
5
- * @author Abserve Developer
6
- * @license http://abservetech.com/license-agreement/
7
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
8
- */
9
- ?>
10
- <ul id="postcode_autocomplete">
11
- <?php foreach ($items as $item): ?>
12
- <li id="<?php echo $item['id'] ?>" postcode="<?php echo $item['postcode']?>" country= "<?php echo $item['country']?>" city="<?php echo $item['city'] ?>" region="<?php echo $item['region']?>" region_id="<?php echo $item['region_id']?>">
13
- <div style="float:left">
14
- <?php if($item['city']):?>
15
- <strong><?php echo $this->htmlEscape($item['city']) ?></strong><br/>
16
- <?php endif;?>
17
- <?php if($item['postcode']):?>
18
- <span class="informal"><?php echo $this->htmlEscape($item['postcode']) ?></span><br/>
19
- <?php endif;?>
20
- <?php if($item['region']):?>
21
- <span class="informal"><?php echo '('.$this->htmlEscape($item['region']).')' ?></span>
22
- <?php endif;?>
23
- </div>
24
- <div style="float:right; clear:both; color:red; font-weight:bold;">[<?php echo $item['country'] ?>]</div>
25
- </li>
26
- <?php endforeach ?>
27
- </ul>
28
- <style type="text/css">
29
- #postcode_autocomplete li:hover{
30
- background-color: #DCEBF0;
31
- cursor: pointer;
32
- }
33
- </style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/template/onestepcheckout/giftmessage/inline.phtml DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
- /**
3
- * @category Abserve
4
- * @package Abserve_Module
5
- * @author Abserve Developer
6
- * @license http://abservetech.com/license-agreement/
7
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
8
- */
9
- ?>
10
- <div class="gift-messages">
11
- <input type="checkbox" name="allow_gift_messages" id="allow_gift_messages" value="1" <?php if($this->getItemsHasMesssages() || $this->getEntityHasMessage()): ?> checked="checked"<?php endif; ?> class="checkbox" />
12
- <label for="allow_gift_messages"><?php echo $this->__('Add a gift message to my order') ?></label>
13
- </div>
14
- <div class="gift-messages-form" id="allow-gift-message-container">
15
- <div class="inner-box">
16
- <?php if (Mage::helper('onestepcheckout/message')->isMessagesAvailable('quote', $this->getEntity())): ?>
17
- <div class="whole-order">
18
- <input id="giftmessage-type" type="hidden" name="giftmessage[<?php echo $this->getEntity()->getId() ?>][type]" value="quote" />
19
- <ul class="onestepcheckout-form-list">
20
- <li class="fields">
21
- <div class="field">
22
- <label for="gift-message-whole-from"><?php echo $this->__('From') ?></label>
23
- <div class="input-box">
24
- <input type="text" name="giftmessage[<?php echo $this->getEntity()->getId() ?>][from]" id="gift-message-whole-from" title="<?php echo $this->__('From') ?>" value="<?php echo $this->getEscaped($this->getMessage()->getSender(), $this->getDefaultFrom()) ?>" class="input-text validation-passed" />
25
- </div>
26
- </div>
27
- <div class="field f-right">
28
- <label for="gift-message-whole-to"><?php echo $this->__('To') ?></label>
29
- <div class="input-box">
30
- <input type="text" name="giftmessage[<?php echo $this->getEntity()->getId() ?>][to]" id="gift-message-whole-to" title="<?php echo $this->__('To') ?>" value="<?php echo $this->getEscaped($this->getMessage()->getRecipient(), $this->getDefaultTo()) ?>" class="input-text validation-passed" />
31
- </div>
32
- </div>
33
- </li>
34
- <li class="wide">
35
- <label for="gift-message-whole-message"><?php echo $this->__('Message') ?></label>
36
- <div class="input-box">
37
- <textarea id="gift-message-whole-message" class="input-text validation-passed giftmessage-area" name="giftmessage[<?php echo $this->getEntity()->getId() ?>][message]" title="<?php echo $this->__('Message') ?>" rows="5" cols="10"><?php echo $this->getEscaped($this->getMessage()->getMessage()) ?></textarea>
38
- </div>
39
- </li>
40
- </ul>
41
- <script type="text/javascript">
42
- //<![CDATA[
43
- //toogleRequired('gift-message-whole-message', ['gift-message-whole-from','gift-message-whole-to']);
44
- //]]>
45
- </script>
46
- </div>
47
- <?php endif; ?>
48
- </div>
49
- </div>
50
- <script type="text/javascript">
51
- //<![CDATA[
52
- Event.observe(window, 'load', function() {
53
- if ($('allow_gift_messages').checked) {
54
- $('allow-gift-message-container').show();
55
- }
56
- else {
57
- $('allow-gift-message-container').hide();
58
- }
59
-
60
- Event.observe('allow_gift_messages', 'click', function() {
61
- if ($('allow_gift_messages').checked) {
62
- $('allow-gift-message-container').show();
63
- }
64
- else {
65
- $('allow-gift-message-container').hide();
66
- }
67
- });
68
- });
69
- //]]>
70
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/template/onestepcheckout/head.phtml DELETED
@@ -1,12 +0,0 @@
1
- <?php
2
- /**
3
- * @category Abserve
4
- * @package Abserve_Module
5
- * @author Abserve Developer
6
- * @license http://abservetech.com/license-agreement/
7
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
8
- */
9
- ?>
10
- <!-- META FOR IOS & HANDHELD -->
11
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes"/>
12
- <!-- META FOR IOS & HANDHELD -->
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/template/onestepcheckout/link.phtml DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- /**
3
- * @category Abserve
4
- * @package Abserve_Module
5
- * @author Abserve Developer
6
- * @license http://abservetech.com/license-agreement/
7
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
8
- */
9
- ?>
10
- <?php $_helper = Mage::helper('onestepcheckout');?>
11
- <?php if ($_helper->enabledOnestepcheckout()):?>
12
- <button type="button" title="<?php echo $this->__('Proceed to Checkout') ?>" class="button btn-checkout" onclick="window.location='<?php echo $_helper->getCheckoutUrl(); ?>';"><span><span><?php echo $this->__('Proceed to Checkout') ?></span></span></button>
13
- <?php else:?>
14
- <?php if ($this->isPossibleOnepageCheckout()):?>
15
- <button type="button" title="<?php echo $this->__('Proceed to Checkout') ?>" class="button btn-checkout<?php if ($this->isDisabled()):?> no-checkout<?php endif; ?>"<?php if ($this->isDisabled()):?> disabled="disabled"<?php endif; ?> onclick="window.location='<?php echo $this->getCheckoutUrl() ?>';"><span><span><?php echo $this->__('Proceed to Checkout') ?></span></span></button>
16
- <?php endif?>
17
- <?php endif;?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/template/onestepcheckout/login_popup.phtml DELETED
@@ -1,139 +0,0 @@
1
- <?php
2
- /**
3
- * @category Abserve
4
- * @package Abserve_Module
5
- * @author Abserve Developer
6
- * @license http://abservetech.com/license-agreement/
7
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
8
- */
9
- ?>
10
- <div id="onestepcheckout-login-popup" style="display:none;" >
11
- <div class="onestepcheckout-popup-wrapper">
12
- <div class="onestepcheckout-popup-contents">
13
- <div id="onestepcheckout-login-popup-contents-forgot" style="display: none;">
14
- <h1><?php echo $this->__('Forgotten your password?'); ?></h1>
15
- <p class="title-forgot"><?php echo $this->__('Please enter your email below and we will send you a new password.'); ?></p>
16
- <p class="close"><a href="javascript:void(0);"><?php echo $this->__('X'); ?></a></p>
17
- <form id="onestepcheckout-forgot-form">
18
-
19
- <div id="onestepcheckout-forgot-loading" style="display: none;" class="loading-ajax-login">&nbsp;</div>
20
- <div id="onestepcheckout-forgot-error" class="onestepcheckout-error" style="display: none;">&nbsp;</div>
21
- <div id="onestepcheckout-forgot-success" style="display: none;">
22
- <!--2014.18.11 update start-->
23
- <?php echo $this->__('We have now sent you a new password to your email address.'); ?>
24
- <!--2014.18.11 update end-->
25
- </div>
26
-
27
- <ul id="onestepcheckout-forgot-table">
28
-
29
- <li>
30
- <label class="required" for="id_onestepcheckout_email"><?php echo $this->__('Email address'); ?> <em>*</em></label>
31
- <input type="text" class="input-text required-entry validate-email" name="onestepcheckout_email" id="id_onestepcheckout_email" />
32
- </li>
33
- <li class="last">
34
- <p><a href="javascript:void(0);" id="onestepcheckout-return-login-link"><span>&nbsp;</span><?php echo $this->__('Return to login'); ?></a></p>
35
- <button class="button" id="onestepcheckout-forgot-button" type="button"><?php echo $this->__('Send password'); ?></button>
36
- </li>
37
- </ul>
38
- </form>
39
-
40
- </div>
41
-
42
- <div id="onestepcheckout-login-popup-contents-login">
43
-
44
- <h1><?php echo $this->__('Login'); ?></h1>
45
- <p class="close"><a href="javascript:void(0);"><?php echo $this->__('X'); ?></a></p>
46
- <!--p><?php echo $this->__('Please login with your email address and password.'); ?></p-->
47
- <form id="onestepcheckout-login-form">
48
-
49
- <div id="onestepcheckout-login-loading" style="display: none;" class="loading-ajax-login">&nbsp;</div>
50
- <div id="onestepcheckout-login-error" class="onestepcheckout-error" style="display: none;">&nbsp;</div>
51
-
52
- <ul id="onestepcheckout-login-table">
53
- <li>
54
- <div class="input-box">
55
- <label class="required" for="id_onestepcheckout_username"><?php echo $this->__('Email address'); ?> <em>*</em></label>
56
- <input tabindex="100" type="text" class="input-text required-entry validate-email" name="onestepcheckout_username" id="id_onestepcheckout_username" />
57
- </div>
58
-
59
- </li>
60
- <li>
61
- <div class="input-box">
62
- <label class="required" for="id_onestepcheckout_password"><?php echo $this->__('Password'); ?> <em>*</em></label>
63
- <input type="password" tabindex="101" name="onestepcheckout_password" class="input-text required-entry validate-password" id="id_onestepcheckout_password" />
64
- </div>
65
- </li>
66
- <li class="last">
67
- <button class="button" tabindex="102" id="onestepcheckout-login-button" type="button"><?php echo $this->__('Login'); ?></button>
68
- </li>
69
- </ul>
70
- </form>
71
- <p class="forgot-link"><a href="javascript:void(0);" id="onestepcheckout-forgot-password-link"><span>&nbsp;</span><?php echo $this->__('Forgotten your password?'); ?></a></p>
72
- </div>
73
- </div>
74
- </div>
75
-
76
- </div>
77
- <?php //die('Michael');?>
78
- <script>
79
- var onestepcheckout_login_popup;
80
- var login_popup;
81
- Event.observe(window, 'load', function() {
82
- var options = {
83
- forgot_password_url: '<?php echo $this->getUrl('onestepcheckout/ajax/forgotPassword', array('_secure'=>true)); ?>',
84
- login_url: '<?php echo $this->getUrl('onestepcheckout/ajax/login', array('_secure'=>true)); ?>',
85
- translations: {
86
- invalid_email: '<?php echo $this->__('Please enter a valid email address'); ?>',
87
- email_not_found: '<?php echo $this->__('Please enter a registered email address.'); ?>'
88
- }
89
- };
90
- onestepcheckout_login_popup = new OneStepCheckoutLoginPopup(options);
91
- login_popup = onestepcheckout_login_popup;
92
- });
93
- </script>
94
-
95
- <!-- Terms and conditions -->
96
- <?php $_helper = Mage::helper('onestepcheckout'); ?>
97
- <?php $width = $_helper->getTermPopupWidth() ? $_helper->getTermPopupWidth() : 482; ?>
98
- <?php $height = $_helper->getTermPopupHeight() ? $_helper->getTermPopupHeight() : 530; ?>
99
-
100
-
101
- <?php if (!$_helper->enableCustomSize()): ?>
102
- <div id="onestepcheckout-toc-popup" style="display:none;">
103
- <div class="onestepcheckout-popup-wrapper">
104
- <div class="onestepcheckout-popup-wrapper-inner">
105
- <h1><span><?php echo $_helper->getTermTitle(); ?></span></h1>
106
-
107
- <div class="onestepcheckout-toc-terms" style="height: 446px;">
108
- <div class="onestepcheckout-toc-terms-content">
109
- <?php echo $_helper->getTermsConditionsHtml(); ?>
110
- </div>
111
- </div>
112
-
113
- <p class="close"><a href="javascript:void(0);"><?php echo $this->__('X'); ?></a></p>
114
- </div>
115
- </div>
116
- </div>
117
- <?php else: ?>
118
- <div id="onestepcheckout-toc-popup" style="display:none; width:<?php echo $width ?>px; height:<?php echo $height ?>px;">
119
- <div class="onestepcheckout-popup-wrapper2" style="width:<?php echo $width ?>px; height:<?php echo $height ?>px;">
120
- <div class="onestepcheckout-popup-wrapper-inner2">
121
- <h1><span><?php echo $_helper->getTermTitle(); ?></span></h1>
122
-
123
- <div class="onestepcheckout-toc-terms" style="<?php
124
- if ($height) {
125
- echo 'height: ' . ((int) $height) . 'px;';
126
- } else {
127
- echo 'height: 446px;';
128
- }
129
- ?>"> <div class="onestepcheckout-toc-terms-content">
130
- <?php echo $_helper->getTermsConditionsHtml(); ?>
131
- </div>
132
- </div>
133
-
134
- <p class="close"><a href="javascript:void(0);"><?php echo $this->__('X'); ?></a></p>
135
- </div>
136
- </div>
137
-
138
- </div>
139
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/template/onestepcheckout/onestepcheckout.phtml DELETED
@@ -1,1018 +0,0 @@
1
- <?php
2
- /**
3
- * @category Abserve
4
- * @package Abserve_Module
5
- * @author Abserve Developer
6
- * @license http://abservetech.com/license-agreement/
7
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
8
- */
9
- ?>
10
- <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places&language=en"></script><script type="text/javascript">if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { $$('.onestepcheckout-index-index')[0].addClassName('iphone');}</script>
11
- <?php $styleChange = Mage::helper('onestepcheckout')->getStyle(); ?>
12
- <?php $background_color = Mage::helper('onestepcheckout')->getBackgroundColor($styleChange); ?>
13
- <?php $background_button = Mage::helper('onestepcheckout')->getCheckoutButtonColor(); ?>
14
- <?php if (!$styleChange || $styleChange == 'orange'): ?>
15
- <?php $styleUse = Mage::helper('onestepcheckout')->getBackgroundColor('orange'); ?>
16
- <?php elseif ($styleChange == 'custom'): ?>
17
- <?php $styleUse = '#' . Mage::helper('onestepcheckout')->getStyleColor(); ?>
18
- <?php else: ?>
19
- <?php $styleUse = Mage::helper('onestepcheckout')->getBackgroundColor($styleChange); ?>
20
- <?php endif; ?>
21
- <?php $_helper = Mage::helper('onestepcheckout'); ?>
22
- <style type="text/css">
23
- .one-step-checkout h3
24
- {
25
- background-color:<?php echo $styleUse ?> !important;
26
- }
27
- button.onestepcheckout-btn-checkout{
28
- background:<?php echo $background_button ?> !important;
29
- }
30
- button.onestepcheckout-btn-checkout:hover{
31
- cursor: pointer;
32
- }
33
- button.onestepcheckout-btn-checkout span span{
34
- font-size:20px !important;
35
- }
36
-
37
- button#remove_coupon_code_button,
38
- button#add_coupon_code_button,
39
- .onestepcheckout-popup-wrapper h1,
40
- #onestepcheckout-login-popup button.button,
41
- #onestepcheckout-forgot-button,
42
- #onestepcheckout-toc-popup h1,
43
- .onestepcheckout-login-link a span,
44
- #onestepcheckout-forgot-table li.last p a span,
45
- p.forgot-link a span
46
- {
47
- background-color:<?php echo $styleUse ?> !important;
48
-
49
- }
50
- .onestepcheckout-login-link a,
51
- p.forgot-link a,
52
- #onestepcheckout-forgot-table li.last p a
53
- { color:<?php echo $styleUse ?> !important; }
54
- button#add_coupon_code_button:hover{
55
- cursor: pointer;
56
- }
57
-
58
- button#remove_coupon_code_button:hover{
59
- cursor: pointer;
60
- }
61
- button.place-order-loader span {
62
- background:none !important;
63
- }
64
- #notify-email-invalid{
65
- width:250px !important;
66
- height:70px !important;
67
- position:fixed !important;
68
- margin-left:-125px !important;
69
- margin-top:-50px !important;
70
- top:50% !important;
71
- left:50% !important;
72
- z-index:9999999 !important;
73
- background:#fff;
74
- box-shadow: 3px 3px 3px #aaa;
75
- border-radius:5px;
76
- }
77
- #notify-email-invalid-overlay{
78
- position: fixed !important;
79
- top: 0 !important;
80
- left: 0 !important;
81
- width: 100% !important;
82
- height: 100% !important;
83
- z-index:9999998 !important;
84
- opacity: 0.65;
85
- }
86
- </style>
87
-
88
- <div id="ajaxcart-load-ajax" style="display:none;">
89
- <div id="load" class="ajaxcart-overlay">&nbsp;</div>
90
- <div id="ajaxcart-loading" class="ajaxcart-loading">
91
- <img alt="<?php echo $this->__('Loading') ?>..." src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" /><br />
92
- <?php echo $this->__('Loading') ?>...
93
- </div>
94
- <div id="form-paypal" style="display:none;" class="form-paypal"></div>
95
- </div>
96
-
97
- <ol class="one-step-checkout clearfix">
98
- <li>
99
- <h1 class="checkout_header"><?php echo $this->getCheckoutTitle(); ?></h1>
100
- <p class="subtitle">
101
- <?php echo $this->configData['checkout_description'] ? $this->configData['checkout_description'] : 'Please fill in the fields below and click Place order to complete your purchase!'; ?>
102
- </p>
103
- </li>
104
- <?php if ($this->isShowLoginLink() && !$this->isCustomerLoggedIn()): ?>
105
- <li class="onestepcheckout-login-link">
106
- <a href="javascript:void(0);" id="onestepcheckout-login-link"><span>&nbsp;</span>
107
- <?php echo $this->configData['login_link_title'] ? $this->configData['login_link_title'] : $this->__('Already have an account?Click here to login') ?>
108
- </a>
109
- </li>
110
- <?php endif ?>
111
- <li class='payment_buttons'>
112
- <?php if(Mage::helper('core')->isModuleEnabled('Amazon_Payments')) echo $this->getChildHtml('amazon_button');?>
113
- </li>
114
- <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
115
- <li class="address-order">
116
- <form id="one-step-checkout-form" method="post" action="<?php echo $this->getCheckoutUrl(); ?>">
117
- <div class="address-information <?php if ($this->configData['page_layout'] == '3columns'): ?>address-info-3-columns<?php endif; ?>">
118
- <?php echo $this->getChildHtml('onestepcheckout.billing'); ?>
119
- <?php echo $this->getChildHtml('onestepcheckout.shipping'); ?>
120
-
121
- </div>
122
- <?php if ($this->configData['page_layout'] == '3columns'): ?>
123
- <div class="onestepcheckout-shipping-payment-review">
124
- <?php endif; ?>
125
- <?php if ($this->isVirtual() || !Mage::helper('onestepcheckout')->isHideShippingMethod() || $_helper->enabledDelivery()): ?>
126
- <div class="order-information <?php if ($this->configData['page_layout'] == '3columns'): ?>order-info-3-columns<?php endif; ?>">
127
- <ol>
128
- <?php if (!$this->isVirtual() && !Mage::helper('onestepcheckout')->isHideShippingMethod()): ?>
129
- <li class="shipping-method">
130
- <h3 style="float:left" id="shipping_method_step_header" class="step_2">
131
- <?php echo $this->__('Shipping Method'); ?>
132
- </h3>
133
- <div class="ajax-loader3" id="ajax-shipping" style="display:none; float: left; margin-top: 14px; margin-left: 10px;"></div>
134
- <div class="clear"></div>
135
-
136
- <div class="onestepcheckout-shipping-method-section" id="onestepcheckout-shipping-method-section">
137
- <?php echo $this->getChildHtml('onestepcheckout.shipping_method'); ?>
138
- </div>
139
- <div class="ajax-loader1" id="ajax-loader1" style="display:none;"></div>
140
- <div id="control_overlay_shipping" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 9998; display: none;"></div>
141
- </li>
142
- <!--2014.18.11 fix hide shipping move check xuong duoi-->
143
- <?php endif; ?>
144
-
145
- <?php if ($_helper->enabledDelivery()): ?>
146
- <li class="delivery">
147
- <h3 id="time_of_delivery_header" <?php if (!$this->isVirtual() && !Mage::helper('onestepcheckout')->isHideShippingMethod()): ?> class="step_3" <?php else: ?> class="step_2"<?php endif ?>>
148
- <?php echo $this->__('Time Of Delivery'); ?>
149
- </h3>
150
- <div class="delivery_time_date">
151
- <label for="delivery_date" ><?php echo $this->__('Select a date') ?>: </label>
152
- <p style="float:left;">
153
- <input readonly="readonly" id="delivery_date" type="text" size="7" style="background: none repeat scroll 0 center rgba(0, 0, 0, 0); border: medium none; box-shadow: none; cursor: default; font-weight: bold;" value="<?php echo date('m.d.Y') ?>" name="delivery[onestepcheckout-date]" />
154
- <img src="<?php echo Mage::getBaseUrl('skin') ?>/adminhtml/default/default/images/grid-cal.gif" alt="dateinput" class="v-middle" id="delivery_date_trig" title="dateinput" />
155
- </p>
156
- <select name="delivery[onestepcheckout-time]" style="margin-left:6px;">
157
- <?php for ($i = 0; $i <= 23; $i++): ?>
158
- <option value="<?php echo str_pad($i, 2, '0', STR_PAD_LEFT) ?>:00"><?php echo str_pad($i, 2, '0', STR_PAD_LEFT) ?>:00</option>
159
- <?php endfor; ?>
160
- </select>
161
- </div>
162
-
163
- <link rel="stylesheet" type="text/css" href="<?php echo Mage::getBaseUrl('js') ?>calendar/calendar-win2k-1.css" />
164
-
165
- <script type="text/javascript">
166
- //<![CDATA[
167
- enUS = {"m": {"wide": ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], "abbr": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]}}; // en_US locale reference
168
- Calendar._DN = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; // full day names
169
- Calendar._SDN = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; // short day names
170
- Calendar._FD = 0; // First day of the week. "0" means display Sunday first, "1" means display Monday first, etc.
171
- Calendar._MN = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; // full month names
172
- Calendar._SMN = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; // short month names
173
- Calendar._am = "AM"; // am/pm
174
- Calendar._pm = "PM";
175
-
176
- // tooltips
177
- Calendar._TT = {};
178
- Calendar._TT["INFO"] = "About the calendar";
179
-
180
- Calendar._TT["ABOUT"] =
181
- "DHTML Date/Time Selector\n" +
182
- "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" +
183
- "For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
184
- "Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." +
185
- "\n\n" +
186
- "Date selection:\n" +
187
- "- Use the \xab, \xbb buttons to select year\n" +
188
- "- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
189
- "- Hold mouse button on any of the above buttons for faster selection.";
190
- Calendar._TT["ABOUT_TIME"] = "\n\n" +
191
- "Time selection:\n" +
192
- "- Click on any of the time parts to increase it\n" +
193
- "- or Shift-click to decrease it\n" +
194
- "- or click and drag for faster selection.";
195
-
196
- Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)";
197
- Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)";
198
- Calendar._TT["GO_TODAY"] = "Go Today";
199
- Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)";
200
- Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)";
201
- Calendar._TT["SEL_DATE"] = "Select date";
202
- Calendar._TT["DRAG_TO_MOVE"] = "Drag to move";
203
- Calendar._TT["PART_TODAY"] = ' (' + "Today" + ')';
204
-
205
- // the following is to inform that "%s" is to be the first day of week
206
- Calendar._TT["DAY_FIRST"] = "Display %s first";
207
-
208
- // This may be locale-dependent. It specifies the week-end days, as an array
209
- // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
210
- // means Monday, etc.
211
- Calendar._TT["WEEKEND"] = "0,6";
212
-
213
- Calendar._TT["CLOSE"] = "Close";
214
- Calendar._TT["TODAY"] = "Today";
215
- Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value";
216
-
217
- // date formats
218
- Calendar._TT["DEF_DATE_FORMAT"] = "%b %e, %Y";
219
- Calendar._TT["TT_DATE_FORMAT"] = "%B %e, %Y";
220
-
221
- Calendar._TT["WK"] = "Week";
222
- Calendar._TT["TIME"] = "Time:";
223
-
224
- CalendarDateObject._LOCAL_TIMZEONE_OFFSET_SECONDS = -28800;
225
-
226
-
227
- Calendar.setup({
228
- inputField: "delivery_date",
229
- ifFormat: "%m.%d.%Y",
230
- showsTime: false,
231
- button: "delivery_date_trig",
232
- electric: false,
233
- singleClick: true,
234
- disableFunc : function(date) {
235
- var today = new Date();
236
-
237
- if(date.getFullYear() < today.getFullYear()){
238
- return true;
239
- }else if(date.getMonth() < today.getMonth() && date.getFullYear() <= today.getFullYear()) {
240
- return true;
241
- }else if(date.getDate() < today.getDate() && date.getMonth() <= today.getMonth() && date.getFullYear() <= today.getFullYear()) {
242
- return true;
243
- }
244
- if(today.getDate() == date.getDate()){
245
- return false;
246
- }
247
-
248
- }
249
- });
250
- //]]>
251
- </script>
252
-
253
- </li>
254
- <?php endif; ?>
255
-
256
- </ol>
257
- <!--2014.18.11 fix 2 column start-->
258
- <?php if ($this->configData['page_layout'] == '2columns'): ?>
259
- <ol>
260
- <div class="order-review-section" style="width: 100%">
261
- <li class="payment-method">
262
- <h3 style="float:left" id="payment_method_step_header" <?php if (!$this->isVirtual() && !Mage::helper('onestepcheckout')->isHideShippingMethod() && $_helper->enabledDelivery()): ?> class="step_4"<?php elseif (!$this->isVirtual() && Mage::helper('onestepcheckout')->isHideShippingMethod() && !$_helper->enabledDelivery()): ?>class="step_2"<?php else: ?> class="step_3"<?php endif; ?>>
263
- <?php echo $this->__('Payment Method'); ?>
264
- </h3>
265
- <div class="ajax-loader3" id="ajax-payment" style="display:none; float: left; margin-top: 14px; margin-left: 10px;"></div>
266
- <div class="clear"></div>
267
- <div id="onestepcheckout-payment-methods" class="onestepcheckout-payment-methods">
268
- <?php echo $this->getChildHtml('onestepcheckout.payment_method'); ?></div> <div id="control_overlay_payment" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 9998; display: none;"></div>
269
- </li>
270
- </div>
271
- <div class="onestepcheckout-review-info">
272
- <li class="order-review-info">
273
- <h3 style="float:left" id="review_step_header" <?php if (!$this->isVirtual() && !Mage::helper('onestepcheckout')->isHideShippingMethod()): ?> class="step_4" <?php else: ?> class="step_3"<?php endif ?>>
274
- <?php echo $this->__('Order Review'); ?>
275
- </h3>
276
- <div class="ajax-loader3" id="ajax-review" style="display:none; float: left; margin-top: 14px; margin-left: 10px;"></div>
277
- <div class="clear"></div>
278
- <?php echo $this->getChildHtml('onestepcheckout.review') ?>
279
- <div class="ajax-loader3" id="ajax-loader3" style="display:none;"></div>
280
- <div id="control_overlay_review" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 9998; display: none;"></div>
281
- </li>
282
- </div>
283
- <div class="button-set clearfix button-onestepcheckout">
284
- <!--
285
- <label for="forgot"><?php echo $this->__('Forgot an Item?') ?> <a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit Your Cart') ?></a></label>
286
- <br />-->
287
- <div class="clear"></div>
288
- <button style="float:left" onclick="oscPlaceOrder(this);" id="onestepcheckout-button-place-order" type="button" title="<?php echo $this->__('Place Order') ?>" class="btn-proceed-checkout onestepcheckout-btn-checkout onestepcheckout-place">
289
- <span>
290
- <span>
291
- <?php echo $this->__('Place order now') ?>
292
- </span>
293
- </span>
294
- </button>
295
- </div>
296
- <div id="onestepcheckout-place-order-loading" style="display:none;margin-top:10px; ">
297
- <!--img style="float:left;" src="<?php echo $styleUse; ?>loading-icon.gif"-->
298
- <p style="float:left;padding-top:5px;">&nbsp;&nbsp;<?php echo $this->__('Please wait, processing your order...') ?></p>
299
- </div>
300
- </ol>
301
- <?php endif; ?>
302
- <!--2014.18.11 fix 2 column end-->
303
- </div>
304
- <!--2014.18.11 fix 2 column start-->
305
- <?php elseif (!$_helper->enabledDelivery() && Mage::helper('onestepcheckout')->isHideShippingMethod() && $this->hasOnlyOneShippingMethod()): ?>
306
- <?php if ($this->configData['page_layout'] == '2columns'): ?>
307
- <div class="order-information order-info-2-columns">
308
- <ol>
309
- <div class="order-review-section" style="width: 100%">
310
- <li class="payment-method">
311
- <h3 style="float:left" id="payment_method_step_header" <?php if (!$this->isVirtual() && !Mage::helper('onestepcheckout')->isHideShippingMethod() && $_helper->enabledDelivery()): ?> class="step_4"<?php elseif (!$this->isVirtual() && Mage::helper('onestepcheckout')->isHideShippingMethod() && !$_helper->enabledDelivery()): ?>class="step_2"<?php else: ?> class="step_3"<?php endif; ?>>
312
- <?php echo $this->__('Payment Method'); ?>
313
- </h3>
314
- <div class="ajax-loader3" id="ajax-payment" style="display:none; float: left; margin-top: 14px; margin-left: 10px;"></div>
315
- <div class="clear"></div>
316
- <div id="onestepcheckout-payment-methods" class="onestepcheckout-payment-methods">
317
- <?php echo $this->getChildHtml('onestepcheckout.payment_method'); ?></div> <div id="control_overlay_payment" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 9998; display: none;"></div>
318
- </li>
319
- </div>
320
- <div class="onestepcheckout-review-info">
321
- <li class="order-review-info">
322
- <h3 style="float:left" id="review_step_header" <?php if (!$this->isVirtual() && !Mage::helper('onestepcheckout')->isHideShippingMethod()): ?> class="step_4" <?php else: ?> class="step_3"<?php endif ?>>
323
- <?php echo $this->__('Order Review'); ?>
324
- </h3>
325
- <div class="ajax-loader3" id="ajax-review" style="display:none; float: left; margin-top: 14px; margin-left: 10px;"></div>
326
- <div class="clear"></div>
327
- <?php echo $this->getChildHtml('onestepcheckout.review') ?>
328
- <div class="ajax-loader3" id="ajax-loader3" style="display:none;"></div>
329
- <div id="control_overlay_review" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 9998; display: none;"></div>
330
- </li>
331
- </div>
332
- <div class="button-set clearfix button-onestepcheckout">
333
- <!--
334
- <label for="forgot"><?php echo $this->__('Forgot an Item?') ?> <a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit Your Cart') ?></a></label>
335
- <br />-->
336
- <div class="clear"></div>
337
- <button style="float:left" onclick="oscPlaceOrder(this);" id="onestepcheckout-button-place-order" type="button" title="<?php echo $this->__('Place Order') ?>" class="btn-proceed-checkout onestepcheckout-btn-checkout onestepcheckout-place">
338
- <span>
339
- <span>
340
- <?php echo $this->__('Place order now') ?>
341
- </span>
342
- </span>
343
- </button>
344
- </div>
345
- <div id="onestepcheckout-place-order-loading" style="display:none;margin-top:10px; ">
346
- <!--img style="float:left;" src="<?php echo $styleUse; ?>loading-icon.gif"-->
347
- <p style="float:left;padding-top:5px;">&nbsp;&nbsp;<?php echo $this->__('Please wait, processing your order...') ?></p>
348
- </div>
349
- </ol>
350
- </div>
351
- <?php endif; ?>
352
- <!--2014.18.11 fix 2 column end-->
353
- <?php endif; ?>
354
-
355
- <!--2014.18.11 fix hide shipping start-->
356
- <?php if (Mage::helper('onestepcheckout')->isHideShippingMethod()): ?>
357
- <?php $_shippingMethod = $this->hasOnlyOneShippingMethod(); ?>
358
- <span class="no-display">
359
- <input name="shipping_method" type="radio" value="<?php echo $_shippingMethod; ?>" id="s_method_<?php echo $_shippingMethod; ?>" checked="checked" />
360
- </span>
361
- <?php endif; ?>
362
- <!--2014.18.11 fix hide shipping end-->
363
-
364
- <?php if ($this->configData['page_layout'] == '3columns'): ?>
365
- <!--2014.18.11 fix big hole in 3 column start-->
366
- <div class="order-review-section" style="<?php if (Mage::helper('onestepcheckout')->isHideShippingMethod() && !$_helper->enabledDelivery()) if($this->hasOnlyOneShippingMethod()) echo 'width: 100% !important' ;?>">
367
- <!--2014.18.11 fix big hole in 3 column end-->
368
- <ol>
369
- <li class="payment-method">
370
- <h3 style="float:left" id="payment_method_step_header" <?php if (!$this->isVirtual() && !Mage::helper('onestepcheckout')->isHideShippingMethod() && $_helper->enabledDelivery()): ?> class="step_4"<?php elseif (!$this->isVirtual() && Mage::helper('onestepcheckout')->isHideShippingMethod() && !$_helper->enabledDelivery()): ?>class="step_2"<?php else: ?> class="step_3"<?php endif; ?>>
371
- <?php echo $this->__('Payment Method'); ?>
372
- </h3>
373
- <div class="ajax-loader3" id="ajax-payment" style="display:none; float: left; margin-top: 14px; margin-left: 10px;"></div>
374
- <div class="clear"></div>
375
- <div id="onestepcheckout-payment-methods" class="onestepcheckout-payment-methods">
376
- <?php echo $this->getChildHtml('onestepcheckout.payment_method'); ?></div> <div id="control_overlay_payment" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 9998; display: none;"></div>
377
- </li>
378
-
379
- </ol>
380
- </div>
381
- <?php endif; ?>
382
- <?php if ($this->configData['page_layout'] == '3columns'): ?>
383
- <div class="onestepcheckout-review-info">
384
- <ol>
385
- <li class="order-review-info">
386
- <h3 style="float:left" id="review_step_header" <?php if (!$this->isVirtual() && !Mage::helper('onestepcheckout')->isHideShippingMethod()): ?> class="step_4" <?php else: ?> class="step_3"<?php endif ?>>
387
- <?php echo $this->__('Order Review'); ?>
388
- </h3>
389
- <div class="ajax-loader3" id="ajax-review" style="display:none; float: left; margin-top: 14px; margin-left: 10px;"></div>
390
- <div class="clear"></div>
391
- <?php echo $this->getChildHtml('onestepcheckout.review') ?>
392
- <div class="ajax-loader3" id="ajax-loader3" style="display:none;"></div>
393
- <div id="control_overlay_review" style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; z-index: 9998; display: none;"></div>
394
-
395
- </li>
396
- </ol>
397
- </div>
398
- <div class="button-set clearfix button-onestepcheckout">
399
- <!--
400
- <label for="forgot"><?php echo $this->__('Forgot an Item?') ?> <a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit Your Cart') ?></a></label>
401
- <br />-->
402
- <div class="clear"></div>
403
- <button style="float:left" onclick="oscPlaceOrder(this);" id="onestepcheckout-button-place-order" type="button" title="<?php echo $this->__('Place Order') ?>" class="btn-proceed-checkout onestepcheckout-btn-checkout onestepcheckout-place">
404
- <span>
405
- <span>
406
- <?php echo $this->__('Place order now') ?>
407
- </span>
408
- </span>
409
- </button>
410
- </div>
411
- <div id="onestepcheckout-place-order-loading" style="display:none;margin-top:10px; ">
412
- <!--img style="float:left;" src="<?php echo $styleUse; ?>loading-icon.gif"-->
413
- <p style="float:left;padding-top:5px;">&nbsp;&nbsp;<?php echo $this->__('Please wait, processing your order...') ?></p>
414
- </div>
415
- </div>
416
-
417
- <?php endif; ?>
418
- <?php if (!$_helper->isCustomerLoggedIn() && $_helper->showLoginLink()): ?>
419
- <?php echo $this->getChildHtml('login-popup'); ?>
420
- <?php endif; ?>
421
- </form>
422
- </li>
423
- </ol>
424
- <script type="text/javascript">
425
-
426
- //<![CDATA[
427
- var preloadImage = '<?php echo $this->getSkinUrl('images/onestepcheckout/preload.gif') ?>';
428
- var shipping_method_url = '<?php echo $this->getUrl('onestepcheckout/index/save_shipping', array('_secure' => true)); ?>';
429
- var enable_update_payment = <?php echo $this->configData['update_payment'] ? 'true' : 'false'; ?>;
430
- var login_url = '<?php echo $this->getUrl('onestepcheckout/index/show_login', array('_secure' => true)); ?>';
431
- var show_login_link = <?php echo $this->configData['show_login_link'] ? 'true' : 'false'; ?>;
432
- var show_term_condition_url = '<?php echo $this->getUrl('onestepcheckout/index/show_term_condition', array('_secure' => true)); ?>';
433
- var form = $('one-step-checkout-form');
434
- var reload_payment = <?php echo $this->configData['reload_payment']; ?>;
435
-
436
- function showloginbox() {
437
- var url = '<?php echo $this->getUrl('onestepcheckout/index/show_login', array('_secure' => true)); ?>';
438
- showLogin(url);
439
- }
440
-
441
- function showforgotpwd() {
442
- var url = '<?php echo $this->getUrl('onestepcheckout/index/show_password', array('_secure' => true)); ?>';
443
- showpwdbox(url);
444
- }
445
-
446
- function showPasswordForm() {
447
- $('onestepcheckout-login').hide();
448
- $('onestepcheckout-forgot-password').show();
449
- }
450
-
451
- function showloginform() {
452
- $('onestepcheckout-forgot-password').hide();
453
- $('onestepcheckout-login').show();
454
- }
455
-
456
- function submitLoginForm() {
457
- var login_validator = new Validation('onestepcheckout-login-form');
458
- if (login_validator.validate()) {
459
- showLoginLoading();
460
- var url = '<?php echo $this->getUrl('onestepcheckout/index/loginPost', array('_secure' => true)) ?>';
461
- var email = $('osclogin:email_address').value;
462
- var password = $('osclogin:password').value;
463
- var parameters = {email: email, password: password};
464
- var loginRequest = new Ajax.Request(url, {
465
- parameters: parameters,
466
- onComplete: loginProcess.bindAsEventListener(this),
467
- onFailure: ""
468
- });
469
- }
470
- }
471
-
472
- function retrievePassword() {
473
- var passwordValidator = new Validation('osc-forgotpassword-form');
474
- if (passwordValidator.validate()) {
475
- showPassLoading();
476
- var url = '<?php echo $this->getUrl('onestepcheckout/index/retrievePassword', array('_secure' => true)) ?>';
477
- var email = $('forgotpassword_email_address').value;
478
- var parameters = {email: email};
479
- var loginRequest = new Ajax.Request(url, {
480
- parameters: parameters,
481
- onComplete: passwordProcess.bindAsEventListener(this),
482
- onFailure: ""
483
- });
484
- }
485
- }
486
-
487
-
488
- <?php $storeId = Mage::app()->getStore(true)->getStoreId() ?>
489
- var save_address_url = '<?php echo $this->getUrl('onestepcheckout/index/saveAddressOnestepcheckout', array('_secure' => true)) ?>';
490
- var update_address_shipping = '<?php echo Mage::getStoreConfig('onestepcheckout/ajax_update/address_shipping', $storeId) ?>';
491
- var update_address_payment = '<?php echo Mage::getStoreConfig('onestepcheckout/ajax_update/address_payment', $storeId) ?>';
492
- var update_address_review = '<?php echo Mage::getStoreConfig('onestepcheckout/ajax_update/address_review', $storeId) ?>';
493
- var update_shipping_payment = '<?php echo Mage::getStoreConfig('onestepcheckout/ajax_update/shipping_payment', $storeId) ?>';
494
- var update_shipping_review = '<?php echo Mage::getStoreConfig('onestepcheckout/ajax_update/shipping_review', $storeId) ?>';
495
- var update_payment_review = '<?php echo Mage::getStoreConfig('onestepcheckout/ajax_update/payment_review', $storeId) ?>';
496
-
497
- <?php if (Mage::getStoreConfig('onestepcheckout/ajax_update/enable_ajax', $storeId)): ?>
498
-
499
- //save address when change country field
500
- <?php if ($this->isAjaxBillingField('country')): ?>
501
- //2014.18.11 fix VAT apply start
502
- if ($('billing:taxvat'))
503
- Event.observe('billing:taxvat', 'change', function() {
504
- //check empty fields
505
- var empty = checkEmptyFields($('billing-new-address-form'));
506
- if (empty == false || reload_payment == 2)
507
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
508
- });
509
- //2014.18.11 fix VAT apply end
510
-
511
- //save billing when country is changed
512
- if ($('billing:country_id'))
513
- Event.observe('billing:country_id', 'change', function() {
514
- //check empty fields
515
- var empty = checkEmptyFields($('billing-new-address-form'));
516
- if (empty == false || reload_payment == 2)
517
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
518
- //Thinhnd
519
- <?php if (Mage::getStoreConfig('onestepcheckout/field_require_management/region')): ?>
520
- if ($('billing:region').style.display != 'none')
521
- {
522
- $('billing:region').addClassName('required-entry');
523
- $$('span.required')[8].style.display = '';
524
- }
525
- <?php endif; ?>
526
- //end
527
- });
528
- <?php if ($this->isShowShippingAddress()): ?>
529
- if ($('shipping:country_id'))
530
- Event.observe('shipping:country_id', 'change', function() {
531
- //check empty fields
532
- var empty = checkEmptyFields($('shipping-new-address-form'));
533
- if (empty == false || reload_payment == 2)
534
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
535
- });
536
- <?php endif; ?>
537
- <?php endif; ?>
538
-
539
- //save address when change state/region field
540
- <?php if ($this->isAjaxBillingField('state/region')): ?>
541
- //save billing when state / region is changed
542
- if ($('billing:region_id'))
543
- Event.observe('billing:region_id', 'change', function() {
544
- //check empty fields
545
- var empty = checkEmptyFields($('billing-new-address-form'));
546
- if (empty == false || reload_payment == 2)
547
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
548
- });
549
- if ($('billing:region'))
550
- Event.observe('billing:region', 'change', function() {
551
- //check empty fields
552
- var empty = checkEmptyFields($('billing-new-address-form'));
553
- if (empty == false || reload_payment == 2)
554
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
555
- });
556
- <?php if ($this->isShowShippingAddress()): ?>
557
- if ($('shipping:region_id'))
558
- Event.observe('shipping:region_id', 'change', function() {
559
- //check empty fields
560
- var empty = checkEmptyFields($('shipping-new-address-form'));
561
- if (empty == false || reload_payment == 2)
562
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
563
- });
564
- if ($('shipping:region'))
565
- Event.observe('shipping:region', 'change', function() {
566
- //check empty fields
567
- var empty = checkEmptyFields($('shipping-new-address-form'));
568
- if (empty == false || reload_payment == 2)
569
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
570
- });
571
- <?php endif; ?>
572
- <?php endif; ?>
573
-
574
- //save address when change postcode field
575
- <?php if ($this->isAjaxBillingField('postcode')): ?>
576
- //save billing when postcode is changed
577
- if ($('billing:postcode'))
578
- Event.observe('billing:postcode', 'change', function() {
579
- //check empty fields
580
- var empty = checkEmptyFields($('billing-new-address-form'));
581
- if (empty == false || reload_payment == 2)
582
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
583
- });
584
- <?php if ($this->isShowShippingAddress()): ?>
585
- if ($('shipping:postcode'))
586
- Event.observe('shipping:postcode', 'change', function() {
587
- //check empty fields
588
- var empty = checkEmptyFields($('shipping-new-address-form'));
589
- if (empty == false || reload_payment == 2)
590
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
591
- });
592
- <?php endif; ?>
593
- <?php endif; ?>
594
-
595
- //save address when change city field
596
- <?php if ($this->isAjaxBillingField('city')): ?>
597
- //save billing when city is changed
598
- if ($('billing:city'))
599
- Event.observe('billing:city', 'change', function() {
600
- //check empty fields
601
- var empty = checkEmptyFields($('billing-new-address-form'));
602
- if (empty == false || reload_payment == 2)
603
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
604
- });
605
- <?php if ($this->isShowShippingAddress()): ?>
606
- if ($('shipping:city'))
607
- Event.observe('shipping:city', 'change', function() {
608
- //check empty fields
609
- var empty = checkEmptyFields($('shipping-new-address-form'));
610
- if (empty == false || reload_payment == 2)
611
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
612
- });
613
- <?php endif; ?>
614
- <?php endif; ?>
615
-
616
- //2014.18.11 delete reload when change telephone
617
- <?php endif ?>
618
-
619
- //document.observe('dom:loaded', function() {
620
- //fix for IE9
621
- Event.observe(window, 'load', function() {
622
- if($('create_account_checkbox_id')){
623
- if ($('create_account_checkbox_id').checked)
624
- $('password_section_id').show();
625
- else
626
- $('password_section_id').hide();
627
- }
628
- if ($RF(form, 'payment[method]') != null) {
629
- var payment_method = $RF(form, 'payment[method]');
630
- if ($('container_payment_method_' + payment_method)) {
631
- $('container_payment_method_' + payment_method).show();
632
- }
633
- if ($('payment_form_' + payment_method)) {
634
- $('payment_form_' + payment_method).show();
635
- }
636
- }
637
- });
638
-
639
- function disable_payment() {
640
- var options = document.getElementsByName('payment[method]');
641
- for (var i = 0; i < options.length; i++) {
642
- if (!$(options[i].id).checked) {
643
- var container = options[i].id.replace('p_method', 'container_payment_method');
644
- if ($(container)) {
645
- $(container).innerHTML = '';
646
- }
647
- }
648
- }
649
- }
650
-
651
- /* isUseAmazon() return true if use Amazon payment method */
652
- function isUseAmazon(){
653
- var options = document.getElementsByName('payment[method]');
654
- var pay = true;
655
- for(var i=0;i<options.length;i++){
656
- if($(options[i].id).checked){
657
- if(options[i].value == 'amazon_payments')
658
- pay = false;
659
- break;
660
- }
661
- }
662
- if(pay==true){
663
- return false;
664
- }
665
- return true;
666
- }
667
- /* end */
668
-
669
- function checkpayment() {
670
- var options = document.getElementsByName('payment[method]');
671
- var pay = true;
672
- for (var i = 0; i < options.length; i++) {
673
- if ($(options[i].id).checked) {
674
- pay = false;
675
- break;
676
- }
677
- }
678
- if (pay == true) {
679
- return false;
680
- }
681
- return true;
682
- }
683
- function oscPlaceOrder(element) {
684
- var validator = new Validation('one-step-checkout-form');
685
- var form = $('one-step-checkout-form');
686
- if (validator.validate()) {
687
- if (($('p_method_hosted_pro') && $('p_method_hosted_pro').checked) || ($('p_method_payflow_advanced') && $('p_method_payflow_advanced').checked)) {
688
- $('onestepcheckout-place-order-loading').show();
689
- $('onestepcheckout-button-place-order').removeClassName('onestepcheckout-btn-checkout');
690
- $('onestepcheckout-button-place-order').addClassName('place-order-loader');
691
- $('ajaxcart-load-ajax').show();
692
- checkAjax('<?php echo $this->getUrl('onestepcheckout/index/saveOrderPro', array('_secure' => true)); ?>');
693
- } else {
694
- if (checkpayment()) {
695
- element.disabled = true;
696
- var already_placing_order = true;
697
- disable_payment();
698
- $('onestepcheckout-place-order-loading').show();
699
- $('onestepcheckout-button-place-order').removeClassName('onestepcheckout-btn-checkout');
700
- $('onestepcheckout-button-place-order').addClassName('place-order-loader');
701
- //$('one-step-checkout-form').submit();
702
- var options = document.getElementsByName('payment[method]');
703
- for (var i = 0; i < options.length; i++) {
704
- if ($(options[i].id).checked) {
705
- if (options[i].id.indexOf("tco") != -1) {
706
- var params = Form.serialize('one-step-checkout-form');
707
- var request = new Ajax.Request(
708
- '<?php echo $this->getCheckoutUrl() . 'isAjax/tco'; ?>',
709
- {
710
- method: 'post',
711
- onComplete: this.onComplete,
712
- onSuccess: function(transport) {
713
- if (transport.status == 200) {
714
- if (transport.responseText.isJSON) {
715
- var response = JSON.parse(transport.responseText);
716
- $('onestepcheckout-place-order-loading').style.display = 'none';
717
- $('checkout-' + response.update_section.name + '-load').update(response.update_section.html);
718
- $('onestepcheckout-button-place-order').removeAttribute('onclick');
719
- $('onestepcheckout-button-place-order').observe('click', formsubmit());
720
- $('onestepcheckout-button-place-order').disabled = false;
721
- }
722
- }
723
- },
724
- onFailure: '', //checkout.ajaxFailure.bind(checkout),
725
- parameters: params
726
- });
727
- } else if (options[i].id.indexOf("wirecard") != -1) {
728
- var params = Form.serialize('one-step-checkout-form');
729
- var request = new Ajax.Request(
730
- '<?php echo $this->getCheckoutUrl() . 'isAjax/wirecard'; ?>',
731
- {
732
- method: 'post',
733
- onComplete: this.onComplete,
734
- onSuccess: function(transport) {
735
- var response = JSON.parse(transport.responseText);
736
- if (response.url) {
737
- window.location.href = response.url;
738
- } else {
739
- var payment_method = $RF(form, 'payment[method]');
740
- var wireparams = {'paymentMethod': payment_method};
741
- url = '<?php echo Mage::getBaseUrl() . 'wirecard_checkout_page/processing/wirecard_checkout_pagecheckout/'; ?>';
742
- var wirerequest = new Ajax.Request(
743
- qmoreIsIframe,
744
- {
745
- method: 'get',
746
- parameters: wireparams,
747
- onSuccess: function(innerTransport) {
748
- if (innerTransport && innerTransport.responseText) {
749
- try {
750
- var innerResponse = eval('(' + innerTransport.responseText + ')');
751
- }
752
- catch (e) {
753
- innerResponse = {};
754
- }
755
- if (innerResponse.isIframe)
756
- {
757
- toggleQMoreIFrame();
758
- $('qmore-iframe').src = url;
759
- } else {
760
- window.location.href = url;
761
- }
762
- }
763
- },
764
- onFailure: ''
765
- });
766
- }
767
- },
768
- onFailure: '', //checkout.ajaxFailure.bind(checkout),
769
- parameters: params
770
- });
771
- } else {
772
- if(isUseAmazon() == false){
773
- $('one-step-checkout-form').submit();
774
- }
775
- else{
776
- <?php
777
- if(Mage::helper('core')->isModuleEnabled('Amazon_Payments')){
778
- $helperAmz = new Amazon_Payments_Helper_Data();
779
- if(isset($helperAmz))
780
- $checkoutUrl = $helperAmz->getCheckoutUrl(false);
781
- }
782
- ?>
783
- window.location.href = "<?php if(isset($checkoutUrl)) echo $checkoutUrl;?>";
784
- }
785
- }
786
- break;
787
- }
788
- }
789
- }
790
- }
791
- }
792
- }
793
- function checkAjax(url) {
794
- var form = $('one-step-checkout-form');
795
- var payment_method = $RF(form, 'payment[method]');
796
- var shipping_method = $RF(form, 'shipping_method');
797
- var parameters = {
798
- payment: payment_method,
799
- shipping_method: shipping_method
800
- }
801
- get_billing_data(parameters);
802
- get_shipping_data(parameters);
803
-
804
- if ($('giftmessage-type') && $('giftmessage-type').value != '') {
805
- parameters[$('giftmessage-type').name] = $('giftmessage-type').value;
806
- }
807
- if ($('create_account_checkbox_id') && $('create_account_checkbox_id').checked) {
808
- parameters['create_account_checkbox'] = 1;
809
- }
810
- if ($('gift-message-whole-from') && $('gift-message-whole-from').value != '') {
811
- parameters[$('gift-message-whole-from').name] = $('gift-message-whole-from').value;
812
- }
813
- if ($('gift-message-whole-to') && $('gift-message-whole-to').value != '') {
814
- parameters[$('gift-message-whole-to').name] = $('gift-message-whole-to').value;
815
- }
816
- if ($('gift-message-whole-message') && $('gift-message-whole-message').value != '') {
817
- parameters[$('gift-message-whole-message').name] = $('gift-message-whole-message').value;
818
- }
819
- if ($('billing-address-select') && $('billing-address-select').value != '') {
820
- parameters[$('billing-address-select').name] = $('billing-address-select').value;
821
- }
822
- if ($('shipping-address-select') && $('shipping-address-select').value != '') {
823
- parameters[$('shipping-address-select').name] = $('shipping-address-select').value;
824
- }
825
-
826
- new Ajax.Request(url, {
827
- method: 'post',
828
- evalJS: 'force',
829
- onSuccess: function(transport) {
830
- // alert(JSON.parse(transport.responseText).url);
831
- if (JSON.parse(transport.responseText).url == 'null' || JSON.parse(transport.responseText).url == null) {
832
- $('ajaxcart-loading').style.display = 'block';
833
- $('ajaxcart-loading').style.top = '15%';
834
- $('ajaxcart-loading').style.left = '40%';
835
- $('ajaxcart-loading').style.width = '551px';
836
- $('ajaxcart-loading').style.height = '400px';
837
- $('ajaxcart-loading').style.overflow = 'hidden';
838
- $('ajaxcart-loading').style.padding = '5px';
839
- $('ajaxcart-loading').innerHTML = JSON.parse(transport.responseText).html;
840
- $('iframe-warning').style.textAlign = 'left';
841
- }
842
- else
843
- {
844
- window.location.href = JSON.parse(transport.responseText).url;
845
- }
846
- },
847
- onFailure: function(transport) {
848
- },
849
- parameters: parameters
850
- });
851
- }
852
-
853
- <?php //if ($this->isCustomerLoggedIn()): ?>
854
- //var save_address_url = '<?php echo $this->getUrl('onestepcheckout/index/saveAddressOnestepcheckout', array('_secure' => true)) ?>';
855
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
856
- <?php //endif; ?>
857
-
858
- //]]>
859
- </script>
860
-
861
- <div id="onestepcheckout_popup_overlay" style="display: none;">&nbsp;</div>
862
- <div id="loading-process" style="display: none;"></div>
863
- <?php echo $this->getChildHtml('tco_iframe'); ?>
864
-
865
- <div id="notify-email-invalid" style="display:none;">
866
- <p style="float:left;padding-top:27px;color:#000;font-family:tahoma;margin-left:10px;"><span style="display:block;float:left;margin-right:2px;"><?php echo $this->__('Email is ') ?></span><img style="float:left;margin-right:2px;"src="<?php echo $this->getSkinUrl('images/onestepcheckout/invalidIcon.jpg'); ?>"/><?php echo $this->__(' please check it again!') ?></p>
867
- </div>
868
- <div id="notify-email-invalid-overlay" style="display:none;"></div>
869
- <!-- Terms and conditions -->
870
- <?php $_helper = Mage::helper('onestepcheckout'); ?>
871
- <?php $width = $_helper->getTermPopupWidth() ? $_helper->getTermPopupWidth() : 482; ?>
872
- <?php $height = $_helper->getTermPopupHeight() ? $_helper->getTermPopupHeight() : 530; ?>
873
-
874
- <?php if ($_helper->enableTermsAndConditions()): ?>
875
-
876
- <div style="margin-top:10px;float:left;">
877
- <a rel="nofollow" target="_blank" href="http://www.abserve.com">
878
- <img src="<?php echo Mage::getBaseUrl('skin') ?>frontend/default/default/css/abserve/trademark.png">
879
- </a>
880
- </div>
881
- <script>
882
- //<![CDATA[
883
- Event.observe(window, 'load', function() {
884
-
885
- var termsPopup = new Control.Modal($('onestepcheckout-toc-popup'), {
886
- overlayOpacity: 0.65,
887
- fade: true,
888
- fadeDuration: 0.3
889
- });
890
-
891
- $('onestepcheckout-toc-link').observe('click', function(e) {
892
- e.preventDefault();
893
- termsPopup.open();
894
- var controlOverlay = $('control_overlay');
895
- controlOverlay.style.opacity = 0.65;
896
- });
897
-
898
- $$('div#onestepcheckout-toc-popup p.close a').invoke('observe', 'click', function(e) {
899
- e.preventDefault();
900
- termsPopup.close();
901
- });
902
-
903
- });
904
- //]]>
905
- </script>
906
- <?php endif; ?>
907
- <?php if (Mage::getStoreConfig('onestepcheckout/general/suggest_address', Mage::app()->getStore()->getStoreId())): ?>
908
- <script type="text/javascript">
909
- function fillAddress(type, street, city, region_id, region, country, postal_code, sublocality) {
910
- if (street) {
911
- document.getElementById(type + ':street1').value = street;
912
- } else {
913
- document.getElementById(type + ':street1').value = '';
914
- }
915
- if (sublocality){
916
- document.getElementById(type + ':street2').value = sublocality;
917
- }else{
918
- document.getElementById(type + ':street2').value = '';
919
- }
920
- if (city){
921
- document.getElementById(type + ':city').value = city;
922
- }else{
923
- document.getElementById(type + ':city').value = '';
924
- }
925
- if (country)
926
- document.getElementById(type + ':country_id').value = country;
927
- if (type == 'billing')
928
- billingRegionUpdater.update();
929
- if (type == 'shipping')
930
- shippingRegionUpdater.update();
931
-
932
- var params = {country: country, region_id: region_id};
933
- var request = new Ajax.Request(
934
- '<?php echo $this->getUrl('onestepcheckout/index/getreionid'); ?>',
935
- {
936
- method: 'post',
937
- onSuccess: function(transport) {
938
- if (transport.status == 200) {
939
- var id = JSON.parse(transport.responseText).id;
940
- if (region_id){
941
- document.getElementById(type + ':region_id').value = id;
942
- }else{
943
- document.getElementById(type + ':region_id').value = '';
944
- }
945
- if (street) {
946
- document.getElementById(type + ':street1').value = street;
947
- } else {
948
- //document.getElementById(type + ':street1').value = '';
949
- }
950
- }
951
- },
952
- onFailure: '',
953
- parameters: params
954
- });
955
-
956
- if (region){
957
- document.getElementById(type + ':region').value = region;
958
- }else{
959
- document.getElementById(type + ':region').value = '';
960
- }
961
- if (postal_code){
962
- document.getElementById(type + ':postcode').value = postal_code;
963
- }else{
964
- document.getElementById(type + ':postcode').value = '';
965
- }
966
-
967
- setTimeout(function(){
968
- save_address_information(save_address_url, update_address_shipping, update_address_payment, update_address_review);
969
- },1000);
970
- }
971
- </script>
972
- <?php endif; ?>
973
- <script type="text/javascript">
974
- var invalidEmailPopup = new Control.Modal($('notify-email-invalid'), {
975
- overlayOpacity: 0.65,
976
- fade: true,
977
- fadeDuration: 0.3
978
- });
979
-
980
- function check_valid_email(transport) {
981
- var response = getResponseText(transport);
982
- var message = response.message;
983
- if (message == 'valid') {
984
- $('email-error-message').update('');
985
- $('valid_email_address_image').show();
986
- $('onestepcheckout-button-place-order').disabled = false;
987
- $('onestepcheckout-button-place-order').addClassName('onestepcheckout-btn-checkout');
988
- $('onestepcheckout-button-place-order').removeClassName('place-order-loader');
989
- if($('emailvalid'))
990
- $('emailvalid').value = 'valid';
991
- invalidEmailPopup.close();
992
-
993
- }
994
- else if (message == 'invalid') {
995
- $('valid_email_address_image').hide();
996
- $('email-error-message').update('<?php echo $this->__('<p>Invalid Email Address</p>') ?>');
997
- $('onestepcheckout-button-place-order').disabled = true;
998
- $('onestepcheckout-button-place-order').removeClassName('onestepcheckout-btn-checkout');
999
- $('onestepcheckout-button-place-order').addClassName('place-order-loader');
1000
- if($('emailvalid'))
1001
- $('emailvalid').value = 'invalid';
1002
- invalidEmailPopup.open();
1003
-
1004
- }
1005
- else if (message == 'exists') {
1006
- if($('emailvalid'))
1007
- $('emailvalid').value = 'valid';
1008
- $('valid_email_address_image').hide();
1009
- if (show_login_link)
1010
- $('email-error-message').update('<?php echo $this->__('<p>Email address already registered. You may <a href="" onclick="login_popup.show(); return false;">login</a> if you wish to do so </p>') ?>');
1011
- else {
1012
- $('email-error-message').update('<?php echo $this->__('<p>Email address already registered. Please use another email address.</p>') ?>');
1013
- }
1014
- }
1015
- }
1016
-
1017
- </script>
1018
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/template/onestepcheckout/onestepcheckout/billing.backup-Justin.phtml DELETED
@@ -1,336 +0,0 @@
1
- <?php
2
- /**
3
- * @category Abserve
4
- * @package Abserve_Module
5
- * @author Abserve Developer
6
- * @license http://abservetech.com/license-agreement/
7
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
8
- */
9
- ?>
10
- <h3 id="billing_step_header" class="step_1"><?php echo($this->__("BILLING ADDRESS")); ?></h3>
11
- <?php if ($this->customerHasAddresses()): ?>
12
- <p><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></p>
13
- <ul>
14
- <li>
15
- <p><?php echo $this->getAddressesHtmlSelect('billing') ?></p>
16
- </li>
17
- </ul>
18
- <?php endif; ?>
19
- <fieldset class="group-select" id="billing-new-address-form" <?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
20
- <input type="hidden" name="billing[address_id]" value="<?php echo $this->getBillingAddress()->getId() ?>" id="billing:address_id" />
21
- <ul>
22
- <?php $helper = Mage::helper('onestepcheckout') ?>
23
- <?php $fieldValue = $helper->getFieldValue() ?>
24
- <?php $checkCountry = 0 ?>
25
- <?php $checkRegion = 0 ?>
26
- <?php for($i=0;$i<20;$i++): ?>
27
- <?php if($helper->getFieldEnable($i)=='country') $checkCountry = 1 ?>
28
- <?php if($helper->getFieldEnable($i)=='region') $checkRegion = 1 ?>
29
- <?php if(Mage::getSingleton('customer/session')->isLoggedIn() && $helper->getFieldEnable($i)=='email') continue; ?>
30
- <?php if(!$helper->getFieldEnable($i)||$helper->getFieldEnable($i)=='0') continue; ?>
31
- <?php if(($i%2==0) || (($i%2!=0)&&(!$helper->getFieldEnable($i-1)||$helper->getFieldEnable($i-1)=='0'||(Mage::getSingleton('customer/session')->isLoggedIn() && $helper->getFieldEnable($i-1)=='email')))): ?>
32
- <li>
33
- <?php endif ?>
34
- <?php if((($i%2==0) && ($helper->getFieldEnable($i)&&$helper->getFieldEnable($i)!='0') && (!$helper->getFieldEnable($i+1)||$helper->getFieldEnable($i+1)=='0'||(Mage::getSingleton('customer/session')->isLoggedIn() && $helper->getFieldEnable($i+1)=='email')))
35
- || (($i%2!=0) && ($helper->getFieldEnable($i)&&$helper->getFieldEnable($i)!='0') && (!$helper->getFieldEnable($i-1) || $helper->getFieldEnable($i-1)=='0'||(Mage::getSingleton('customer/session')->isLoggedIn() && $helper->getFieldEnable($i-1)=='email')))): ?>
36
- <div class="one-field">
37
- <?php else: ?>
38
- <div class="two-fields">
39
- <?php endif ?>
40
- <?php if(!$helper->getFieldEnable($i)||$helper->getFieldEnable($i)=='0') continue; ?>
41
- <?php if($helper->getFieldEnable($i)=='street'): ?>
42
- <label for="billing:street1"><?php echo $this->__('Address') ?>
43
- <?php if($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
44
- <span class="required">*</span>
45
- <?php endif ?>
46
- </label><br />
47
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
48
- <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
49
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address '.$_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
50
- <?php endfor ?>
51
- <?php elseif($helper->getFieldEnable($i)=='country'): ?>
52
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
53
- <?php if($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
54
- <span class="required">*</span>
55
- <?php endif ?>
56
- </label><br />
57
- <?php echo $this->getCountryHtmlSelect('billing') ?>
58
- <?php if(!$helper->getFieldRequire($helper->getFieldEnable($i))): ?>
59
- <script type="text/javascript">
60
- if($('billing:country_id'))
61
- $('billing:country_id').removeClassName('validate-select');
62
- </script>
63
- <?php endif ?>
64
- <?php elseif($helper->getFieldEnable($i)=='region'): ?>
65
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
66
- <?php if($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
67
- <span class="required">*</span>
68
- <?php endif ?>
69
- </label><br/>
70
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if($helper->getFieldRequire($helper->getFieldEnable($i))) echo "validate-select"; ?>" style="display:none;width:135px;" >
71
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
72
- </select>
73
- <?php if(!$helper->enableGeoip()):?>
74
- <script type="text/javascript">
75
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
76
- </script>
77
- <?php endif;?>
78
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text" style="display:none" />
79
- <?php if(!$helper->getFieldRequire($helper->getFieldEnable($i))): ?>
80
- <script type="text/javascript">
81
- if($('billing:region_id'))
82
- $('billing:region_id').removeClassName('validate-select');
83
- </script>
84
- <?php endif ?>
85
- <?php elseif($helper->getFieldEnable($i)=='prefix'): ?>
86
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
87
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
88
- <?php if($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
89
- <span class="required">*</span>
90
- <?php endif ?>
91
- </label><br />
92
- <?php if ($customerNameBlock->getPrefixOptions()===false): ?>
93
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix')?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix')?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if($helper->getFieldRequire($helper->getFieldEnable($i))) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
94
- <?php else: ?>
95
- <select id="<?php echo $customerNameBlock->getFieldId('prefix')?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix')?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if($helper->getFieldRequire($helper->getFieldEnable($i))) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
96
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
97
- <option value="<?php echo $_option?>"><?php echo $this->__($_option)?></option>
98
- <?php endforeach ?>
99
- </select>
100
- <?php endif; ?>
101
- <?php elseif($helper->getFieldEnable($i)=='suffix'): ?>
102
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
103
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
104
- <?php if($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
105
- <span class="required">*</span>
106
- <?php endif ?>
107
- </label><br />
108
- <?php if ($customerNameBlock->getSuffixOptions()===false): ?>
109
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix')?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix')?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if($helper->getFieldRequire($helper->getFieldEnable($i))) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
110
- <?php else: ?>
111
- <select id="<?php echo $customerNameBlock->getFieldId('suffix')?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix')?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if($helper->getFieldRequire($helper->getFieldEnable($i))) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
112
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
113
- <option value="<?php echo $_option?>"><?php echo $this->__($_option)?></option>
114
- <?php endforeach ?>
115
- </select>
116
- <?php endif; ?>
117
- <?php elseif($helper->getFieldEnable($i)=='birthday'): ?>
118
- <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
119
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
120
- <?php elseif($helper->getFieldEnable($i)=='gender'): ?>
121
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
122
- <label for="<?php echo $_gender->getFieldId('gender')?>"><?php echo $this->__('Gender') ?>
123
- <?php if($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
124
- <span class="required">*</span>
125
- <?php endif ?>
126
- </label><br />
127
- <select id="<?php echo $_gender->getFieldId('gender')?>" name="billing[<?php echo $_gender->getFieldName('gender')?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if($helper->getFieldRequire($helper->getFieldEnable($i))) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
128
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions();?>
129
- <?php $value = $_gender->getGender();?>
130
- <?php foreach ($options as $option):?>
131
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
132
- <?php endforeach;?>
133
- </select>
134
- <?php else: ?>
135
- <label for="billing:<?php echo $helper->getFieldEnable($i); ?>"><?php echo $this->__($fieldValue[$helper->getFieldEnable($i)]) ?>
136
- <?php if($helper->getFieldRequire($helper->getFieldEnable($i)) || $helper->getFieldEnable($i)=='firstname'||$helper->getFieldEnable($i)=='lastname'|| $helper->getFieldEnable($i)=='email'): ?>
137
- <span class="required">*</span>
138
- <?php endif ?>
139
- </label><br/>
140
- <input type="text" id="billing:<?php echo $helper->getFieldEnable($i); ?>" name="billing[<?php echo $helper->getFieldEnable($i); ?>]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getData($helper->getFieldEnable($i))) ?>" title="<?php echo $this->__($fieldValue[$helper->getFieldEnable($i)]) ?>" class="input-text <?php if($helper->getFieldRequire($helper->getFieldEnable($i))||$helper->getFieldEnable($i)=='firstname'||$helper->getFieldEnable($i)=='lastname'||$helper->getFieldEnable($i)=='email') echo 'required-entry'; ?>" />
141
- <?php if($helper->enableGeoip()):?>
142
- <?php if(($helper->getFieldEnable($i) == 'postcode') && $helper->allowDetectByPostcode()): ?>
143
- <span id="billing_<?php echo $helper->getFieldEnable($i)?>_autocomplete_indicator" class="autocomplete-indicator" style="display:none;">
144
- <img class="v-middle" alt="Loading..." src="<?php echo $this->getSkinUrl('images/geoip/indicator.gif')?>">
145
- </span>
146
- <div id="billing:<?php echo $helper->getFieldEnable($i).'_autocomplete';?>" class="autocomplete" style="display:none; position:absolute; background-color:#FFFFFF; max-height:230px; overflow:auto; border:1px solid #B6B6B6"></div>
147
- <?php endif;?>
148
- <?php if(($helper->getFieldEnable($i) == 'city') && $helper->allowDetectByCity()): ?>
149
- <span id="billing_<?php echo $helper->getFieldEnable($i)?>_autocomplete_indicator" class="autocomplete-indicator" style="display:none;">
150
- <img class="v-middle" alt="Loading..." src="<?php echo $this->getSkinUrl('images/geoip/indicator.gif')?>">
151
- </span>
152
- <div id="billing:<?php echo $helper->getFieldEnable($i).'_autocomplete';?>" class="autocomplete" style="display:none; position:absolute; background-color:#FFFFFF; max-height:230px; overflow:auto; border:1px solid #B6B6B6"></div>
153
- <?php endif;?>
154
- <?php endif;?>
155
- <?php if($helper->getFieldEnable($i)=='email'): ?>
156
- <span id="valid_email_address_image" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/onestepcheckout/valid.gif')?>" title="<?php echo $this->__('Valid Email Address');?>" alt="<?php echo $this->__('Valid Email Address');?>" width="18"/></span>
157
- <div id="email-error-message" class="error-message"></div>
158
- <?php endif ?>
159
- <?php endif ?>
160
- </div>
161
- <?php if(($i%2!=0)||(($i%2==0)&&(!$helper->getFieldEnable($i+1)||$helper->getFieldEnable($i+1)=='0'||(Mage::getSingleton('customer/session')->isLoggedIn() && $helper->getFieldEnable($i+1)=='email')))): ?>
162
- </li>
163
- <?php endif ?>
164
- <?php endfor ?>
165
- <?php if($checkCountry==0): ?>
166
- <div style="display:none;">
167
- <?php echo $this->getCountryHtmlSelect('billing') ?>
168
- </div>
169
- <?php endif ?>
170
- <?php if (!$this->isCustomerLoggedIn() && Mage::helper('onestepcheckout')->enableRegistration() && Mage::helper('onestepcheckout')->allowGuestCheckout()):?>
171
- <li>
172
- <div>
173
- <input id="create_account_checkbox_id" type="checkbox" name="create_account_checkbox" value="1" />
174
- <label for="create_account_checkbox_id"><?php echo $this->__('Create an account for later use') ?></label>
175
- </div>
176
- </li>
177
- <script type="text/javascript">
178
- Event.observe('create_account_checkbox_id', 'click', function() {
179
- if ($('create_account_checkbox_id').checked)
180
- $('password_section_id').show();
181
- else
182
- $('password_section_id').hide();
183
- });
184
- </script>
185
- <?php endif;?>
186
- <?php if (!$this->isCustomerLoggedIn() && (Mage::helper('onestepcheckout')->enableRegistration() || !Mage::helper('onestepcheckout')->allowGuestCheckout())):?>
187
- <li id="password_section_id" <?php if (!Mage::helper('onestepcheckout')->allowGuestCheckout()):?>style="display:block"<?php else:?>style="display:none"<?php endif?>>
188
- <div class="two-fields">
189
- <label for="billing:customer_password"><?php echo $this->__('Password') ?> <span class="required">*</span></label><br/>
190
- <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
191
- </div>
192
- <div class="two-fields">
193
- <label for="billing:confirm_password"><?php echo $this->__('Confirm Password') ?> <span class="required">*</span></label><br/>
194
- <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
195
- </div>
196
- </li>
197
- <?php endif?>
198
- <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
199
- <li class="control">
200
- <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->getBillingAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
201
- </li>
202
- <?php else:?>
203
- <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
204
- <?php endif;?>
205
- <li>
206
- <input type="hidden" name="billing[use_for_shipping]" id="billing:use_for_shipping" value="1" />
207
- </li>
208
- </ul>
209
- </fieldset>
210
- <script type="text/javascript">var countryRegions = <?php echo $this->helper('directory')->getRegionJson() ?></script>
211
- <script type="text/javascript">
212
- //<![CDATA[
213
- <?php if($checkRegion == 1): ?>
214
- var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions);
215
- <?php endif ?>
216
- <?php if(!$helper->getFieldRequire('region')): ?>
217
- if($('billing:region_id')){
218
- $('billing:region_id').removeClassName('validate-select');
219
- $('billing:region_id').removeClassName('required-entry');
220
- }
221
- <?php endif ?>
222
- if ($('billing:email')) {
223
- Event.observe('billing:email', 'blur', function() {
224
- var url = '<?php echo $this->getUrl('onestepcheckout/index/is_valid_email', array('_secure'=>true))?>';
225
- var email_address = $('billing:email').value;
226
- var parameters = {email_address: email_address};
227
- var request = new Ajax.Request(
228
- url,
229
- {
230
- parameters: parameters,
231
- onComplete: check_valid_email.bindAsEventListener(this),
232
- onFailure: ''
233
- });
234
- });
235
- }
236
- if ($('billing-address-select')) {
237
- Event.observe('billing-address-select', 'change', function() {
238
- var isNew = $('billing-address-select').value ? false : true;
239
- setNewAddress(isNew, 'billing', save_address_url);
240
- });
241
- }
242
- //]]>
243
- </script>
244
-
245
- <?php if($helper->enableGeoip()):?>
246
- <script type="text/javascript">
247
- /*
248
- Show list postcode billing
249
- */
250
- <?php if($helper->allowDetectByPostcode()):?>
251
- new Ajax.Autocompleter(
252
- 'billing:postcode',
253
- 'billing:postcode_autocomplete',
254
- '<?php echo $this->getUrl('onestepcheckout/geoip/checkPostcode')?>',
255
- {
256
- paramName:'postcode',
257
- minChars:<?php echo $helper->getMinCharsPostcode()?>,
258
- indicator: 'billing_postcode_autocomplete_indicator',
259
- updateElement:fillFilterBilling,
260
- evalJSON:'force'
261
- }
262
- );
263
- <?php endif;?>
264
-
265
- /*
266
- Show list city billing
267
- */
268
- <?php if($helper->allowDetectByCity()):?>
269
- new Ajax.Autocompleter(
270
- 'billing:city',
271
- 'billing:city_autocomplete',
272
- '<?php echo $this->getUrl('onestepcheckout/geoip/checkCity')?>',
273
- {
274
- paramName:'city',
275
- minChars:<?php echo $helper->getMinCharsCity()?>,
276
- indicator: 'billing_city_autocomplete_indicator',
277
- updateElement:fillFilterBilling,
278
- evalJSON:'force'
279
- }
280
- );
281
- <?php endif;?>
282
-
283
- function fillFilterBilling(li)
284
- {
285
- var country = li.getAttribute('country');
286
- var region = li.getAttribute('region');
287
- var region_id = li.getAttribute('region_id');
288
- var city = li.getAttribute('city');
289
- var postcode = li.getAttribute('postcode');
290
- if(city != '') {
291
- if ($('billing:postcode')) {
292
- $('billing:postcode').value = postcode;
293
- }
294
- }
295
- if(country != '') {
296
- if ($('billing:country_id')) {
297
- $('billing:country_id').value = country;
298
- }
299
- }
300
- if(region != '') {
301
- if ($('billing:region')) {
302
- $('billing:region').value = region;
303
- }
304
- }
305
-
306
- if(region_id != '') {
307
- if ($('billing:region_id')) {
308
- $('billing:region_id').value = region_id;
309
- }
310
- }
311
-
312
- if(city != '') {
313
- if ($('billing:city')) {
314
- $('billing:city').value = city;
315
- }
316
- }
317
-
318
- updateBillingRegion();
319
-
320
- }
321
-
322
- function updateBillingRegion() {
323
- var countryEl = $('billing:country_id');
324
- var regionTextEl = $('billing:region');
325
- var regionSelectEl = $('billing:region_id');
326
- var regions = <?php echo $this->helper('directory')->getRegionJson() ?>;
327
- var config = regions['config'];
328
- delete regions.config;
329
- var regions = regions;
330
- var zipEl = $(zipEl);
331
- disableAction = (typeof disableAction=='undefined') ? 'hide' : disableAction;
332
-
333
- updateRegion(countryEl, regionTextEl, regionSelectEl, regions, disableAction, zipEl);
334
- }
335
- </script>
336
- <?php endif;?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/template/onestepcheckout/onestepcheckout/billing.backup_19_05.phtml DELETED
@@ -1,4453 +0,0 @@
1
- <?php
2
- /**
3
- * @category Abserve
4
- * @package Abserve_Module
5
- * @author Abserve Developer
6
- * @license http://abservetech.com/license-agreement/
7
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
8
- */
9
- ?>
10
- <h3 id="billing_step_header" class="step_1"><?php echo($this->__("BILLING ADDRESS")); ?></h3>
11
- <?php if ($this->customerHasAddresses()): ?>
12
- <p><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></p>
13
- <ul>
14
- <li>
15
- <p><?php echo $this->getAddressesHtmlSelect('billing') ?></p>
16
- </li>
17
- </ul>
18
- <?php endif; ?>
19
- <fieldset class="group-select" id="billing-new-address-form" <?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
20
- <input type="hidden" name="billing[address_id]" value="<?php echo $this->getBillingAddress()->getId() ?>" id="billing:address_id" />
21
- <ul>
22
- <?php $helper = Mage::helper('onestepcheckout') ?>
23
- <?php $fieldValue = $helper->getFieldValue() ?>
24
- <?php $checkCountry = 0 ?>
25
-
26
- <?php $fields = $helper->getFieldEnables(); ?>
27
- <!-- billing form data -->
28
-
29
- <li>
30
- <?php if ($fields[0]['value'] != '0' || $fields[1]['value'] != '0'): ?>
31
- <?php if ($fields[0]['value'] == '0' || $fields[1]['value'] == '0'): ?>
32
- <div class="one-field">
33
- <div class="one-field">
34
- <?php if ($fields[0]['value'] != '0'): ?>
35
- <!--begin-->
36
- <?php if ($fields[0]['value'] == 'street'): ?>
37
- <label for="billing:street1"><?php echo $this->__('Address') ?>
38
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
39
- <span class="required">*</span>
40
- <?php endif ?>
41
- </label><br />
42
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo 'required-entry'; ?> input-text"/>
43
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
44
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
45
- <?php endfor ?>
46
- <?php elseif ($fields[0]['value'] == 'country'): ?>
47
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
48
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
49
- <span class="required">*</span>
50
- <?php endif ?>
51
- </label><br />
52
- <?php echo $this->getCountryHtmlSelect('billing') ?>
53
- <?php if (!$helper->getFieldRequire($fields[0]['value'])): ?>
54
- <script type="text/javascript">
55
- if ($('billing:country_id'))
56
- $('billing:country_id').removeClassName('validate-select');
57
- </script>
58
- <?php endif ?>
59
- <?php elseif ($fields[0]['value'] == 'region'): ?>
60
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
61
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
62
- <span class="required">*</span>
63
- <?php endif ?>
64
- </label><br/>
65
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
66
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
67
- </select>
68
- <?php if (!$helper->enableGeoip()): ?>
69
- <script type="text/javascript">
70
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
71
- </script>
72
- <?php endif; ?>
73
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
74
- <?php if (!$helper->getFieldRequire($fields[0]['value'])): ?>
75
- <script type="text/javascript">
76
- if ($('billing:region_id'))
77
- $('billing:region_id').removeClassName('validate-select');
78
- </script>
79
- <?php endif ?>
80
- <?php elseif ($fields[0]['value'] == 'prefix'): ?>
81
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
82
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
83
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
84
- <span class="required">*</span>
85
- <?php endif ?>
86
- </label><br />
87
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
88
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[0]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
89
- <?php else: ?>
90
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
91
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
92
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
93
- <?php endforeach ?>
94
- </select>
95
- <?php endif; ?>
96
- <?php elseif ($fields[0]['value'] == 'suffix'): ?>
97
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
98
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
99
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
100
- <span class="required">*</span>
101
- <?php endif ?>
102
- </label><br />
103
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
104
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[0]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
105
- <?php else: ?>
106
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
107
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
108
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
109
- <?php endforeach ?>
110
- </select>
111
- <?php endif; ?>
112
- <?php elseif ($fields[0]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
113
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
114
- <?php elseif ($fields[0]['value'] == 'gender'): ?>
115
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
116
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
117
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
118
- <span class="required">*</span>
119
- <?php endif ?>
120
- </label><br />
121
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
122
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
123
- <?php $value = $_gender->getGender(); ?>
124
- <?php foreach ($options as $option): ?>
125
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
126
- <?php endforeach; ?>
127
- </select>
128
- <?php else: ?>
129
- <label for="billing:<?php echo $fields[0]['value'] ?>"><?php echo $helper->getFieldLabel($fields[0]['value']); ?>
130
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
131
- <span class="required">*</span>
132
- <?php endif; ?>
133
- </label><br>
134
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[0]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[0]['value']); ?>" value="" name="billing[<?php echo $fields[0]['value'] ?>]" id="billing:<?php echo $fields[0]['value'] ?>">
135
- <?php endif ?>
136
- <!-- end -->
137
- <?php else: ?>
138
- <?php if ($fields[1]['value'] == 'street'): ?>
139
- <label for="billing:street1"><?php echo $this->__('Address') ?>
140
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
141
- <span class="required">*</span>
142
- <?php endif ?>
143
- </label><br />
144
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
145
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
146
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
147
- <?php endfor ?>
148
- <?php elseif ($fields[1]['value'] == 'country'): ?>
149
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
150
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
151
- <span class="required">*</span>
152
- <?php endif ?>
153
- </label><br />
154
- <?php echo $this->getCountryHtmlSelect('billing') ?>
155
- <?php if (!$helper->getFieldRequire($fields[1]['value'])): ?>
156
- <script type="text/javascript">
157
- if ($('billing:country_id'))
158
- $('billing:country_id').removeClassName('validate-select');
159
- </script>
160
- <?php endif ?>
161
- <?php elseif ($fields[1]['value'] == 'region'): ?>
162
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
163
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
164
- <span class="required">*</span>
165
- <?php endif ?>
166
- </label><br/>
167
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
168
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
169
- </select>
170
- <?php if (!$helper->enableGeoip()): ?>
171
- <script type="text/javascript">
172
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
173
- </script>
174
- <?php endif; ?>
175
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
176
- <?php if (!$helper->getFieldRequire($fields[1]['value'])): ?>
177
- <script type="text/javascript">
178
- if ($('billing:region_id'))
179
- $('billing:region_id').removeClassName('validate-select');
180
- </script>
181
- <?php endif ?>
182
- <?php elseif ($fields[1]['value'] == 'prefix'): ?>
183
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
184
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
185
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
186
- <span class="required">*</span>
187
- <?php endif ?>
188
- </label><br />
189
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
190
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[1]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
191
- <?php else: ?>
192
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
193
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
194
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
195
- <?php endforeach ?>
196
- </select>
197
- <?php endif; ?>
198
- <?php elseif ($fields[1]['value'] == 'suffix'): ?>
199
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
200
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
201
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
202
- <span class="required">*</span>
203
- <?php endif ?>
204
- </label><br />
205
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
206
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[1]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
207
- <?php else: ?>
208
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
209
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
210
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
211
- <?php endforeach ?>
212
- </select>
213
- <?php endif; ?>
214
- <?php elseif ($fields[1]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
215
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
216
- <?php elseif ($fields[1]['value'] == 'gender'): ?>
217
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
218
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
219
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
220
- <span class="required">*</span>
221
- <?php endif ?>
222
- </label><br />
223
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
224
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
225
- <?php $value = $_gender->getGender(); ?>
226
- <?php foreach ($options as $option): ?>
227
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
228
- <?php endforeach; ?>
229
- </select>
230
- <?php else: ?>
231
- <label for="billing:<?php echo $fields[1]['value'] ?>"><?php echo $helper->getFieldLabel($fields[1]['value']); ?>
232
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
233
- <span class="required">*</span>
234
- <?php endif; ?>
235
- </label><br>
236
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[1]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[1]['value']); ?>" value="" name="billing[<?php echo $fields[1]['value'] ?>]" id="billing:<?php echo $fields[1]['value'] ?>">
237
- <?php endif; ?>
238
- <?php endif; ?>
239
- </div>
240
- <?php else: ?>
241
- <div class="two-fields">
242
- <?php if ($fields[0]['value'] == 'street'): ?>
243
- <label for="billing:street1"><?php echo $this->__('Address') ?>
244
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
245
- <span class="required">*</span>
246
- <?php endif ?>
247
- </label><br />
248
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
249
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
250
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
251
- <?php endfor ?>
252
- <?php elseif ($fields[0]['value'] == 'country'): ?>
253
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
254
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
255
- <span class="required">*</span>
256
- <?php endif ?>
257
- </label><br />
258
- <?php echo $this->getCountryHtmlSelect('billing') ?>
259
- <?php if (!$helper->getFieldRequire($fields[0]['value'])): ?>
260
- <script type="text/javascript">
261
- if ($('billing:country_id'))
262
- $('billing:country_id').removeClassName('validate-select');
263
- </script>
264
- <?php endif ?>
265
- <?php elseif ($fields[0]['value'] == 'region'): ?>
266
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
267
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
268
- <span class="required">*</span>
269
- <?php endif ?>
270
- </label><br/>
271
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
272
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
273
- </select>
274
- <?php if (!$helper->enableGeoip()): ?>
275
- <script type="text/javascript">
276
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
277
- </script>
278
- <?php endif; ?>
279
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
280
- <?php if (!$helper->getFieldRequire($fields[0]['value'])): ?>
281
- <script type="text/javascript">
282
- if ($('billing:region_id'))
283
- $('billing:region_id').removeClassName('validate-select');
284
- </script>
285
- <?php endif ?>
286
- <?php elseif ($fields[0]['value'] == 'prefix'): ?>
287
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
288
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
289
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
290
- <span class="required">*</span>
291
- <?php endif ?>
292
- </label><br />
293
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
294
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[0]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
295
- <?php else: ?>
296
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
297
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
298
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
299
- <?php endforeach ?>
300
- </select>
301
- <?php endif; ?>
302
- <?php elseif ($fields[0]['value'] == 'suffix'): ?>
303
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
304
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
305
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
306
- <span class="required">*</span>
307
- <?php endif ?>
308
- </label><br />
309
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
310
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[0]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
311
- <?php else: ?>
312
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
313
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
314
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
315
- <?php endforeach ?>
316
- </select>
317
- <?php endif; ?>
318
- <?php elseif ($fields[0]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
319
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
320
- <?php elseif ($fields[0]['value'] == 'gender'): ?>
321
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
322
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
323
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
324
- <span class="required">*</span>
325
- <?php endif ?>
326
- </label><br />
327
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[0]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
328
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
329
- <?php $value = $_gender->getGender(); ?>
330
- <?php foreach ($options as $option): ?>
331
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
332
- <?php endforeach; ?>
333
- </select>
334
- <?php else: ?>
335
- <label for="billing:<?php echo $fields[0]['value'] ?>"><?php echo $helper->getFieldLabel($fields[0]['value']); ?>
336
- <?php if ($helper->getFieldRequire($fields[0]['value'])): ?>
337
- <span class="required">*</span>
338
- <?php endif; ?>
339
- </label><br>
340
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[0]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[0]['value']); ?>" value="" name="billing[<?php echo $fields[0]['value'] ?>]" id="billing:<?php echo $fields[0]['value'] ?>">
341
- <?php endif; ?>
342
- </div>
343
- <div class="two-fields">
344
- <?php if ($fields[1]['value'] == 'street'): ?>
345
- <label for="billing:street1"><?php echo $this->__('Address') ?>
346
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
347
- <span class="required">*</span>
348
- <?php endif ?>
349
- </label><br />
350
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
351
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
352
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
353
- <?php endfor ?>
354
- <?php elseif ($fields[1]['value'] == 'country'): ?>
355
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
356
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
357
- <span class="required">*</span>
358
- <?php endif ?>
359
- </label><br />
360
- <?php echo $this->getCountryHtmlSelect('billing') ?>
361
- <?php if (!$helper->getFieldRequire($fields[1]['value'])): ?>
362
- <script type="text/javascript">
363
- if ($('billing:country_id'))
364
- $('billing:country_id').removeClassName('validate-select');
365
- </script>
366
- <?php endif ?>
367
- <?php elseif ($fields[1]['value'] == 'region'): ?>
368
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
369
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
370
- <span class="required">*</span>
371
- <?php endif ?>
372
- </label><br/>
373
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
374
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
375
- </select>
376
- <?php if (!$helper->enableGeoip()): ?>
377
- <script type="text/javascript">
378
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
379
- </script>
380
- <?php endif; ?>
381
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
382
- <?php if (!$helper->getFieldRequire($fields[1]['value'])): ?>
383
- <script type="text/javascript">
384
- if ($('billing:region_id'))
385
- $('billing:region_id').removeClassName('validate-select');
386
- </script>
387
- <?php endif ?>
388
- <?php elseif ($fields[1]['value'] == 'prefix'): ?>
389
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
390
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
391
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
392
- <span class="required">*</span>
393
- <?php endif ?>
394
- </label><br />
395
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
396
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[1]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
397
- <?php else: ?>
398
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
399
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
400
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
401
- <?php endforeach ?>
402
- </select>
403
- <?php endif; ?>
404
- <?php elseif ($fields[1]['value'] == 'suffix'): ?>
405
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
406
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
407
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
408
- <span class="required">*</span>
409
- <?php endif ?>
410
- </label><br />
411
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
412
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[1]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
413
- <?php else: ?>
414
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
415
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
416
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
417
- <?php endforeach ?>
418
- </select>
419
- <?php endif; ?>
420
- <?php elseif ($fields[1]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
421
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
422
- <?php elseif ($fields[1]['value'] == 'gender'): ?>
423
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
424
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
425
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
426
- <span class="required">*</span>
427
- <?php endif ?>
428
- </label><br />
429
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[1]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
430
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
431
- <?php $value = $_gender->getGender(); ?>
432
- <?php foreach ($options as $option): ?>
433
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
434
- <?php endforeach; ?>
435
- </select>
436
- <?php else: ?>
437
- <label for="billing:<?php echo $fields[1]['value'] ?>"><?php echo $helper->getFieldLabel($fields[1]['value']); ?>
438
- <?php if ($helper->getFieldRequire($fields[1]['value'])): ?>
439
- <span class="required">*</span>
440
- <?php endif; ?>
441
- </label><br>
442
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[1]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[1]['value']); ?>" value="" name="billing[<?php echo $fields[1]['value'] ?>]" id="billing:<?php echo $fields[1]['value'] ?>">
443
- <?php endif; ?>
444
- </div>
445
- <?php endif; ?>
446
- <?php endif; ?>
447
- </li>
448
- <li>
449
- <?php if ($fields[2]['value'] != '0' || $fields[3]['value'] != '0'): ?>
450
- <?php if ($fields[2]['value'] == '0' || $fields[3]['value'] == '0'): ?>
451
- <div class="one-field">
452
- <div class="one-field">
453
- <?php if ($fields[2]['value'] != '0'): ?>
454
- <!--begin-->
455
- <?php if ($fields[2]['value'] == 'street'): ?>
456
- <label for="billing:street1"><?php echo $this->__('Address') ?>
457
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
458
- <span class="required">*</span>
459
- <?php endif ?>
460
- </label><br />
461
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo 'required-entry'; ?> input-text"/>
462
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
463
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
464
- <?php endfor ?>
465
- <?php elseif ($fields[2]['value'] == 'country'): ?>
466
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
467
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
468
- <span class="required">*</span>
469
- <?php endif ?>
470
- </label><br />
471
- <?php echo $this->getCountryHtmlSelect('billing') ?>
472
- <?php if (!$helper->getFieldRequire($fields[2]['value'])): ?>
473
- <script type="text/javascript">
474
- if ($('billing:country_id'))
475
- $('billing:country_id').removeClassName('validate-select');
476
- </script>
477
- <?php endif ?>
478
- <?php elseif ($fields[2]['value'] == 'region'): ?>
479
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
480
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
481
- <span class="required">*</span>
482
- <?php endif ?>
483
- </label><br/>
484
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
485
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
486
- </select>
487
- <?php if (!$helper->enableGeoip()): ?>
488
- <script type="text/javascript">
489
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
490
- </script>
491
- <?php endif; ?>
492
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
493
- <?php if (!$helper->getFieldRequire($fields[2]['value'])): ?>
494
- <script type="text/javascript">
495
- if ($('billing:region_id'))
496
- $('billing:region_id').removeClassName('validate-select');
497
- </script>
498
- <?php endif ?>
499
- <?php elseif ($fields[2]['value'] == 'prefix'): ?>
500
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
501
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
502
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
503
- <span class="required">*</span>
504
- <?php endif ?>
505
- </label><br />
506
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
507
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[2]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
508
- <?php else: ?>
509
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
510
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
511
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
512
- <?php endforeach ?>
513
- </select>
514
- <?php endif; ?>
515
- <?php elseif ($fields[2]['value'] == 'suffix'): ?>
516
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
517
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
518
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
519
- <span class="required">*</span>
520
- <?php endif ?>
521
- </label><br />
522
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
523
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[2]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
524
- <?php else: ?>
525
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
526
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
527
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
528
- <?php endforeach ?>
529
- </select>
530
- <?php endif; ?>
531
- <?php elseif ($fields[2]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
532
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
533
- <?php elseif ($fields[2]['value'] == 'gender'): ?>
534
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
535
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
536
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
537
- <span class="required">*</span>
538
- <?php endif ?>
539
- </label><br />
540
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
541
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
542
- <?php $value = $_gender->getGender(); ?>
543
- <?php foreach ($options as $option): ?>
544
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
545
- <?php endforeach; ?>
546
- </select>
547
- <?php else: ?>
548
- <label for="billing:<?php echo $fields[2]['value'] ?>"><?php echo $helper->getFieldLabel($fields[2]['value']); ?>
549
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
550
- <span class="required">*</span>
551
- <?php endif; ?>
552
- </label><br>
553
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[2]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[2]['value']); ?>" value="" name="billing[<?php echo $fields[2]['value'] ?>]" id="billing:<?php echo $fields[2]['value'] ?>">
554
- <?php endif ?>
555
- <!-- end -->
556
- <?php else: ?>
557
- <?php if ($fields[3]['value'] == 'street'): ?>
558
- <label for="billing:street1"><?php echo $this->__('Address') ?>
559
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
560
- <span class="required">*</span>
561
- <?php endif ?>
562
- </label><br />
563
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
564
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
565
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
566
- <?php endfor ?>
567
- <?php elseif ($fields[3]['value'] == 'country'): ?>
568
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
569
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
570
- <span class="required">*</span>
571
- <?php endif ?>
572
- </label><br />
573
- <?php echo $this->getCountryHtmlSelect('billing') ?>
574
- <?php if (!$helper->getFieldRequire($fields[3]['value'])): ?>
575
- <script type="text/javascript">
576
- if ($('billing:country_id'))
577
- $('billing:country_id').removeClassName('validate-select');
578
- </script>
579
- <?php endif ?>
580
- <?php elseif ($fields[3]['value'] == 'region'): ?>
581
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
582
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
583
- <span class="required">*</span>
584
- <?php endif ?>
585
- </label><br/>
586
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
587
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
588
- </select>
589
- <?php if (!$helper->enableGeoip()): ?>
590
- <script type="text/javascript">
591
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
592
- </script>
593
- <?php endif; ?>
594
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
595
- <?php if (!$helper->getFieldRequire($fields[3]['value'])): ?>
596
- <script type="text/javascript">
597
- if ($('billing:region_id'))
598
- $('billing:region_id').removeClassName('validate-select');
599
- </script>
600
- <?php endif ?>
601
- <?php elseif ($fields[3]['value'] == 'prefix'): ?>
602
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
603
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
604
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
605
- <span class="required">*</span>
606
- <?php endif ?>
607
- </label><br />
608
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
609
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[3]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
610
- <?php else: ?>
611
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
612
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
613
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
614
- <?php endforeach ?>
615
- </select>
616
- <?php endif; ?>
617
- <?php elseif ($fields[3]['value'] == 'suffix'): ?>
618
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
619
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
620
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
621
- <span class="required">*</span>
622
- <?php endif ?>
623
- </label><br />
624
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
625
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[3]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
626
- <?php else: ?>
627
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
628
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
629
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
630
- <?php endforeach ?>
631
- </select>
632
- <?php endif; ?>
633
- <?php elseif ($fields[3]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
634
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
635
- <?php elseif ($fields[3]['value'] == 'gender'): ?>
636
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
637
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
638
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
639
- <span class="required">*</span>
640
- <?php endif ?>
641
- </label><br />
642
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
643
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
644
- <?php $value = $_gender->getGender(); ?>
645
- <?php foreach ($options as $option): ?>
646
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
647
- <?php endforeach; ?>
648
- </select>
649
- <?php else: ?>
650
- <label for="billing:<?php echo $fields[3]['value'] ?>"><?php echo $helper->getFieldLabel($fields[3]['value']); ?>
651
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
652
- <span class="required">*</span>
653
- <?php endif; ?>
654
- </label><br>
655
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[3]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[3]['value']); ?>" value="" name="billing[<?php echo $fields[3]['value'] ?>]" id="billing:<?php echo $fields[3]['value'] ?>">
656
- <?php endif; ?>
657
- <?php endif; ?>
658
- </div>
659
- <?php else: ?>
660
- <div class="two-fields">
661
- <?php if ($fields[2]['value'] == 'street'): ?>
662
- <label for="billing:street1"><?php echo $this->__('Address') ?>
663
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
664
- <span class="required">*</span>
665
- <?php endif ?>
666
- </label><br />
667
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
668
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
669
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
670
- <?php endfor ?>
671
- <?php elseif ($fields[2]['value'] == 'country'): ?>
672
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
673
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
674
- <span class="required">*</span>
675
- <?php endif ?>
676
- </label><br />
677
- <?php echo $this->getCountryHtmlSelect('billing') ?>
678
- <?php if (!$helper->getFieldRequire($fields[2]['value'])): ?>
679
- <script type="text/javascript">
680
- if ($('billing:country_id'))
681
- $('billing:country_id').removeClassName('validate-select');
682
- </script>
683
- <?php endif ?>
684
- <?php elseif ($fields[2]['value'] == 'region'): ?>
685
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
686
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
687
- <span class="required">*</span>
688
- <?php endif ?>
689
- </label><br/>
690
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
691
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
692
- </select>
693
- <?php if (!$helper->enableGeoip()): ?>
694
- <script type="text/javascript">
695
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
696
- </script>
697
- <?php endif; ?>
698
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
699
- <?php if (!$helper->getFieldRequire($fields[2]['value'])): ?>
700
- <script type="text/javascript">
701
- if ($('billing:region_id'))
702
- $('billing:region_id').removeClassName('validate-select');
703
- </script>
704
- <?php endif ?>
705
- <?php elseif ($fields[2]['value'] == 'prefix'): ?>
706
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
707
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
708
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
709
- <span class="required">*</span>
710
- <?php endif ?>
711
- </label><br />
712
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
713
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[2]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
714
- <?php else: ?>
715
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
716
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
717
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
718
- <?php endforeach ?>
719
- </select>
720
- <?php endif; ?>
721
- <?php elseif ($fields[2]['value'] == 'suffix'): ?>
722
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
723
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
724
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
725
- <span class="required">*</span>
726
- <?php endif ?>
727
- </label><br />
728
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
729
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[2]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
730
- <?php else: ?>
731
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
732
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
733
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
734
- <?php endforeach ?>
735
- </select>
736
- <?php endif; ?>
737
- <?php elseif ($fields[2]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
738
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
739
- <?php elseif ($fields[2]['value'] == 'gender'): ?>
740
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
741
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
742
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
743
- <span class="required">*</span>
744
- <?php endif ?>
745
- </label><br />
746
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[2]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
747
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
748
- <?php $value = $_gender->getGender(); ?>
749
- <?php foreach ($options as $option): ?>
750
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
751
- <?php endforeach; ?>
752
- </select>
753
- <?php else: ?>
754
- <label for="billing:<?php echo $fields[2]['value'] ?>"><?php echo $helper->getFieldLabel($fields[2]['value']); ?>
755
- <?php if ($helper->getFieldRequire($fields[2]['value'])): ?>
756
- <span class="required">*</span>
757
- <?php endif; ?>
758
- </label><br>
759
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[2]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[2]['value']); ?>" value="" name="billing[<?php echo $fields[2]['value'] ?>]" id="billing:<?php echo $fields[2]['value'] ?>">
760
- <?php endif; ?>
761
- </div>
762
- <div class="two-fields">
763
- <?php if ($fields[3]['value'] == 'street'): ?>
764
- <label for="billing:street1"><?php echo $this->__('Address') ?>
765
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
766
- <span class="required">*</span>
767
- <?php endif ?>
768
- </label><br />
769
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
770
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
771
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
772
- <?php endfor ?>
773
- <?php elseif ($fields[3]['value'] == 'country'): ?>
774
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
775
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
776
- <span class="required">*</span>
777
- <?php endif ?>
778
- </label><br />
779
- <?php echo $this->getCountryHtmlSelect('billing') ?>
780
- <?php if (!$helper->getFieldRequire($fields[3]['value'])): ?>
781
- <script type="text/javascript">
782
- if ($('billing:country_id'))
783
- $('billing:country_id').removeClassName('validate-select');
784
- </script>
785
- <?php endif ?>
786
- <?php elseif ($fields[3]['value'] == 'region'): ?>
787
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
788
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
789
- <span class="required">*</span>
790
- <?php endif ?>
791
- </label><br/>
792
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
793
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
794
- </select>
795
- <?php if (!$helper->enableGeoip()): ?>
796
- <script type="text/javascript">
797
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
798
- </script>
799
- <?php endif; ?>
800
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
801
- <?php if (!$helper->getFieldRequire($fields[3]['value'])): ?>
802
- <script type="text/javascript">
803
- if ($('billing:region_id'))
804
- $('billing:region_id').removeClassName('validate-select');
805
- </script>
806
- <?php endif ?>
807
- <?php elseif ($fields[3]['value'] == 'prefix'): ?>
808
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
809
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
810
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
811
- <span class="required">*</span>
812
- <?php endif ?>
813
- </label><br />
814
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
815
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[3]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
816
- <?php else: ?>
817
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
818
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
819
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
820
- <?php endforeach ?>
821
- </select>
822
- <?php endif; ?>
823
- <?php elseif ($fields[3]['value'] == 'suffix'): ?>
824
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
825
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
826
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
827
- <span class="required">*</span>
828
- <?php endif ?>
829
- </label><br />
830
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
831
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[3]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
832
- <?php else: ?>
833
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
834
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
835
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
836
- <?php endforeach ?>
837
- </select>
838
- <?php endif; ?>
839
- <?php elseif ($fields[3]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
840
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
841
- <?php elseif ($fields[3]['value'] == 'gender'): ?>
842
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
843
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
844
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
845
- <span class="required">*</span>
846
- <?php endif ?>
847
- </label><br />
848
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[3]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
849
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
850
- <?php $value = $_gender->getGender(); ?>
851
- <?php foreach ($options as $option): ?>
852
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
853
- <?php endforeach; ?>
854
- </select>
855
- <?php else: ?>
856
- <label for="billing:<?php echo $fields[3]['value'] ?>"><?php echo $helper->getFieldLabel($fields[3]['value']); ?>
857
- <?php if ($helper->getFieldRequire($fields[3]['value'])): ?>
858
- <span class="required">*</span>
859
- <?php endif; ?>
860
- </label><br>
861
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[3]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[3]['value']); ?>" value="" name="billing[<?php echo $fields[3]['value'] ?>]" id="billing:<?php echo $fields[3]['value'] ?>">
862
- <?php endif; ?>
863
- </div>
864
- <?php endif; ?>
865
- <?php endif; ?>
866
- </li>
867
- <li>
868
- <?php if ($fields[4]['value'] != '0' || $fields[5]['value'] != '0'): ?>
869
- <?php if ($fields[4]['value'] == '0' || $fields[5]['value'] == '0'): ?>
870
- <div class="one-field">
871
- <div class="one-field">
872
- <?php if ($fields[4]['value'] != '0'): ?>
873
- <!--begin-->
874
- <?php if ($fields[4]['value'] == 'street'): ?>
875
- <label for="billing:street1"><?php echo $this->__('Address') ?>
876
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
877
- <span class="required">*</span>
878
- <?php endif ?>
879
- </label><br />
880
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo 'required-entry'; ?> input-text"/>
881
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
882
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
883
- <?php endfor ?>
884
- <?php elseif ($fields[4]['value'] == 'country'): ?>
885
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
886
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
887
- <span class="required">*</span>
888
- <?php endif ?>
889
- </label><br />
890
- <?php echo $this->getCountryHtmlSelect('billing') ?>
891
- <?php if (!$helper->getFieldRequire($fields[4]['value'])): ?>
892
- <script type="text/javascript">
893
- if ($('billing:country_id'))
894
- $('billing:country_id').removeClassName('validate-select');
895
- </script>
896
- <?php endif ?>
897
- <?php elseif ($fields[4]['value'] == 'region'): ?>
898
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
899
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
900
- <span class="required">*</span>
901
- <?php endif ?>
902
- </label><br/>
903
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
904
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
905
- </select>
906
- <?php if (!$helper->enableGeoip()): ?>
907
- <script type="text/javascript">
908
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
909
- </script>
910
- <?php endif; ?>
911
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
912
- <?php if (!$helper->getFieldRequire($fields[4]['value'])): ?>
913
- <script type="text/javascript">
914
- if ($('billing:region_id'))
915
- $('billing:region_id').removeClassName('validate-select');
916
- </script>
917
- <?php endif ?>
918
- <?php elseif ($fields[4]['value'] == 'prefix'): ?>
919
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
920
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
921
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
922
- <span class="required">*</span>
923
- <?php endif ?>
924
- </label><br />
925
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
926
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[4]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
927
- <?php else: ?>
928
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
929
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
930
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
931
- <?php endforeach ?>
932
- </select>
933
- <?php endif; ?>
934
- <?php elseif ($fields[4]['value'] == 'suffix'): ?>
935
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
936
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
937
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
938
- <span class="required">*</span>
939
- <?php endif ?>
940
- </label><br />
941
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
942
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[4]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
943
- <?php else: ?>
944
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
945
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
946
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
947
- <?php endforeach ?>
948
- </select>
949
- <?php endif; ?>
950
- <?php elseif ($fields[4]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
951
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
952
- <?php elseif ($fields[4]['value'] == 'gender'): ?>
953
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
954
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
955
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
956
- <span class="required">*</span>
957
- <?php endif ?>
958
- </label><br />
959
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
960
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
961
- <?php $value = $_gender->getGender(); ?>
962
- <?php foreach ($options as $option): ?>
963
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
964
- <?php endforeach; ?>
965
- </select>
966
- <?php else: ?>
967
- <label for="billing:<?php echo $fields[4]['value'] ?>"><?php echo $helper->getFieldLabel($fields[4]['value']); ?>
968
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
969
- <span class="required">*</span>
970
- <?php endif; ?>
971
- </label><br>
972
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[4]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[4]['value']); ?>" value="" name="billing[<?php echo $fields[4]['value'] ?>]" id="billing:<?php echo $fields[4]['value'] ?>">
973
- <?php endif ?>
974
- <!-- end -->
975
- <?php else: ?>
976
- <?php if ($fields[5]['value'] == 'street'): ?>
977
- <label for="billing:street1"><?php echo $this->__('Address') ?>
978
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
979
- <span class="required">*</span>
980
- <?php endif ?>
981
- </label><br />
982
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
983
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
984
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
985
- <?php endfor ?>
986
- <?php elseif ($fields[5]['value'] == 'country'): ?>
987
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
988
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
989
- <span class="required">*</span>
990
- <?php endif ?>
991
- </label><br />
992
- <?php echo $this->getCountryHtmlSelect('billing') ?>
993
- <?php if (!$helper->getFieldRequire($fields[5]['value'])): ?>
994
- <script type="text/javascript">
995
- if ($('billing:country_id'))
996
- $('billing:country_id').removeClassName('validate-select');
997
- </script>
998
- <?php endif ?>
999
- <?php elseif ($fields[5]['value'] == 'region'): ?>
1000
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1001
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1002
- <span class="required">*</span>
1003
- <?php endif ?>
1004
- </label><br/>
1005
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1006
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1007
- </select>
1008
- <?php if (!$helper->enableGeoip()): ?>
1009
- <script type="text/javascript">
1010
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1011
- </script>
1012
- <?php endif; ?>
1013
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1014
- <?php if (!$helper->getFieldRequire($fields[5]['value'])): ?>
1015
- <script type="text/javascript">
1016
- if ($('billing:region_id'))
1017
- $('billing:region_id').removeClassName('validate-select');
1018
- </script>
1019
- <?php endif ?>
1020
- <?php elseif ($fields[5]['value'] == 'prefix'): ?>
1021
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1022
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1023
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1024
- <span class="required">*</span>
1025
- <?php endif ?>
1026
- </label><br />
1027
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1028
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[5]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1029
- <?php else: ?>
1030
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1031
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1032
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1033
- <?php endforeach ?>
1034
- </select>
1035
- <?php endif; ?>
1036
- <?php elseif ($fields[5]['value'] == 'suffix'): ?>
1037
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1038
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1039
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1040
- <span class="required">*</span>
1041
- <?php endif ?>
1042
- </label><br />
1043
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1044
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[5]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1045
- <?php else: ?>
1046
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1047
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1048
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1049
- <?php endforeach ?>
1050
- </select>
1051
- <?php endif; ?>
1052
- <?php elseif ($fields[5]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1053
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1054
- <?php elseif ($fields[5]['value'] == 'gender'): ?>
1055
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1056
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1057
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1058
- <span class="required">*</span>
1059
- <?php endif ?>
1060
- </label><br />
1061
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
1062
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
1063
- <?php $value = $_gender->getGender(); ?>
1064
- <?php foreach ($options as $option): ?>
1065
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
1066
- <?php endforeach; ?>
1067
- </select>
1068
- <?php else: ?>
1069
- <label for="billing:<?php echo $fields[5]['value'] ?>"><?php echo $helper->getFieldLabel($fields[5]['value']); ?>
1070
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1071
- <span class="required">*</span>
1072
- <?php endif; ?>
1073
- </label><br>
1074
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[5]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[5]['value']); ?>" value="" name="billing[<?php echo $fields[5]['value'] ?>]" id="billing:<?php echo $fields[5]['value'] ?>">
1075
- <?php endif; ?>
1076
- <?php endif; ?>
1077
- </div>
1078
- <?php else: ?>
1079
- <div class="two-fields">
1080
- <?php if ($fields[4]['value'] == 'street'): ?>
1081
- <label for="billing:street1"><?php echo $this->__('Address') ?>
1082
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
1083
- <span class="required">*</span>
1084
- <?php endif ?>
1085
- </label><br />
1086
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
1087
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
1088
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
1089
- <?php endfor ?>
1090
- <?php elseif ($fields[4]['value'] == 'country'): ?>
1091
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
1092
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
1093
- <span class="required">*</span>
1094
- <?php endif ?>
1095
- </label><br />
1096
- <?php echo $this->getCountryHtmlSelect('billing') ?>
1097
- <?php if (!$helper->getFieldRequire($fields[4]['value'])): ?>
1098
- <script type="text/javascript">
1099
- if ($('billing:country_id'))
1100
- $('billing:country_id').removeClassName('validate-select');
1101
- </script>
1102
- <?php endif ?>
1103
- <?php elseif ($fields[4]['value'] == 'region'): ?>
1104
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1105
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
1106
- <span class="required">*</span>
1107
- <?php endif ?>
1108
- </label><br/>
1109
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1110
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1111
- </select>
1112
- <?php if (!$helper->enableGeoip()): ?>
1113
- <script type="text/javascript">
1114
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1115
- </script>
1116
- <?php endif; ?>
1117
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1118
- <?php if (!$helper->getFieldRequire($fields[4]['value'])): ?>
1119
- <script type="text/javascript">
1120
- if ($('billing:region_id'))
1121
- $('billing:region_id').removeClassName('validate-select');
1122
- </script>
1123
- <?php endif ?>
1124
- <?php elseif ($fields[4]['value'] == 'prefix'): ?>
1125
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1126
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1127
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
1128
- <span class="required">*</span>
1129
- <?php endif ?>
1130
- </label><br />
1131
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1132
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[4]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1133
- <?php else: ?>
1134
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1135
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1136
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1137
- <?php endforeach ?>
1138
- </select>
1139
- <?php endif; ?>
1140
- <?php elseif ($fields[4]['value'] == 'suffix'): ?>
1141
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1142
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1143
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
1144
- <span class="required">*</span>
1145
- <?php endif ?>
1146
- </label><br />
1147
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1148
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[4]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1149
- <?php else: ?>
1150
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1151
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1152
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1153
- <?php endforeach ?>
1154
- </select>
1155
- <?php endif; ?>
1156
- <?php elseif ($fields[4]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1157
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1158
- <?php elseif ($fields[4]['value'] == 'gender'): ?>
1159
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1160
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1161
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
1162
- <span class="required">*</span>
1163
- <?php endif ?>
1164
- </label><br />
1165
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[4]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
1166
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
1167
- <?php $value = $_gender->getGender(); ?>
1168
- <?php foreach ($options as $option): ?>
1169
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
1170
- <?php endforeach; ?>
1171
- </select>
1172
- <?php else: ?>
1173
- <label for="billing:<?php echo $fields[4]['value'] ?>"><?php echo $helper->getFieldLabel($fields[4]['value']); ?>
1174
- <?php if ($helper->getFieldRequire($fields[4]['value'])): ?>
1175
- <span class="required">*</span>
1176
- <?php endif; ?>
1177
- </label><br>
1178
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[4]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[4]['value']); ?>" value="" name="billing[<?php echo $fields[4]['value'] ?>]" id="billing:<?php echo $fields[4]['value'] ?>">
1179
- <?php endif; ?>
1180
- </div>
1181
- <div class="two-fields">
1182
- <?php if ($fields[5]['value'] == 'street'): ?>
1183
- <label for="billing:street1"><?php echo $this->__('Address') ?>
1184
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
1185
- <span class="required">*</span>
1186
- <?php endif ?>
1187
- </label><br />
1188
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
1189
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
1190
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
1191
- <?php endfor ?>
1192
- <?php elseif ($fields[5]['value'] == 'country'): ?>
1193
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
1194
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1195
- <span class="required">*</span>
1196
- <?php endif ?>
1197
- </label><br />
1198
- <?php echo $this->getCountryHtmlSelect('billing') ?>
1199
- <?php if (!$helper->getFieldRequire($fields[5]['value'])): ?>
1200
- <script type="text/javascript">
1201
- if ($('billing:country_id'))
1202
- $('billing:country_id').removeClassName('validate-select');
1203
- </script>
1204
- <?php endif ?>
1205
- <?php elseif ($fields[5]['value'] == 'region'): ?>
1206
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1207
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1208
- <span class="required">*</span>
1209
- <?php endif ?>
1210
- </label><br/>
1211
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1212
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1213
- </select>
1214
- <?php if (!$helper->enableGeoip()): ?>
1215
- <script type="text/javascript">
1216
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1217
- </script>
1218
- <?php endif; ?>
1219
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1220
- <?php if (!$helper->getFieldRequire($fields[5]['value'])): ?>
1221
- <script type="text/javascript">
1222
- if ($('billing:region_id'))
1223
- $('billing:region_id').removeClassName('validate-select');
1224
- </script>
1225
- <?php endif ?>
1226
- <?php elseif ($fields[5]['value'] == 'prefix'): ?>
1227
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1228
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1229
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1230
- <span class="required">*</span>
1231
- <?php endif ?>
1232
- </label><br />
1233
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1234
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[5]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1235
- <?php else: ?>
1236
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1237
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1238
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1239
- <?php endforeach ?>
1240
- </select>
1241
- <?php endif; ?>
1242
- <?php elseif ($fields[5]['value'] == 'suffix'): ?>
1243
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1244
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1245
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1246
- <span class="required">*</span>
1247
- <?php endif ?>
1248
- </label><br />
1249
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1250
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[5]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1251
- <?php else: ?>
1252
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1253
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1254
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1255
- <?php endforeach ?>
1256
- </select>
1257
- <?php endif; ?>
1258
- <?php elseif ($fields[5]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1259
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1260
- <?php elseif ($fields[5]['value'] == 'gender'): ?>
1261
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1262
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1263
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1264
- <span class="required">*</span>
1265
- <?php endif ?>
1266
- </label><br />
1267
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[5]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
1268
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
1269
- <?php $value = $_gender->getGender(); ?>
1270
- <?php foreach ($options as $option): ?>
1271
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
1272
- <?php endforeach; ?>
1273
- </select>
1274
- <?php else: ?>
1275
- <label for="billing:<?php echo $fields[5]['value'] ?>"><?php echo $helper->getFieldLabel($fields[5]['value']); ?>
1276
- <?php if ($helper->getFieldRequire($fields[5]['value'])): ?>
1277
- <span class="required">*</span>
1278
- <?php endif; ?>
1279
- </label><br>
1280
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[5]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[5]['value']); ?>" value="" name="billing[<?php echo $fields[5]['value'] ?>]" id="billing:<?php echo $fields[5]['value'] ?>">
1281
- <?php endif; ?>
1282
- </div>
1283
- <?php endif; ?>
1284
- <?php endif; ?>
1285
- </li>
1286
- <li>
1287
- <?php if ($fields[6]['value'] != '0' || $fields[7]['value'] != '0'): ?>
1288
- <?php if ($fields[6]['value'] == '0' || $fields[7]['value'] == '0'): ?>
1289
- <div class="one-field">
1290
- <div class="one-field">
1291
- <?php if ($fields[6]['value'] != '0'): ?>
1292
- <!--begin-->
1293
- <?php if ($fields[6]['value'] == 'street'): ?>
1294
- <label for="billing:street1"><?php echo $this->__('Address') ?>
1295
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1296
- <span class="required">*</span>
1297
- <?php endif ?>
1298
- </label><br />
1299
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo 'required-entry'; ?> input-text"/>
1300
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
1301
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
1302
- <?php endfor ?>
1303
- <?php elseif ($fields[6]['value'] == 'country'): ?>
1304
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
1305
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1306
- <span class="required">*</span>
1307
- <?php endif ?>
1308
- </label><br />
1309
- <?php echo $this->getCountryHtmlSelect('billing') ?>
1310
- <?php if (!$helper->getFieldRequire($fields[6]['value'])): ?>
1311
- <script type="text/javascript">
1312
- if ($('billing:country_id'))
1313
- $('billing:country_id').removeClassName('validate-select');
1314
- </script>
1315
- <?php endif ?>
1316
- <?php elseif ($fields[6]['value'] == 'region'): ?>
1317
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1318
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1319
- <span class="required">*</span>
1320
- <?php endif ?>
1321
- </label><br/>
1322
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1323
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1324
- </select>
1325
- <?php if (!$helper->enableGeoip()): ?>
1326
- <script type="text/javascript">
1327
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1328
- </script>
1329
- <?php endif; ?>
1330
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1331
- <?php if (!$helper->getFieldRequire($fields[6]['value'])): ?>
1332
- <script type="text/javascript">
1333
- if ($('billing:region_id'))
1334
- $('billing:region_id').removeClassName('validate-select');
1335
- </script>
1336
- <?php endif ?>
1337
- <?php elseif ($fields[6]['value'] == 'prefix'): ?>
1338
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1339
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1340
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1341
- <span class="required">*</span>
1342
- <?php endif ?>
1343
- </label><br />
1344
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1345
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[6]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1346
- <?php else: ?>
1347
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1348
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1349
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1350
- <?php endforeach ?>
1351
- </select>
1352
- <?php endif; ?>
1353
- <?php elseif ($fields[6]['value'] == 'suffix'): ?>
1354
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1355
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1356
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1357
- <span class="required">*</span>
1358
- <?php endif ?>
1359
- </label><br />
1360
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1361
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[6]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1362
- <?php else: ?>
1363
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1364
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1365
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1366
- <?php endforeach ?>
1367
- </select>
1368
- <?php endif; ?>
1369
- <?php elseif ($fields[6]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1370
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1371
- <?php elseif ($fields[6]['value'] == 'gender'): ?>
1372
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1373
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1374
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1375
- <span class="required">*</span>
1376
- <?php endif ?>
1377
- </label><br />
1378
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
1379
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
1380
- <?php $value = $_gender->getGender(); ?>
1381
- <?php foreach ($options as $option): ?>
1382
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
1383
- <?php endforeach; ?>
1384
- </select>
1385
- <?php else: ?>
1386
- <label for="billing:<?php echo $fields[6]['value'] ?>"><?php echo $helper->getFieldLabel($fields[6]['value']); ?>
1387
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1388
- <span class="required">*</span>
1389
- <?php endif; ?>
1390
- </label><br>
1391
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[6]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[6]['value']); ?>" value="" name="billing[<?php echo $fields[6]['value'] ?>]" id="billing:<?php echo $fields[6]['value'] ?>">
1392
- <?php endif ?>
1393
- <!-- end -->
1394
- <?php else: ?>
1395
- <?php if ($fields[7]['value'] == 'street'): ?>
1396
- <label for="billing:street1"><?php echo $this->__('Address') ?>
1397
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1398
- <span class="required">*</span>
1399
- <?php endif ?>
1400
- </label><br />
1401
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
1402
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
1403
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
1404
- <?php endfor ?>
1405
- <?php elseif ($fields[7]['value'] == 'country'): ?>
1406
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
1407
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1408
- <span class="required">*</span>
1409
- <?php endif ?>
1410
- </label><br />
1411
- <?php echo $this->getCountryHtmlSelect('billing') ?>
1412
- <?php if (!$helper->getFieldRequire($fields[7]['value'])): ?>
1413
- <script type="text/javascript">
1414
- if ($('billing:country_id'))
1415
- $('billing:country_id').removeClassName('validate-select');
1416
- </script>
1417
- <?php endif ?>
1418
- <?php elseif ($fields[7]['value'] == 'region'): ?>
1419
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1420
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1421
- <span class="required">*</span>
1422
- <?php endif ?>
1423
- </label><br/>
1424
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1425
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1426
- </select>
1427
- <?php if (!$helper->enableGeoip()): ?>
1428
- <script type="text/javascript">
1429
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1430
- </script>
1431
- <?php endif; ?>
1432
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1433
- <?php if (!$helper->getFieldRequire($fields[7]['value'])): ?>
1434
- <script type="text/javascript">
1435
- if ($('billing:region_id'))
1436
- $('billing:region_id').removeClassName('validate-select');
1437
- </script>
1438
- <?php endif ?>
1439
- <?php elseif ($fields[7]['value'] == 'prefix'): ?>
1440
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1441
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1442
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1443
- <span class="required">*</span>
1444
- <?php endif ?>
1445
- </label><br />
1446
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1447
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[7]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1448
- <?php else: ?>
1449
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1450
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1451
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1452
- <?php endforeach ?>
1453
- </select>
1454
- <?php endif; ?>
1455
- <?php elseif ($fields[7]['value'] == 'suffix'): ?>
1456
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1457
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1458
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1459
- <span class="required">*</span>
1460
- <?php endif ?>
1461
- </label><br />
1462
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1463
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[7]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1464
- <?php else: ?>
1465
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1466
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1467
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1468
- <?php endforeach ?>
1469
- </select>
1470
- <?php endif; ?>
1471
- <?php elseif ($fields[7]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1472
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1473
- <?php elseif ($fields[7]['value'] == 'gender'): ?>
1474
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1475
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1476
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1477
- <span class="required">*</span>
1478
- <?php endif ?>
1479
- </label><br />
1480
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
1481
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
1482
- <?php $value = $_gender->getGender(); ?>
1483
- <?php foreach ($options as $option): ?>
1484
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
1485
- <?php endforeach; ?>
1486
- </select>
1487
- <?php else: ?>
1488
- <label for="billing:<?php echo $fields[7]['value'] ?>"><?php echo $helper->getFieldLabel($fields[7]['value']); ?>
1489
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1490
- <span class="required">*</span>
1491
- <?php endif; ?>
1492
- </label><br>
1493
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[7]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[7]['value']); ?>" value="" name="billing[<?php echo $fields[7]['value'] ?>]" id="billing:<?php echo $fields[7]['value'] ?>">
1494
- <?php endif; ?>
1495
- <?php endif; ?>
1496
- </div>
1497
- <?php else: ?>
1498
- <div class="two-fields">
1499
- <?php if ($fields[6]['value'] == 'street'): ?>
1500
- <label for="billing:street1"><?php echo $this->__('Address') ?>
1501
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
1502
- <span class="required">*</span>
1503
- <?php endif ?>
1504
- </label><br />
1505
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
1506
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
1507
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
1508
- <?php endfor ?>
1509
- <?php elseif ($fields[6]['value'] == 'country'): ?>
1510
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
1511
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1512
- <span class="required">*</span>
1513
- <?php endif ?>
1514
- </label><br />
1515
- <?php echo $this->getCountryHtmlSelect('billing') ?>
1516
- <?php if (!$helper->getFieldRequire($fields[6]['value'])): ?>
1517
- <script type="text/javascript">
1518
- if ($('billing:country_id'))
1519
- $('billing:country_id').removeClassName('validate-select');
1520
- </script>
1521
- <?php endif ?>
1522
- <?php elseif ($fields[6]['value'] == 'region'): ?>
1523
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1524
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1525
- <span class="required">*</span>
1526
- <?php endif ?>
1527
- </label><br/>
1528
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1529
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1530
- </select>
1531
- <?php if (!$helper->enableGeoip()): ?>
1532
- <script type="text/javascript">
1533
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1534
- </script>
1535
- <?php endif; ?>
1536
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1537
- <?php if (!$helper->getFieldRequire($fields[6]['value'])): ?>
1538
- <script type="text/javascript">
1539
- if ($('billing:region_id'))
1540
- $('billing:region_id').removeClassName('validate-select');
1541
- </script>
1542
- <?php endif ?>
1543
- <?php elseif ($fields[6]['value'] == 'prefix'): ?>
1544
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1545
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1546
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1547
- <span class="required">*</span>
1548
- <?php endif ?>
1549
- </label><br />
1550
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1551
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[6]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1552
- <?php else: ?>
1553
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1554
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1555
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1556
- <?php endforeach ?>
1557
- </select>
1558
- <?php endif; ?>
1559
- <?php elseif ($fields[6]['value'] == 'suffix'): ?>
1560
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1561
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1562
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1563
- <span class="required">*</span>
1564
- <?php endif ?>
1565
- </label><br />
1566
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1567
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[6]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1568
- <?php else: ?>
1569
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1570
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1571
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1572
- <?php endforeach ?>
1573
- </select>
1574
- <?php endif; ?>
1575
- <?php elseif ($fields[6]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1576
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1577
- <?php elseif ($fields[6]['value'] == 'gender'): ?>
1578
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1579
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1580
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1581
- <span class="required">*</span>
1582
- <?php endif ?>
1583
- </label><br />
1584
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[6]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
1585
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
1586
- <?php $value = $_gender->getGender(); ?>
1587
- <?php foreach ($options as $option): ?>
1588
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
1589
- <?php endforeach; ?>
1590
- </select>
1591
- <?php else: ?>
1592
- <label for="billing:<?php echo $fields[6]['value'] ?>"><?php echo $helper->getFieldLabel($fields[6]['value']); ?>
1593
- <?php if ($helper->getFieldRequire($fields[6]['value'])): ?>
1594
- <span class="required">*</span>
1595
- <?php endif; ?>
1596
- </label><br>
1597
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[6]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[6]['value']); ?>" value="" name="billing[<?php echo $fields[6]['value'] ?>]" id="billing:<?php echo $fields[6]['value'] ?>">
1598
- <?php endif; ?>
1599
- </div>
1600
- <div class="two-fields">
1601
- <?php if ($fields[7]['value'] == 'street'): ?>
1602
- <label for="billing:street1"><?php echo $this->__('Address') ?>
1603
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
1604
- <span class="required">*</span>
1605
- <?php endif ?>
1606
- </label><br />
1607
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
1608
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
1609
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
1610
- <?php endfor ?>
1611
- <?php elseif ($fields[7]['value'] == 'country'): ?>
1612
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
1613
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1614
- <span class="required">*</span>
1615
- <?php endif ?>
1616
- </label><br />
1617
- <?php echo $this->getCountryHtmlSelect('billing') ?>
1618
- <?php if (!$helper->getFieldRequire($fields[7]['value'])): ?>
1619
- <script type="text/javascript">
1620
- if ($('billing:country_id'))
1621
- $('billing:country_id').removeClassName('validate-select');
1622
- </script>
1623
- <?php endif ?>
1624
- <?php elseif ($fields[7]['value'] == 'region'): ?>
1625
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1626
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1627
- <span class="required">*</span>
1628
- <?php endif ?>
1629
- </label><br/>
1630
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1631
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1632
- </select>
1633
- <?php if (!$helper->enableGeoip()): ?>
1634
- <script type="text/javascript">
1635
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1636
- </script>
1637
- <?php endif; ?>
1638
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1639
- <?php if (!$helper->getFieldRequire($fields[7]['value'])): ?>
1640
- <script type="text/javascript">
1641
- if ($('billing:region_id'))
1642
- $('billing:region_id').removeClassName('validate-select');
1643
- </script>
1644
- <?php endif ?>
1645
- <?php elseif ($fields[7]['value'] == 'prefix'): ?>
1646
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1647
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1648
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1649
- <span class="required">*</span>
1650
- <?php endif ?>
1651
- </label><br />
1652
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1653
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[7]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1654
- <?php else: ?>
1655
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1656
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1657
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1658
- <?php endforeach ?>
1659
- </select>
1660
- <?php endif; ?>
1661
- <?php elseif ($fields[7]['value'] == 'suffix'): ?>
1662
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1663
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1664
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1665
- <span class="required">*</span>
1666
- <?php endif ?>
1667
- </label><br />
1668
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1669
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[7]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1670
- <?php else: ?>
1671
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1672
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1673
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1674
- <?php endforeach ?>
1675
- </select>
1676
- <?php endif; ?>
1677
- <?php elseif ($fields[7]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1678
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1679
- <?php elseif ($fields[7]['value'] == 'gender'): ?>
1680
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1681
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1682
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1683
- <span class="required">*</span>
1684
- <?php endif ?>
1685
- </label><br />
1686
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[7]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
1687
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
1688
- <?php $value = $_gender->getGender(); ?>
1689
- <?php foreach ($options as $option): ?>
1690
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
1691
- <?php endforeach; ?>
1692
- </select>
1693
- <?php else: ?>
1694
- <label for="billing:<?php echo $fields[7]['value'] ?>"><?php echo $helper->getFieldLabel($fields[7]['value']); ?>
1695
- <?php if ($helper->getFieldRequire($fields[7]['value'])): ?>
1696
- <span class="required">*</span>
1697
- <?php endif; ?>
1698
- </label><br>
1699
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[7]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[7]['value']); ?>" value="" name="billing[<?php echo $fields[7]['value'] ?>]" id="billing:<?php echo $fields[7]['value'] ?>">
1700
- <?php endif; ?>
1701
- </div>
1702
- <?php endif; ?>
1703
- <?php endif; ?>
1704
- </li>
1705
- <li>
1706
- <?php if ($fields[8]['value'] != '0' || $fields[9]['value'] != '0'): ?>
1707
- <?php if ($fields[8]['value'] == '0' || $fields[9]['value'] == '0'): ?>
1708
- <div class="one-field">
1709
- <div class="one-field">
1710
- <?php if ($fields[8]['value'] != '0'): ?>
1711
- <!--begin-->
1712
- <?php if ($fields[8]['value'] == 'street'): ?>
1713
- <label for="billing:street1"><?php echo $this->__('Address') ?>
1714
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1715
- <span class="required">*</span>
1716
- <?php endif ?>
1717
- </label><br />
1718
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo 'required-entry'; ?> input-text"/>
1719
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
1720
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
1721
- <?php endfor ?>
1722
- <?php elseif ($fields[8]['value'] == 'country'): ?>
1723
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
1724
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1725
- <span class="required">*</span>
1726
- <?php endif ?>
1727
- </label><br />
1728
- <?php echo $this->getCountryHtmlSelect('billing') ?>
1729
- <?php if (!$helper->getFieldRequire($fields[8]['value'])): ?>
1730
- <script type="text/javascript">
1731
- if ($('billing:country_id'))
1732
- $('billing:country_id').removeClassName('validate-select');
1733
- </script>
1734
- <?php endif ?>
1735
- <?php elseif ($fields[8]['value'] == 'region'): ?>
1736
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1737
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1738
- <span class="required">*</span>
1739
- <?php endif ?>
1740
- </label><br/>
1741
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1742
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1743
- </select>
1744
- <?php if (!$helper->enableGeoip()): ?>
1745
- <script type="text/javascript">
1746
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1747
- </script>
1748
- <?php endif; ?>
1749
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1750
- <?php if (!$helper->getFieldRequire($fields[8]['value'])): ?>
1751
- <script type="text/javascript">
1752
- if ($('billing:region_id'))
1753
- $('billing:region_id').removeClassName('validate-select');
1754
- </script>
1755
- <?php endif ?>
1756
- <?php elseif ($fields[8]['value'] == 'prefix'): ?>
1757
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1758
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1759
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1760
- <span class="required">*</span>
1761
- <?php endif ?>
1762
- </label><br />
1763
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1764
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[8]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1765
- <?php else: ?>
1766
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1767
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1768
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1769
- <?php endforeach ?>
1770
- </select>
1771
- <?php endif; ?>
1772
- <?php elseif ($fields[8]['value'] == 'suffix'): ?>
1773
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1774
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1775
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1776
- <span class="required">*</span>
1777
- <?php endif ?>
1778
- </label><br />
1779
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1780
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[8]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1781
- <?php else: ?>
1782
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1783
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1784
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1785
- <?php endforeach ?>
1786
- </select>
1787
- <?php endif; ?>
1788
- <?php elseif ($fields[8]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1789
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1790
- <?php elseif ($fields[8]['value'] == 'gender'): ?>
1791
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1792
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1793
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1794
- <span class="required">*</span>
1795
- <?php endif ?>
1796
- </label><br />
1797
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
1798
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
1799
- <?php $value = $_gender->getGender(); ?>
1800
- <?php foreach ($options as $option): ?>
1801
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
1802
- <?php endforeach; ?>
1803
- </select>
1804
- <?php else: ?>
1805
- <label for="billing:<?php echo $fields[8]['value'] ?>"><?php echo $helper->getFieldLabel($fields[8]['value']); ?>
1806
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1807
- <span class="required">*</span>
1808
- <?php endif; ?>
1809
- </label><br>
1810
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[8]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[8]['value']); ?>" value="" name="billing[<?php echo $fields[8]['value'] ?>]" id="billing:<?php echo $fields[8]['value'] ?>">
1811
- <?php endif ?>
1812
- <!-- end -->
1813
- <?php else: ?>
1814
- <?php if ($fields[9]['value'] == 'street'): ?>
1815
- <label for="billing:street1"><?php echo $this->__('Address') ?>
1816
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
1817
- <span class="required">*</span>
1818
- <?php endif ?>
1819
- </label><br />
1820
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
1821
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
1822
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
1823
- <?php endfor ?>
1824
- <?php elseif ($fields[9]['value'] == 'country'): ?>
1825
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
1826
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
1827
- <span class="required">*</span>
1828
- <?php endif ?>
1829
- </label><br />
1830
- <?php echo $this->getCountryHtmlSelect('billing') ?>
1831
- <?php if (!$helper->getFieldRequire($fields[9]['value'])): ?>
1832
- <script type="text/javascript">
1833
- if ($('billing:country_id'))
1834
- $('billing:country_id').removeClassName('validate-select');
1835
- </script>
1836
- <?php endif ?>
1837
- <?php elseif ($fields[9]['value'] == 'region'): ?>
1838
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1839
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
1840
- <span class="required">*</span>
1841
- <?php endif ?>
1842
- </label><br/>
1843
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1844
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1845
- </select>
1846
- <?php if (!$helper->enableGeoip()): ?>
1847
- <script type="text/javascript">
1848
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1849
- </script>
1850
- <?php endif; ?>
1851
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1852
- <?php if (!$helper->getFieldRequire($fields[9]['value'])): ?>
1853
- <script type="text/javascript">
1854
- if ($('billing:region_id'))
1855
- $('billing:region_id').removeClassName('validate-select');
1856
- </script>
1857
- <?php endif ?>
1858
- <?php elseif ($fields[9]['value'] == 'prefix'): ?>
1859
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1860
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1861
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
1862
- <span class="required">*</span>
1863
- <?php endif ?>
1864
- </label><br />
1865
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1866
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[9]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1867
- <?php else: ?>
1868
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1869
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1870
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1871
- <?php endforeach ?>
1872
- </select>
1873
- <?php endif; ?>
1874
- <?php elseif ($fields[9]['value'] == 'suffix'): ?>
1875
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1876
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1877
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
1878
- <span class="required">*</span>
1879
- <?php endif ?>
1880
- </label><br />
1881
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1882
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[9]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1883
- <?php else: ?>
1884
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1885
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1886
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1887
- <?php endforeach ?>
1888
- </select>
1889
- <?php endif; ?>
1890
- <?php elseif ($fields[9]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1891
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1892
- <?php elseif ($fields[9]['value'] == 'gender'): ?>
1893
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1894
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1895
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
1896
- <span class="required">*</span>
1897
- <?php endif ?>
1898
- </label><br />
1899
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
1900
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
1901
- <?php $value = $_gender->getGender(); ?>
1902
- <?php foreach ($options as $option): ?>
1903
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
1904
- <?php endforeach; ?>
1905
- </select>
1906
- <?php else: ?>
1907
- <label for="billing:<?php echo $fields[9]['value'] ?>"><?php echo $helper->getFieldLabel($fields[9]['value']); ?>
1908
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
1909
- <span class="required">*</span>
1910
- <?php endif; ?>
1911
- </label><br>
1912
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[9]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[9]['value']); ?>" value="" name="billing[<?php echo $fields[9]['value'] ?>]" id="billing:<?php echo $fields[9]['value'] ?>">
1913
- <?php endif; ?>
1914
- <?php endif; ?>
1915
- </div>
1916
- <?php else: ?>
1917
- <div class="two-fields">
1918
- <?php if ($fields[8]['value'] == 'street'): ?>
1919
- <label for="billing:street1"><?php echo $this->__('Address') ?>
1920
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
1921
- <span class="required">*</span>
1922
- <?php endif ?>
1923
- </label><br />
1924
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
1925
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
1926
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
1927
- <?php endfor ?>
1928
- <?php elseif ($fields[8]['value'] == 'country'): ?>
1929
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
1930
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1931
- <span class="required">*</span>
1932
- <?php endif ?>
1933
- </label><br />
1934
- <?php echo $this->getCountryHtmlSelect('billing') ?>
1935
- <?php if (!$helper->getFieldRequire($fields[8]['value'])): ?>
1936
- <script type="text/javascript">
1937
- if ($('billing:country_id'))
1938
- $('billing:country_id').removeClassName('validate-select');
1939
- </script>
1940
- <?php endif ?>
1941
- <?php elseif ($fields[8]['value'] == 'region'): ?>
1942
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
1943
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1944
- <span class="required">*</span>
1945
- <?php endif ?>
1946
- </label><br/>
1947
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
1948
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
1949
- </select>
1950
- <?php if (!$helper->enableGeoip()): ?>
1951
- <script type="text/javascript">
1952
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
1953
- </script>
1954
- <?php endif; ?>
1955
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
1956
- <?php if (!$helper->getFieldRequire($fields[8]['value'])): ?>
1957
- <script type="text/javascript">
1958
- if ($('billing:region_id'))
1959
- $('billing:region_id').removeClassName('validate-select');
1960
- </script>
1961
- <?php endif ?>
1962
- <?php elseif ($fields[8]['value'] == 'prefix'): ?>
1963
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1964
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
1965
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1966
- <span class="required">*</span>
1967
- <?php endif ?>
1968
- </label><br />
1969
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
1970
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[8]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1971
- <?php else: ?>
1972
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1973
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
1974
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1975
- <?php endforeach ?>
1976
- </select>
1977
- <?php endif; ?>
1978
- <?php elseif ($fields[8]['value'] == 'suffix'): ?>
1979
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
1980
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
1981
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
1982
- <span class="required">*</span>
1983
- <?php endif ?>
1984
- </label><br />
1985
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
1986
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[8]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
1987
- <?php else: ?>
1988
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
1989
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
1990
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
1991
- <?php endforeach ?>
1992
- </select>
1993
- <?php endif; ?>
1994
- <?php elseif ($fields[8]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
1995
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
1996
- <?php elseif ($fields[8]['value'] == 'gender'): ?>
1997
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
1998
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
1999
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
2000
- <span class="required">*</span>
2001
- <?php endif ?>
2002
- </label><br />
2003
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[8]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2004
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2005
- <?php $value = $_gender->getGender(); ?>
2006
- <?php foreach ($options as $option): ?>
2007
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2008
- <?php endforeach; ?>
2009
- </select>
2010
- <?php else: ?>
2011
- <label for="billing:<?php echo $fields[8]['value'] ?>"><?php echo $helper->getFieldLabel($fields[8]['value']); ?>
2012
- <?php if ($helper->getFieldRequire($fields[8]['value'])): ?>
2013
- <span class="required">*</span>
2014
- <?php endif; ?>
2015
- </label><br>
2016
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[8]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[8]['value']); ?>" value="" name="billing[<?php echo $fields[8]['value'] ?>]" id="billing:<?php echo $fields[8]['value'] ?>">
2017
- <?php endif; ?>
2018
- </div>
2019
- <div class="two-fields">
2020
- <?php if ($fields[9]['value'] == 'street'): ?>
2021
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2022
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
2023
- <span class="required">*</span>
2024
- <?php endif ?>
2025
- </label><br />
2026
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
2027
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2028
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2029
- <?php endfor ?>
2030
- <?php elseif ($fields[9]['value'] == 'country'): ?>
2031
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2032
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
2033
- <span class="required">*</span>
2034
- <?php endif ?>
2035
- </label><br />
2036
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2037
- <?php if (!$helper->getFieldRequire($fields[9]['value'])): ?>
2038
- <script type="text/javascript">
2039
- if ($('billing:country_id'))
2040
- $('billing:country_id').removeClassName('validate-select');
2041
- </script>
2042
- <?php endif ?>
2043
- <?php elseif ($fields[9]['value'] == 'region'): ?>
2044
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2045
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
2046
- <span class="required">*</span>
2047
- <?php endif ?>
2048
- </label><br/>
2049
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2050
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
2051
- </select>
2052
- <?php if (!$helper->enableGeoip()): ?>
2053
- <script type="text/javascript">
2054
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
2055
- </script>
2056
- <?php endif; ?>
2057
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
2058
- <?php if (!$helper->getFieldRequire($fields[9]['value'])): ?>
2059
- <script type="text/javascript">
2060
- if ($('billing:region_id'))
2061
- $('billing:region_id').removeClassName('validate-select');
2062
- </script>
2063
- <?php endif ?>
2064
- <?php elseif ($fields[9]['value'] == 'prefix'): ?>
2065
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2066
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
2067
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
2068
- <span class="required">*</span>
2069
- <?php endif ?>
2070
- </label><br />
2071
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
2072
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[9]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2073
- <?php else: ?>
2074
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2075
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
2076
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2077
- <?php endforeach ?>
2078
- </select>
2079
- <?php endif; ?>
2080
- <?php elseif ($fields[9]['value'] == 'suffix'): ?>
2081
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2082
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
2083
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
2084
- <span class="required">*</span>
2085
- <?php endif ?>
2086
- </label><br />
2087
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
2088
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[9]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2089
- <?php else: ?>
2090
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2091
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
2092
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2093
- <?php endforeach ?>
2094
- </select>
2095
- <?php endif; ?>
2096
- <?php elseif ($fields[9]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
2097
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
2098
- <?php elseif ($fields[9]['value'] == 'gender'): ?>
2099
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
2100
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
2101
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
2102
- <span class="required">*</span>
2103
- <?php endif ?>
2104
- </label><br />
2105
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[9]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2106
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2107
- <?php $value = $_gender->getGender(); ?>
2108
- <?php foreach ($options as $option): ?>
2109
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2110
- <?php endforeach; ?>
2111
- </select>
2112
- <?php else: ?>
2113
- <label for="billing:<?php echo $fields[9]['value'] ?>"><?php echo $helper->getFieldLabel($fields[9]['value']); ?>
2114
- <?php if ($helper->getFieldRequire($fields[9]['value'])): ?>
2115
- <span class="required">*</span>
2116
- <?php endif; ?>
2117
- </label><br>
2118
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[9]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[9]['value']); ?>" value="" name="billing[<?php echo $fields[9]['value'] ?>]" id="billing:<?php echo $fields[9]['value'] ?>">
2119
- <?php endif; ?>
2120
- </div>
2121
- <?php endif; ?>
2122
- <?php endif; ?>
2123
- </li>
2124
- <li>
2125
- <?php if ($fields[10]['value'] != '0' || $fields[11]['value'] != '0'): ?>
2126
- <?php if ($fields[10]['value'] == '0' || $fields[11]['value'] == '0'): ?>
2127
- <div class="one-field">
2128
- <div class="one-field">
2129
- <?php if ($fields[10]['value'] != '0'): ?>
2130
- <!--begin-->
2131
- <?php if ($fields[10]['value'] == 'street'): ?>
2132
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2133
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2134
- <span class="required">*</span>
2135
- <?php endif ?>
2136
- </label><br />
2137
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo 'required-entry'; ?> input-text"/>
2138
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2139
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2140
- <?php endfor ?>
2141
- <?php elseif ($fields[10]['value'] == 'country'): ?>
2142
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2143
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2144
- <span class="required">*</span>
2145
- <?php endif ?>
2146
- </label><br />
2147
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2148
- <?php if (!$helper->getFieldRequire($fields[10]['value'])): ?>
2149
- <script type="text/javascript">
2150
- if ($('billing:country_id'))
2151
- $('billing:country_id').removeClassName('validate-select');
2152
- </script>
2153
- <?php endif ?>
2154
- <?php elseif ($fields[10]['value'] == 'region'): ?>
2155
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2156
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2157
- <span class="required">*</span>
2158
- <?php endif ?>
2159
- </label><br/>
2160
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2161
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
2162
- </select>
2163
- <?php if (!$helper->enableGeoip()): ?>
2164
- <script type="text/javascript">
2165
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
2166
- </script>
2167
- <?php endif; ?>
2168
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
2169
- <?php if (!$helper->getFieldRequire($fields[10]['value'])): ?>
2170
- <script type="text/javascript">
2171
- if ($('billing:region_id'))
2172
- $('billing:region_id').removeClassName('validate-select');
2173
- </script>
2174
- <?php endif ?>
2175
- <?php elseif ($fields[10]['value'] == 'prefix'): ?>
2176
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2177
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
2178
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2179
- <span class="required">*</span>
2180
- <?php endif ?>
2181
- </label><br />
2182
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
2183
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[10]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2184
- <?php else: ?>
2185
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2186
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
2187
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2188
- <?php endforeach ?>
2189
- </select>
2190
- <?php endif; ?>
2191
- <?php elseif ($fields[10]['value'] == 'suffix'): ?>
2192
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2193
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
2194
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2195
- <span class="required">*</span>
2196
- <?php endif ?>
2197
- </label><br />
2198
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
2199
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[10]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2200
- <?php else: ?>
2201
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2202
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
2203
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2204
- <?php endforeach ?>
2205
- </select>
2206
- <?php endif; ?>
2207
- <?php elseif ($fields[10]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
2208
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
2209
- <?php elseif ($fields[10]['value'] == 'gender'): ?>
2210
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
2211
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
2212
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2213
- <span class="required">*</span>
2214
- <?php endif ?>
2215
- </label><br />
2216
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2217
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2218
- <?php $value = $_gender->getGender(); ?>
2219
- <?php foreach ($options as $option): ?>
2220
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2221
- <?php endforeach; ?>
2222
- </select>
2223
- <?php else: ?>
2224
- <label for="billing:<?php echo $fields[10]['value'] ?>"><?php echo $helper->getFieldLabel($fields[10]['value']); ?>
2225
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2226
- <span class="required">*</span>
2227
- <?php endif; ?>
2228
- </label><br>
2229
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[10]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[10]['value']); ?>" value="" name="billing[<?php echo $fields[10]['value'] ?>]" id="billing:<?php echo $fields[10]['value'] ?>">
2230
- <?php endif ?>
2231
- <!-- end -->
2232
- <?php else: ?>
2233
- <?php if ($fields[11]['value'] == 'street'): ?>
2234
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2235
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2236
- <span class="required">*</span>
2237
- <?php endif ?>
2238
- </label><br />
2239
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
2240
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2241
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2242
- <?php endfor ?>
2243
- <?php elseif ($fields[11]['value'] == 'country'): ?>
2244
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2245
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2246
- <span class="required">*</span>
2247
- <?php endif ?>
2248
- </label><br />
2249
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2250
- <?php if (!$helper->getFieldRequire($fields[11]['value'])): ?>
2251
- <script type="text/javascript">
2252
- if ($('billing:country_id'))
2253
- $('billing:country_id').removeClassName('validate-select');
2254
- </script>
2255
- <?php endif ?>
2256
- <?php elseif ($fields[11]['value'] == 'region'): ?>
2257
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2258
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2259
- <span class="required">*</span>
2260
- <?php endif ?>
2261
- </label><br/>
2262
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2263
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
2264
- </select>
2265
- <?php if (!$helper->enableGeoip()): ?>
2266
- <script type="text/javascript">
2267
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
2268
- </script>
2269
- <?php endif; ?>
2270
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
2271
- <?php if (!$helper->getFieldRequire($fields[11]['value'])): ?>
2272
- <script type="text/javascript">
2273
- if ($('billing:region_id'))
2274
- $('billing:region_id').removeClassName('validate-select');
2275
- </script>
2276
- <?php endif ?>
2277
- <?php elseif ($fields[11]['value'] == 'prefix'): ?>
2278
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2279
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
2280
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2281
- <span class="required">*</span>
2282
- <?php endif ?>
2283
- </label><br />
2284
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
2285
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[11]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2286
- <?php else: ?>
2287
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2288
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
2289
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2290
- <?php endforeach ?>
2291
- </select>
2292
- <?php endif; ?>
2293
- <?php elseif ($fields[11]['value'] == 'suffix'): ?>
2294
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2295
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
2296
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2297
- <span class="required">*</span>
2298
- <?php endif ?>
2299
- </label><br />
2300
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
2301
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[11]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2302
- <?php else: ?>
2303
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2304
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
2305
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2306
- <?php endforeach ?>
2307
- </select>
2308
- <?php endif; ?>
2309
- <?php elseif ($fields[11]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
2310
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
2311
- <?php elseif ($fields[11]['value'] == 'gender'): ?>
2312
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
2313
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
2314
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2315
- <span class="required">*</span>
2316
- <?php endif ?>
2317
- </label><br />
2318
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2319
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2320
- <?php $value = $_gender->getGender(); ?>
2321
- <?php foreach ($options as $option): ?>
2322
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2323
- <?php endforeach; ?>
2324
- </select>
2325
- <?php else: ?>
2326
- <label for="billing:<?php echo $fields[11]['value'] ?>"><?php echo $helper->getFieldLabel($fields[11]['value']); ?>
2327
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2328
- <span class="required">*</span>
2329
- <?php endif; ?>
2330
- </label><br>
2331
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[11]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[11]['value']); ?>" value="" name="billing[<?php echo $fields[11]['value'] ?>]" id="billing:<?php echo $fields[11]['value'] ?>">
2332
- <?php endif; ?>
2333
- <?php endif; ?>
2334
- </div>
2335
- <?php else: ?>
2336
- <div class="two-fields">
2337
- <?php if ($fields[10]['value'] == 'street'): ?>
2338
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2339
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
2340
- <span class="required">*</span>
2341
- <?php endif ?>
2342
- </label><br />
2343
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
2344
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2345
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2346
- <?php endfor ?>
2347
- <?php elseif ($fields[10]['value'] == 'country'): ?>
2348
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2349
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2350
- <span class="required">*</span>
2351
- <?php endif ?>
2352
- </label><br />
2353
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2354
- <?php if (!$helper->getFieldRequire($fields[10]['value'])): ?>
2355
- <script type="text/javascript">
2356
- if ($('billing:country_id'))
2357
- $('billing:country_id').removeClassName('validate-select');
2358
- </script>
2359
- <?php endif ?>
2360
- <?php elseif ($fields[10]['value'] == 'region'): ?>
2361
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2362
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2363
- <span class="required">*</span>
2364
- <?php endif ?>
2365
- </label><br/>
2366
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2367
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
2368
- </select>
2369
- <?php if (!$helper->enableGeoip()): ?>
2370
- <script type="text/javascript">
2371
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
2372
- </script>
2373
- <?php endif; ?>
2374
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
2375
- <?php if (!$helper->getFieldRequire($fields[10]['value'])): ?>
2376
- <script type="text/javascript">
2377
- if ($('billing:region_id'))
2378
- $('billing:region_id').removeClassName('validate-select');
2379
- </script>
2380
- <?php endif ?>
2381
- <?php elseif ($fields[10]['value'] == 'prefix'): ?>
2382
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2383
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
2384
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2385
- <span class="required">*</span>
2386
- <?php endif ?>
2387
- </label><br />
2388
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
2389
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[10]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2390
- <?php else: ?>
2391
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2392
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
2393
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2394
- <?php endforeach ?>
2395
- </select>
2396
- <?php endif; ?>
2397
- <?php elseif ($fields[10]['value'] == 'suffix'): ?>
2398
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2399
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
2400
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2401
- <span class="required">*</span>
2402
- <?php endif ?>
2403
- </label><br />
2404
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
2405
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[10]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2406
- <?php else: ?>
2407
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2408
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
2409
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2410
- <?php endforeach ?>
2411
- </select>
2412
- <?php endif; ?>
2413
- <?php elseif ($fields[10]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
2414
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
2415
- <?php elseif ($fields[10]['value'] == 'gender'): ?>
2416
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
2417
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
2418
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2419
- <span class="required">*</span>
2420
- <?php endif ?>
2421
- </label><br />
2422
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[10]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2423
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2424
- <?php $value = $_gender->getGender(); ?>
2425
- <?php foreach ($options as $option): ?>
2426
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2427
- <?php endforeach; ?>
2428
- </select>
2429
- <?php else: ?>
2430
- <label for="billing:<?php echo $fields[10]['value'] ?>"><?php echo $helper->getFieldLabel($fields[10]['value']); ?>
2431
- <?php if ($helper->getFieldRequire($fields[10]['value'])): ?>
2432
- <span class="required">*</span>
2433
- <?php endif; ?>
2434
- </label><br>
2435
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[10]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[10]['value']); ?>" value="" name="billing[<?php echo $fields[10]['value'] ?>]" id="billing:<?php echo $fields[10]['value'] ?>">
2436
- <?php endif; ?>
2437
- </div>
2438
- <div class="two-fields">
2439
- <?php if ($fields[11]['value'] == 'street'): ?>
2440
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2441
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
2442
- <span class="required">*</span>
2443
- <?php endif ?>
2444
- </label><br />
2445
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
2446
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2447
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2448
- <?php endfor ?>
2449
- <?php elseif ($fields[11]['value'] == 'country'): ?>
2450
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2451
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2452
- <span class="required">*</span>
2453
- <?php endif ?>
2454
- </label><br />
2455
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2456
- <?php if (!$helper->getFieldRequire($fields[11]['value'])): ?>
2457
- <script type="text/javascript">
2458
- if ($('billing:country_id'))
2459
- $('billing:country_id').removeClassName('validate-select');
2460
- </script>
2461
- <?php endif ?>
2462
- <?php elseif ($fields[11]['value'] == 'region'): ?>
2463
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2464
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2465
- <span class="required">*</span>
2466
- <?php endif ?>
2467
- </label><br/>
2468
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2469
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
2470
- </select>
2471
- <?php if (!$helper->enableGeoip()): ?>
2472
- <script type="text/javascript">
2473
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
2474
- </script>
2475
- <?php endif; ?>
2476
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
2477
- <?php if (!$helper->getFieldRequire($fields[11]['value'])): ?>
2478
- <script type="text/javascript">
2479
- if ($('billing:region_id'))
2480
- $('billing:region_id').removeClassName('validate-select');
2481
- </script>
2482
- <?php endif ?>
2483
- <?php elseif ($fields[11]['value'] == 'prefix'): ?>
2484
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2485
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
2486
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2487
- <span class="required">*</span>
2488
- <?php endif ?>
2489
- </label><br />
2490
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
2491
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[11]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2492
- <?php else: ?>
2493
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2494
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
2495
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2496
- <?php endforeach ?>
2497
- </select>
2498
- <?php endif; ?>
2499
- <?php elseif ($fields[11]['value'] == 'suffix'): ?>
2500
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2501
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
2502
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2503
- <span class="required">*</span>
2504
- <?php endif ?>
2505
- </label><br />
2506
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
2507
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[11]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2508
- <?php else: ?>
2509
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2510
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
2511
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2512
- <?php endforeach ?>
2513
- </select>
2514
- <?php endif; ?>
2515
- <?php elseif ($fields[11]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
2516
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
2517
- <?php elseif ($fields[11]['value'] == 'gender'): ?>
2518
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
2519
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
2520
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2521
- <span class="required">*</span>
2522
- <?php endif ?>
2523
- </label><br />
2524
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[11]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2525
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2526
- <?php $value = $_gender->getGender(); ?>
2527
- <?php foreach ($options as $option): ?>
2528
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2529
- <?php endforeach; ?>
2530
- </select>
2531
- <?php else: ?>
2532
- <label for="billing:<?php echo $fields[11]['value'] ?>"><?php echo $helper->getFieldLabel($fields[11]['value']); ?>
2533
- <?php if ($helper->getFieldRequire($fields[11]['value'])): ?>
2534
- <span class="required">*</span>
2535
- <?php endif; ?>
2536
- </label><br>
2537
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[11]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[11]['value']); ?>" value="" name="billing[<?php echo $fields[11]['value'] ?>]" id="billing:<?php echo $fields[11]['value'] ?>">
2538
- <?php endif; ?>
2539
- </div>
2540
- <?php endif; ?>
2541
- <?php endif; ?>
2542
- </li>
2543
- <li>
2544
- <?php if ($fields[12]['value'] != '0' || $fields[13]['value'] != '0'): ?>
2545
- <?php if ($fields[12]['value'] == '0' || $fields[13]['value'] == '0'): ?>
2546
- <div class="one-field">
2547
- <div class="one-field">
2548
- <?php if ($fields[12]['value'] != '0'): ?>
2549
- <!--begin-->
2550
- <?php if ($fields[12]['value'] == 'street'): ?>
2551
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2552
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2553
- <span class="required">*</span>
2554
- <?php endif ?>
2555
- </label><br />
2556
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo 'required-entry'; ?> input-text"/>
2557
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2558
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2559
- <?php endfor ?>
2560
- <?php elseif ($fields[12]['value'] == 'country'): ?>
2561
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2562
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2563
- <span class="required">*</span>
2564
- <?php endif ?>
2565
- </label><br />
2566
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2567
- <?php if (!$helper->getFieldRequire($fields[12]['value'])): ?>
2568
- <script type="text/javascript">
2569
- if ($('billing:country_id'))
2570
- $('billing:country_id').removeClassName('validate-select');
2571
- </script>
2572
- <?php endif ?>
2573
- <?php elseif ($fields[12]['value'] == 'region'): ?>
2574
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2575
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2576
- <span class="required">*</span>
2577
- <?php endif ?>
2578
- </label><br/>
2579
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2580
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
2581
- </select>
2582
- <?php if (!$helper->enableGeoip()): ?>
2583
- <script type="text/javascript">
2584
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
2585
- </script>
2586
- <?php endif; ?>
2587
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
2588
- <?php if (!$helper->getFieldRequire($fields[12]['value'])): ?>
2589
- <script type="text/javascript">
2590
- if ($('billing:region_id'))
2591
- $('billing:region_id').removeClassName('validate-select');
2592
- </script>
2593
- <?php endif ?>
2594
- <?php elseif ($fields[12]['value'] == 'prefix'): ?>
2595
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2596
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
2597
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2598
- <span class="required">*</span>
2599
- <?php endif ?>
2600
- </label><br />
2601
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
2602
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[12]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2603
- <?php else: ?>
2604
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2605
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
2606
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2607
- <?php endforeach ?>
2608
- </select>
2609
- <?php endif; ?>
2610
- <?php elseif ($fields[12]['value'] == 'suffix'): ?>
2611
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2612
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
2613
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2614
- <span class="required">*</span>
2615
- <?php endif ?>
2616
- </label><br />
2617
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
2618
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[12]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2619
- <?php else: ?>
2620
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2621
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
2622
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2623
- <?php endforeach ?>
2624
- </select>
2625
- <?php endif; ?>
2626
- <?php elseif ($fields[12]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
2627
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
2628
- <?php elseif ($fields[12]['value'] == 'gender'): ?>
2629
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
2630
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
2631
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2632
- <span class="required">*</span>
2633
- <?php endif ?>
2634
- </label><br />
2635
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2636
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2637
- <?php $value = $_gender->getGender(); ?>
2638
- <?php foreach ($options as $option): ?>
2639
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2640
- <?php endforeach; ?>
2641
- </select>
2642
- <?php else: ?>
2643
- <label for="billing:<?php echo $fields[12]['value'] ?>"><?php echo $helper->getFieldLabel($fields[12]['value']); ?>
2644
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2645
- <span class="required">*</span>
2646
- <?php endif; ?>
2647
- </label><br>
2648
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[12]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[12]['value']); ?>" value="" name="billing[<?php echo $fields[12]['value'] ?>]" id="billing:<?php echo $fields[12]['value'] ?>">
2649
- <?php endif ?>
2650
- <!-- end -->
2651
- <?php else: ?>
2652
- <?php if ($fields[13]['value'] == 'street'): ?>
2653
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2654
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2655
- <span class="required">*</span>
2656
- <?php endif ?>
2657
- </label><br />
2658
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
2659
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2660
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2661
- <?php endfor ?>
2662
- <?php elseif ($fields[13]['value'] == 'country'): ?>
2663
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2664
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2665
- <span class="required">*</span>
2666
- <?php endif ?>
2667
- </label><br />
2668
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2669
- <?php if (!$helper->getFieldRequire($fields[13]['value'])): ?>
2670
- <script type="text/javascript">
2671
- if ($('billing:country_id'))
2672
- $('billing:country_id').removeClassName('validate-select');
2673
- </script>
2674
- <?php endif ?>
2675
- <?php elseif ($fields[13]['value'] == 'region'): ?>
2676
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2677
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2678
- <span class="required">*</span>
2679
- <?php endif ?>
2680
- </label><br/>
2681
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2682
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
2683
- </select>
2684
- <?php if (!$helper->enableGeoip()): ?>
2685
- <script type="text/javascript">
2686
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
2687
- </script>
2688
- <?php endif; ?>
2689
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
2690
- <?php if (!$helper->getFieldRequire($fields[13]['value'])): ?>
2691
- <script type="text/javascript">
2692
- if ($('billing:region_id'))
2693
- $('billing:region_id').removeClassName('validate-select');
2694
- </script>
2695
- <?php endif ?>
2696
- <?php elseif ($fields[13]['value'] == 'prefix'): ?>
2697
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2698
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
2699
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2700
- <span class="required">*</span>
2701
- <?php endif ?>
2702
- </label><br />
2703
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
2704
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[13]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2705
- <?php else: ?>
2706
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2707
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
2708
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2709
- <?php endforeach ?>
2710
- </select>
2711
- <?php endif; ?>
2712
- <?php elseif ($fields[13]['value'] == 'suffix'): ?>
2713
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2714
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
2715
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2716
- <span class="required">*</span>
2717
- <?php endif ?>
2718
- </label><br />
2719
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
2720
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[13]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2721
- <?php else: ?>
2722
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2723
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
2724
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2725
- <?php endforeach ?>
2726
- </select>
2727
- <?php endif; ?>
2728
- <?php elseif ($fields[13]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
2729
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
2730
- <?php elseif ($fields[13]['value'] == 'gender'): ?>
2731
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
2732
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
2733
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2734
- <span class="required">*</span>
2735
- <?php endif ?>
2736
- </label><br />
2737
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2738
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2739
- <?php $value = $_gender->getGender(); ?>
2740
- <?php foreach ($options as $option): ?>
2741
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2742
- <?php endforeach; ?>
2743
- </select>
2744
- <?php else: ?>
2745
- <label for="billing:<?php echo $fields[13]['value'] ?>"><?php echo $helper->getFieldLabel($fields[13]['value']); ?>
2746
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2747
- <span class="required">*</span>
2748
- <?php endif; ?>
2749
- </label><br>
2750
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[13]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[13]['value']); ?>" value="" name="billing[<?php echo $fields[13]['value'] ?>]" id="billing:<?php echo $fields[13]['value'] ?>">
2751
- <?php endif; ?>
2752
- <?php endif; ?>
2753
- </div>
2754
- <?php else: ?>
2755
- <div class="two-fields">
2756
- <?php if ($fields[12]['value'] == 'street'): ?>
2757
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2758
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
2759
- <span class="required">*</span>
2760
- <?php endif ?>
2761
- </label><br />
2762
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
2763
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2764
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2765
- <?php endfor ?>
2766
- <?php elseif ($fields[12]['value'] == 'country'): ?>
2767
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2768
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2769
- <span class="required">*</span>
2770
- <?php endif ?>
2771
- </label><br />
2772
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2773
- <?php if (!$helper->getFieldRequire($fields[12]['value'])): ?>
2774
- <script type="text/javascript">
2775
- if ($('billing:country_id'))
2776
- $('billing:country_id').removeClassName('validate-select');
2777
- </script>
2778
- <?php endif ?>
2779
- <?php elseif ($fields[12]['value'] == 'region'): ?>
2780
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2781
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2782
- <span class="required">*</span>
2783
- <?php endif ?>
2784
- </label><br/>
2785
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2786
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
2787
- </select>
2788
- <?php if (!$helper->enableGeoip()): ?>
2789
- <script type="text/javascript">
2790
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
2791
- </script>
2792
- <?php endif; ?>
2793
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
2794
- <?php if (!$helper->getFieldRequire($fields[12]['value'])): ?>
2795
- <script type="text/javascript">
2796
- if ($('billing:region_id'))
2797
- $('billing:region_id').removeClassName('validate-select');
2798
- </script>
2799
- <?php endif ?>
2800
- <?php elseif ($fields[12]['value'] == 'prefix'): ?>
2801
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2802
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
2803
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2804
- <span class="required">*</span>
2805
- <?php endif ?>
2806
- </label><br />
2807
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
2808
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[12]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2809
- <?php else: ?>
2810
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2811
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
2812
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2813
- <?php endforeach ?>
2814
- </select>
2815
- <?php endif; ?>
2816
- <?php elseif ($fields[12]['value'] == 'suffix'): ?>
2817
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2818
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
2819
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2820
- <span class="required">*</span>
2821
- <?php endif ?>
2822
- </label><br />
2823
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
2824
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[12]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2825
- <?php else: ?>
2826
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2827
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
2828
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2829
- <?php endforeach ?>
2830
- </select>
2831
- <?php endif; ?>
2832
- <?php elseif ($fields[12]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
2833
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
2834
- <?php elseif ($fields[12]['value'] == 'gender'): ?>
2835
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
2836
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
2837
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2838
- <span class="required">*</span>
2839
- <?php endif ?>
2840
- </label><br />
2841
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[12]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2842
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2843
- <?php $value = $_gender->getGender(); ?>
2844
- <?php foreach ($options as $option): ?>
2845
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2846
- <?php endforeach; ?>
2847
- </select>
2848
- <?php else: ?>
2849
- <label for="billing:<?php echo $fields[12]['value'] ?>"><?php echo $helper->getFieldLabel($fields[12]['value']); ?>
2850
- <?php if ($helper->getFieldRequire($fields[12]['value'])): ?>
2851
- <span class="required">*</span>
2852
- <?php endif; ?>
2853
- </label><br>
2854
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[12]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[12]['value']); ?>" value="" name="billing[<?php echo $fields[12]['value'] ?>]" id="billing:<?php echo $fields[12]['value'] ?>">
2855
- <?php endif; ?>
2856
- </div>
2857
- <div class="two-fields">
2858
- <?php if ($fields[13]['value'] == 'street'): ?>
2859
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2860
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
2861
- <span class="required">*</span>
2862
- <?php endif ?>
2863
- </label><br />
2864
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
2865
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2866
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2867
- <?php endfor ?>
2868
- <?php elseif ($fields[13]['value'] == 'country'): ?>
2869
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2870
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2871
- <span class="required">*</span>
2872
- <?php endif ?>
2873
- </label><br />
2874
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2875
- <?php if (!$helper->getFieldRequire($fields[13]['value'])): ?>
2876
- <script type="text/javascript">
2877
- if ($('billing:country_id'))
2878
- $('billing:country_id').removeClassName('validate-select');
2879
- </script>
2880
- <?php endif ?>
2881
- <?php elseif ($fields[13]['value'] == 'region'): ?>
2882
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2883
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2884
- <span class="required">*</span>
2885
- <?php endif ?>
2886
- </label><br/>
2887
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2888
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
2889
- </select>
2890
- <?php if (!$helper->enableGeoip()): ?>
2891
- <script type="text/javascript">
2892
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
2893
- </script>
2894
- <?php endif; ?>
2895
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
2896
- <?php if (!$helper->getFieldRequire($fields[13]['value'])): ?>
2897
- <script type="text/javascript">
2898
- if ($('billing:region_id'))
2899
- $('billing:region_id').removeClassName('validate-select');
2900
- </script>
2901
- <?php endif ?>
2902
- <?php elseif ($fields[13]['value'] == 'prefix'): ?>
2903
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2904
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
2905
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2906
- <span class="required">*</span>
2907
- <?php endif ?>
2908
- </label><br />
2909
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
2910
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[13]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2911
- <?php else: ?>
2912
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2913
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
2914
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2915
- <?php endforeach ?>
2916
- </select>
2917
- <?php endif; ?>
2918
- <?php elseif ($fields[13]['value'] == 'suffix'): ?>
2919
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
2920
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
2921
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2922
- <span class="required">*</span>
2923
- <?php endif ?>
2924
- </label><br />
2925
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
2926
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[13]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
2927
- <?php else: ?>
2928
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
2929
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
2930
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
2931
- <?php endforeach ?>
2932
- </select>
2933
- <?php endif; ?>
2934
- <?php elseif ($fields[13]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
2935
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
2936
- <?php elseif ($fields[13]['value'] == 'gender'): ?>
2937
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
2938
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
2939
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2940
- <span class="required">*</span>
2941
- <?php endif ?>
2942
- </label><br />
2943
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[13]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
2944
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
2945
- <?php $value = $_gender->getGender(); ?>
2946
- <?php foreach ($options as $option): ?>
2947
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
2948
- <?php endforeach; ?>
2949
- </select>
2950
- <?php else: ?>
2951
- <label for="billing:<?php echo $fields[13]['value'] ?>"><?php echo $helper->getFieldLabel($fields[13]['value']); ?>
2952
- <?php if ($helper->getFieldRequire($fields[13]['value'])): ?>
2953
- <span class="required">*</span>
2954
- <?php endif; ?>
2955
- </label><br>
2956
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[13]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[13]['value']); ?>" value="" name="billing[<?php echo $fields[13]['value'] ?>]" id="billing:<?php echo $fields[13]['value'] ?>">
2957
- <?php endif; ?>
2958
- </div>
2959
- <?php endif; ?>
2960
- <?php endif; ?>
2961
- </li>
2962
- <li>
2963
- <?php if ($fields[14]['value'] != '0' || $fields[15]['value'] != '0'): ?>
2964
- <?php if ($fields[14]['value'] == '0' || $fields[15]['value'] == '0'): ?>
2965
- <div class="one-field">
2966
- <div class="one-field">
2967
- <?php if ($fields[14]['value'] != '0'): ?>
2968
- <!--begin-->
2969
- <?php if ($fields[14]['value'] == 'street'): ?>
2970
- <label for="billing:street1"><?php echo $this->__('Address') ?>
2971
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
2972
- <span class="required">*</span>
2973
- <?php endif ?>
2974
- </label><br />
2975
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo 'required-entry'; ?> input-text"/>
2976
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
2977
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
2978
- <?php endfor ?>
2979
- <?php elseif ($fields[14]['value'] == 'country'): ?>
2980
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
2981
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
2982
- <span class="required">*</span>
2983
- <?php endif ?>
2984
- </label><br />
2985
- <?php echo $this->getCountryHtmlSelect('billing') ?>
2986
- <?php if (!$helper->getFieldRequire($fields[14]['value'])): ?>
2987
- <script type="text/javascript">
2988
- if ($('billing:country_id'))
2989
- $('billing:country_id').removeClassName('validate-select');
2990
- </script>
2991
- <?php endif ?>
2992
- <?php elseif ($fields[14]['value'] == 'region'): ?>
2993
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
2994
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
2995
- <span class="required">*</span>
2996
- <?php endif ?>
2997
- </label><br/>
2998
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
2999
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3000
- </select>
3001
- <?php if (!$helper->enableGeoip()): ?>
3002
- <script type="text/javascript">
3003
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3004
- </script>
3005
- <?php endif; ?>
3006
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3007
- <?php if (!$helper->getFieldRequire($fields[14]['value'])): ?>
3008
- <script type="text/javascript">
3009
- if ($('billing:region_id'))
3010
- $('billing:region_id').removeClassName('validate-select');
3011
- </script>
3012
- <?php endif ?>
3013
- <?php elseif ($fields[14]['value'] == 'prefix'): ?>
3014
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3015
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3016
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3017
- <span class="required">*</span>
3018
- <?php endif ?>
3019
- </label><br />
3020
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3021
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[14]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3022
- <?php else: ?>
3023
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3024
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3025
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3026
- <?php endforeach ?>
3027
- </select>
3028
- <?php endif; ?>
3029
- <?php elseif ($fields[14]['value'] == 'suffix'): ?>
3030
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3031
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3032
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3033
- <span class="required">*</span>
3034
- <?php endif ?>
3035
- </label><br />
3036
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3037
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[14]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3038
- <?php else: ?>
3039
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3040
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3041
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3042
- <?php endforeach ?>
3043
- </select>
3044
- <?php endif; ?>
3045
- <?php elseif ($fields[14]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3046
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3047
- <?php elseif ($fields[14]['value'] == 'gender'): ?>
3048
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3049
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3050
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3051
- <span class="required">*</span>
3052
- <?php endif ?>
3053
- </label><br />
3054
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3055
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3056
- <?php $value = $_gender->getGender(); ?>
3057
- <?php foreach ($options as $option): ?>
3058
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3059
- <?php endforeach; ?>
3060
- </select>
3061
- <?php else: ?>
3062
- <label for="billing:<?php echo $fields[14]['value'] ?>"><?php echo $helper->getFieldLabel($fields[14]['value']); ?>
3063
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3064
- <span class="required">*</span>
3065
- <?php endif; ?>
3066
- </label><br>
3067
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[14]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[14]['value']); ?>" value="" name="billing[<?php echo $fields[14]['value'] ?>]" id="billing:<?php echo $fields[14]['value'] ?>">
3068
- <?php endif ?>
3069
- <!-- end -->
3070
- <?php else: ?>
3071
- <?php if ($fields[15]['value'] == 'street'): ?>
3072
- <label for="billing:street1"><?php echo $this->__('Address') ?>
3073
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3074
- <span class="required">*</span>
3075
- <?php endif ?>
3076
- </label><br />
3077
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
3078
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
3079
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
3080
- <?php endfor ?>
3081
- <?php elseif ($fields[15]['value'] == 'country'): ?>
3082
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
3083
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3084
- <span class="required">*</span>
3085
- <?php endif ?>
3086
- </label><br />
3087
- <?php echo $this->getCountryHtmlSelect('billing') ?>
3088
- <?php if (!$helper->getFieldRequire($fields[15]['value'])): ?>
3089
- <script type="text/javascript">
3090
- if ($('billing:country_id'))
3091
- $('billing:country_id').removeClassName('validate-select');
3092
- </script>
3093
- <?php endif ?>
3094
- <?php elseif ($fields[15]['value'] == 'region'): ?>
3095
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
3096
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3097
- <span class="required">*</span>
3098
- <?php endif ?>
3099
- </label><br/>
3100
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
3101
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3102
- </select>
3103
- <?php if (!$helper->enableGeoip()): ?>
3104
- <script type="text/javascript">
3105
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3106
- </script>
3107
- <?php endif; ?>
3108
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3109
- <?php if (!$helper->getFieldRequire($fields[15]['value'])): ?>
3110
- <script type="text/javascript">
3111
- if ($('billing:region_id'))
3112
- $('billing:region_id').removeClassName('validate-select');
3113
- </script>
3114
- <?php endif ?>
3115
- <?php elseif ($fields[15]['value'] == 'prefix'): ?>
3116
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3117
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3118
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3119
- <span class="required">*</span>
3120
- <?php endif ?>
3121
- </label><br />
3122
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3123
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[15]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3124
- <?php else: ?>
3125
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3126
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3127
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3128
- <?php endforeach ?>
3129
- </select>
3130
- <?php endif; ?>
3131
- <?php elseif ($fields[15]['value'] == 'suffix'): ?>
3132
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3133
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3134
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3135
- <span class="required">*</span>
3136
- <?php endif ?>
3137
- </label><br />
3138
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3139
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[15]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3140
- <?php else: ?>
3141
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3142
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3143
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3144
- <?php endforeach ?>
3145
- </select>
3146
- <?php endif; ?>
3147
- <?php elseif ($fields[15]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3148
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3149
- <?php elseif ($fields[15]['value'] == 'gender'): ?>
3150
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3151
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3152
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3153
- <span class="required">*</span>
3154
- <?php endif ?>
3155
- </label><br />
3156
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3157
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3158
- <?php $value = $_gender->getGender(); ?>
3159
- <?php foreach ($options as $option): ?>
3160
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3161
- <?php endforeach; ?>
3162
- </select>
3163
- <?php else: ?>
3164
- <label for="billing:<?php echo $fields[15]['value'] ?>"><?php echo $helper->getFieldLabel($fields[15]['value']); ?>
3165
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3166
- <span class="required">*</span>
3167
- <?php endif; ?>
3168
- </label><br>
3169
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[15]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[15]['value']); ?>" value="" name="billing[<?php echo $fields[15]['value'] ?>]" id="billing:<?php echo $fields[15]['value'] ?>">
3170
- <?php endif; ?>
3171
- <?php endif; ?>
3172
- </div>
3173
- <?php else: ?>
3174
- <div class="two-fields">
3175
- <?php if ($fields[14]['value'] == 'street'): ?>
3176
- <label for="billing:street1"><?php echo $this->__('Address') ?>
3177
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
3178
- <span class="required">*</span>
3179
- <?php endif ?>
3180
- </label><br />
3181
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
3182
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
3183
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
3184
- <?php endfor ?>
3185
- <?php elseif ($fields[14]['value'] == 'country'): ?>
3186
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
3187
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3188
- <span class="required">*</span>
3189
- <?php endif ?>
3190
- </label><br />
3191
- <?php echo $this->getCountryHtmlSelect('billing') ?>
3192
- <?php if (!$helper->getFieldRequire($fields[14]['value'])): ?>
3193
- <script type="text/javascript">
3194
- if ($('billing:country_id'))
3195
- $('billing:country_id').removeClassName('validate-select');
3196
- </script>
3197
- <?php endif ?>
3198
- <?php elseif ($fields[14]['value'] == 'region'): ?>
3199
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
3200
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3201
- <span class="required">*</span>
3202
- <?php endif ?>
3203
- </label><br/>
3204
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
3205
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3206
- </select>
3207
- <?php if (!$helper->enableGeoip()): ?>
3208
- <script type="text/javascript">
3209
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3210
- </script>
3211
- <?php endif; ?>
3212
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3213
- <?php if (!$helper->getFieldRequire($fields[14]['value'])): ?>
3214
- <script type="text/javascript">
3215
- if ($('billing:region_id'))
3216
- $('billing:region_id').removeClassName('validate-select');
3217
- </script>
3218
- <?php endif ?>
3219
- <?php elseif ($fields[14]['value'] == 'prefix'): ?>
3220
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3221
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3222
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3223
- <span class="required">*</span>
3224
- <?php endif ?>
3225
- </label><br />
3226
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3227
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[14]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3228
- <?php else: ?>
3229
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3230
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3231
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3232
- <?php endforeach ?>
3233
- </select>
3234
- <?php endif; ?>
3235
- <?php elseif ($fields[14]['value'] == 'suffix'): ?>
3236
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3237
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3238
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3239
- <span class="required">*</span>
3240
- <?php endif ?>
3241
- </label><br />
3242
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3243
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[14]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3244
- <?php else: ?>
3245
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3246
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3247
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3248
- <?php endforeach ?>
3249
- </select>
3250
- <?php endif; ?>
3251
- <?php elseif ($fields[14]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3252
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3253
- <?php elseif ($fields[14]['value'] == 'gender'): ?>
3254
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3255
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3256
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3257
- <span class="required">*</span>
3258
- <?php endif ?>
3259
- </label><br />
3260
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[14]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3261
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3262
- <?php $value = $_gender->getGender(); ?>
3263
- <?php foreach ($options as $option): ?>
3264
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3265
- <?php endforeach; ?>
3266
- </select>
3267
- <?php else: ?>
3268
- <label for="billing:<?php echo $fields[14]['value'] ?>"><?php echo $helper->getFieldLabel($fields[14]['value']); ?>
3269
- <?php if ($helper->getFieldRequire($fields[14]['value'])): ?>
3270
- <span class="required">*</span>
3271
- <?php endif; ?>
3272
- </label><br>
3273
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[14]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[14]['value']); ?>" value="" name="billing[<?php echo $fields[14]['value'] ?>]" id="billing:<?php echo $fields[14]['value'] ?>">
3274
- <?php endif; ?>
3275
- </div>
3276
- <div class="two-fields">
3277
- <?php if ($fields[15]['value'] == 'street'): ?>
3278
- <label for="billing:street1"><?php echo $this->__('Address') ?>
3279
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
3280
- <span class="required">*</span>
3281
- <?php endif ?>
3282
- </label><br />
3283
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
3284
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
3285
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
3286
- <?php endfor ?>
3287
- <?php elseif ($fields[15]['value'] == 'country'): ?>
3288
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
3289
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3290
- <span class="required">*</span>
3291
- <?php endif ?>
3292
- </label><br />
3293
- <?php echo $this->getCountryHtmlSelect('billing') ?>
3294
- <?php if (!$helper->getFieldRequire($fields[15]['value'])): ?>
3295
- <script type="text/javascript">
3296
- if ($('billing:country_id'))
3297
- $('billing:country_id').removeClassName('validate-select');
3298
- </script>
3299
- <?php endif ?>
3300
- <?php elseif ($fields[15]['value'] == 'region'): ?>
3301
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
3302
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3303
- <span class="required">*</span>
3304
- <?php endif ?>
3305
- </label><br/>
3306
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
3307
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3308
- </select>
3309
- <?php if (!$helper->enableGeoip()): ?>
3310
- <script type="text/javascript">
3311
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3312
- </script>
3313
- <?php endif; ?>
3314
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3315
- <?php if (!$helper->getFieldRequire($fields[15]['value'])): ?>
3316
- <script type="text/javascript">
3317
- if ($('billing:region_id'))
3318
- $('billing:region_id').removeClassName('validate-select');
3319
- </script>
3320
- <?php endif ?>
3321
- <?php elseif ($fields[15]['value'] == 'prefix'): ?>
3322
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3323
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3324
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3325
- <span class="required">*</span>
3326
- <?php endif ?>
3327
- </label><br />
3328
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3329
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[15]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3330
- <?php else: ?>
3331
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3332
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3333
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3334
- <?php endforeach ?>
3335
- </select>
3336
- <?php endif; ?>
3337
- <?php elseif ($fields[15]['value'] == 'suffix'): ?>
3338
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3339
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3340
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3341
- <span class="required">*</span>
3342
- <?php endif ?>
3343
- </label><br />
3344
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3345
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[15]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3346
- <?php else: ?>
3347
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3348
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3349
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3350
- <?php endforeach ?>
3351
- </select>
3352
- <?php endif; ?>
3353
- <?php elseif ($fields[15]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3354
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3355
- <?php elseif ($fields[15]['value'] == 'gender'): ?>
3356
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3357
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3358
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3359
- <span class="required">*</span>
3360
- <?php endif ?>
3361
- </label><br />
3362
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[15]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3363
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3364
- <?php $value = $_gender->getGender(); ?>
3365
- <?php foreach ($options as $option): ?>
3366
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3367
- <?php endforeach; ?>
3368
- </select>
3369
- <?php else: ?>
3370
- <label for="billing:<?php echo $fields[15]['value'] ?>"><?php echo $helper->getFieldLabel($fields[15]['value']); ?>
3371
- <?php if ($helper->getFieldRequire($fields[15]['value'])): ?>
3372
- <span class="required">*</span>
3373
- <?php endif; ?>
3374
- </label><br>
3375
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[15]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[15]['value']); ?>" value="" name="billing[<?php echo $fields[15]['value'] ?>]" id="billing:<?php echo $fields[15]['value'] ?>">
3376
- <?php endif; ?>
3377
- </div>
3378
- <?php endif; ?>
3379
- <?php endif; ?>
3380
- </li>
3381
- <li>
3382
- <?php if ($fields[16]['value'] != '0' || $fields[17]['value'] != '0'): ?>
3383
- <?php if ($fields[16]['value'] == '0' || $fields[17]['value'] == '0'): ?>
3384
- <div class="one-field">
3385
- <div class="one-field">
3386
- <?php if ($fields[16]['value'] != '0'): ?>
3387
- <!--begin-->
3388
- <?php if ($fields[16]['value'] == 'street'): ?>
3389
- <label for="billing:street1"><?php echo $this->__('Address') ?>
3390
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3391
- <span class="required">*</span>
3392
- <?php endif ?>
3393
- </label><br />
3394
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo 'required-entry'; ?> input-text"/>
3395
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
3396
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
3397
- <?php endfor ?>
3398
- <?php elseif ($fields[16]['value'] == 'country'): ?>
3399
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
3400
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3401
- <span class="required">*</span>
3402
- <?php endif ?>
3403
- </label><br />
3404
- <?php echo $this->getCountryHtmlSelect('billing') ?>
3405
- <?php if (!$helper->getFieldRequire($fields[16]['value'])): ?>
3406
- <script type="text/javascript">
3407
- if ($('billing:country_id'))
3408
- $('billing:country_id').removeClassName('validate-select');
3409
- </script>
3410
- <?php endif ?>
3411
- <?php elseif ($fields[16]['value'] == 'region'): ?>
3412
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
3413
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3414
- <span class="required">*</span>
3415
- <?php endif ?>
3416
- </label><br/>
3417
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
3418
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3419
- </select>
3420
- <?php if (!$helper->enableGeoip()): ?>
3421
- <script type="text/javascript">
3422
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3423
- </script>
3424
- <?php endif; ?>
3425
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3426
- <?php if (!$helper->getFieldRequire($fields[16]['value'])): ?>
3427
- <script type="text/javascript">
3428
- if ($('billing:region_id'))
3429
- $('billing:region_id').removeClassName('validate-select');
3430
- </script>
3431
- <?php endif ?>
3432
- <?php elseif ($fields[16]['value'] == 'prefix'): ?>
3433
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3434
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3435
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3436
- <span class="required">*</span>
3437
- <?php endif ?>
3438
- </label><br />
3439
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3440
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[16]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3441
- <?php else: ?>
3442
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3443
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3444
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3445
- <?php endforeach ?>
3446
- </select>
3447
- <?php endif; ?>
3448
- <?php elseif ($fields[16]['value'] == 'suffix'): ?>
3449
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3450
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3451
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3452
- <span class="required">*</span>
3453
- <?php endif ?>
3454
- </label><br />
3455
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3456
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[16]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3457
- <?php else: ?>
3458
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3459
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3460
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3461
- <?php endforeach ?>
3462
- </select>
3463
- <?php endif; ?>
3464
- <?php elseif ($fields[16]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3465
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3466
- <?php elseif ($fields[16]['value'] == 'gender'): ?>
3467
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3468
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3469
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3470
- <span class="required">*</span>
3471
- <?php endif ?>
3472
- </label><br />
3473
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3474
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3475
- <?php $value = $_gender->getGender(); ?>
3476
- <?php foreach ($options as $option): ?>
3477
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3478
- <?php endforeach; ?>
3479
- </select>
3480
- <?php else: ?>
3481
- <label for="billing:<?php echo $fields[16]['value'] ?>"><?php echo $helper->getFieldLabel($fields[16]['value']); ?>
3482
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3483
- <span class="required">*</span>
3484
- <?php endif; ?>
3485
- </label><br>
3486
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[16]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[16]['value']); ?>" value="" name="billing[<?php echo $fields[16]['value'] ?>]" id="billing:<?php echo $fields[16]['value'] ?>">
3487
- <?php endif ?>
3488
- <!-- end -->
3489
- <?php else: ?>
3490
- <?php if ($fields[17]['value'] == 'street'): ?>
3491
- <label for="billing:street1"><?php echo $this->__('Address') ?>
3492
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3493
- <span class="required">*</span>
3494
- <?php endif ?>
3495
- </label><br />
3496
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
3497
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
3498
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
3499
- <?php endfor ?>
3500
- <?php elseif ($fields[17]['value'] == 'country'): ?>
3501
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
3502
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3503
- <span class="required">*</span>
3504
- <?php endif ?>
3505
- </label><br />
3506
- <?php echo $this->getCountryHtmlSelect('billing') ?>
3507
- <?php if (!$helper->getFieldRequire($fields[17]['value'])): ?>
3508
- <script type="text/javascript">
3509
- if ($('billing:country_id'))
3510
- $('billing:country_id').removeClassName('validate-select');
3511
- </script>
3512
- <?php endif ?>
3513
- <?php elseif ($fields[17]['value'] == 'region'): ?>
3514
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
3515
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3516
- <span class="required">*</span>
3517
- <?php endif ?>
3518
- </label><br/>
3519
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
3520
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3521
- </select>
3522
- <?php if (!$helper->enableGeoip()): ?>
3523
- <script type="text/javascript">
3524
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3525
- </script>
3526
- <?php endif; ?>
3527
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3528
- <?php if (!$helper->getFieldRequire($fields[17]['value'])): ?>
3529
- <script type="text/javascript">
3530
- if ($('billing:region_id'))
3531
- $('billing:region_id').removeClassName('validate-select');
3532
- </script>
3533
- <?php endif ?>
3534
- <?php elseif ($fields[17]['value'] == 'prefix'): ?>
3535
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3536
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3537
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3538
- <span class="required">*</span>
3539
- <?php endif ?>
3540
- </label><br />
3541
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3542
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[17]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3543
- <?php else: ?>
3544
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3545
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3546
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3547
- <?php endforeach ?>
3548
- </select>
3549
- <?php endif; ?>
3550
- <?php elseif ($fields[17]['value'] == 'suffix'): ?>
3551
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3552
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3553
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3554
- <span class="required">*</span>
3555
- <?php endif ?>
3556
- </label><br />
3557
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3558
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[17]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3559
- <?php else: ?>
3560
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3561
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3562
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3563
- <?php endforeach ?>
3564
- </select>
3565
- <?php endif; ?>
3566
- <?php elseif ($fields[17]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3567
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3568
- <?php elseif ($fields[17]['value'] == 'gender'): ?>
3569
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3570
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3571
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3572
- <span class="required">*</span>
3573
- <?php endif ?>
3574
- </label><br />
3575
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3576
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3577
- <?php $value = $_gender->getGender(); ?>
3578
- <?php foreach ($options as $option): ?>
3579
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3580
- <?php endforeach; ?>
3581
- </select>
3582
- <?php else: ?>
3583
- <label for="billing:<?php echo $fields[17]['value'] ?>"><?php echo $helper->getFieldLabel($fields[17]['value']); ?>
3584
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3585
- <span class="required">*</span>
3586
- <?php endif; ?>
3587
- </label><br>
3588
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[17]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[17]['value']); ?>" value="" name="billing[<?php echo $fields[17]['value'] ?>]" id="billing:<?php echo $fields[17]['value'] ?>">
3589
- <?php endif; ?>
3590
- <?php endif; ?>
3591
- </div>
3592
- <?php else: ?>
3593
- <div class="two-fields">
3594
- <?php if ($fields[16]['value'] == 'street'): ?>
3595
- <label for="billing:street1"><?php echo $this->__('Address') ?>
3596
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
3597
- <span class="required">*</span>
3598
- <?php endif ?>
3599
- </label><br />
3600
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
3601
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
3602
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
3603
- <?php endfor ?>
3604
- <?php elseif ($fields[16]['value'] == 'country'): ?>
3605
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
3606
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3607
- <span class="required">*</span>
3608
- <?php endif ?>
3609
- </label><br />
3610
- <?php echo $this->getCountryHtmlSelect('billing') ?>
3611
- <?php if (!$helper->getFieldRequire($fields[16]['value'])): ?>
3612
- <script type="text/javascript">
3613
- if ($('billing:country_id'))
3614
- $('billing:country_id').removeClassName('validate-select');
3615
- </script>
3616
- <?php endif ?>
3617
- <?php elseif ($fields[16]['value'] == 'region'): ?>
3618
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
3619
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3620
- <span class="required">*</span>
3621
- <?php endif ?>
3622
- </label><br/>
3623
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
3624
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3625
- </select>
3626
- <?php if (!$helper->enableGeoip()): ?>
3627
- <script type="text/javascript">
3628
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3629
- </script>
3630
- <?php endif; ?>
3631
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3632
- <?php if (!$helper->getFieldRequire($fields[16]['value'])): ?>
3633
- <script type="text/javascript">
3634
- if ($('billing:region_id'))
3635
- $('billing:region_id').removeClassName('validate-select');
3636
- </script>
3637
- <?php endif ?>
3638
- <?php elseif ($fields[16]['value'] == 'prefix'): ?>
3639
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3640
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3641
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3642
- <span class="required">*</span>
3643
- <?php endif ?>
3644
- </label><br />
3645
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3646
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[16]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3647
- <?php else: ?>
3648
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3649
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3650
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3651
- <?php endforeach ?>
3652
- </select>
3653
- <?php endif; ?>
3654
- <?php elseif ($fields[16]['value'] == 'suffix'): ?>
3655
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3656
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3657
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3658
- <span class="required">*</span>
3659
- <?php endif ?>
3660
- </label><br />
3661
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3662
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[16]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3663
- <?php else: ?>
3664
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3665
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3666
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3667
- <?php endforeach ?>
3668
- </select>
3669
- <?php endif; ?>
3670
- <?php elseif ($fields[16]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3671
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3672
- <?php elseif ($fields[16]['value'] == 'gender'): ?>
3673
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3674
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3675
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3676
- <span class="required">*</span>
3677
- <?php endif ?>
3678
- </label><br />
3679
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[16]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3680
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3681
- <?php $value = $_gender->getGender(); ?>
3682
- <?php foreach ($options as $option): ?>
3683
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3684
- <?php endforeach; ?>
3685
- </select>
3686
- <?php else: ?>
3687
- <label for="billing:<?php echo $fields[16]['value'] ?>"><?php echo $helper->getFieldLabel($fields[16]['value']); ?>
3688
- <?php if ($helper->getFieldRequire($fields[16]['value'])): ?>
3689
- <span class="required">*</span>
3690
- <?php endif; ?>
3691
- </label><br>
3692
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[16]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[16]['value']); ?>" value="" name="billing[<?php echo $fields[16]['value'] ?>]" id="billing:<?php echo $fields[16]['value'] ?>">
3693
- <?php endif; ?>
3694
- </div>
3695
- <div class="two-fields">
3696
- <?php if ($fields[17]['value'] == 'street'): ?>
3697
- <label for="billing:street1"><?php echo $this->__('Address') ?>
3698
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
3699
- <span class="required">*</span>
3700
- <?php endif ?>
3701
- </label><br />
3702
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
3703
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
3704
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
3705
- <?php endfor ?>
3706
- <?php elseif ($fields[17]['value'] == 'country'): ?>
3707
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
3708
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3709
- <span class="required">*</span>
3710
- <?php endif ?>
3711
- </label><br />
3712
- <?php echo $this->getCountryHtmlSelect('billing') ?>
3713
- <?php if (!$helper->getFieldRequire($fields[17]['value'])): ?>
3714
- <script type="text/javascript">
3715
- if ($('billing:country_id'))
3716
- $('billing:country_id').removeClassName('validate-select');
3717
- </script>
3718
- <?php endif ?>
3719
- <?php elseif ($fields[17]['value'] == 'region'): ?>
3720
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
3721
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3722
- <span class="required">*</span>
3723
- <?php endif ?>
3724
- </label><br/>
3725
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
3726
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3727
- </select>
3728
- <?php if (!$helper->enableGeoip()): ?>
3729
- <script type="text/javascript">
3730
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3731
- </script>
3732
- <?php endif; ?>
3733
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3734
- <?php if (!$helper->getFieldRequire($fields[17]['value'])): ?>
3735
- <script type="text/javascript">
3736
- if ($('billing:region_id'))
3737
- $('billing:region_id').removeClassName('validate-select');
3738
- </script>
3739
- <?php endif ?>
3740
- <?php elseif ($fields[17]['value'] == 'prefix'): ?>
3741
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3742
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3743
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3744
- <span class="required">*</span>
3745
- <?php endif ?>
3746
- </label><br />
3747
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3748
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[17]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3749
- <?php else: ?>
3750
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3751
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3752
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3753
- <?php endforeach ?>
3754
- </select>
3755
- <?php endif; ?>
3756
- <?php elseif ($fields[17]['value'] == 'suffix'): ?>
3757
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3758
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3759
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3760
- <span class="required">*</span>
3761
- <?php endif ?>
3762
- </label><br />
3763
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3764
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[17]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3765
- <?php else: ?>
3766
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3767
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3768
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3769
- <?php endforeach ?>
3770
- </select>
3771
- <?php endif; ?>
3772
- <?php elseif ($fields[17]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3773
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3774
- <?php elseif ($fields[17]['value'] == 'gender'): ?>
3775
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3776
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3777
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3778
- <span class="required">*</span>
3779
- <?php endif ?>
3780
- </label><br />
3781
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[17]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3782
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3783
- <?php $value = $_gender->getGender(); ?>
3784
- <?php foreach ($options as $option): ?>
3785
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3786
- <?php endforeach; ?>
3787
- </select>
3788
- <?php else: ?>
3789
- <label for="billing:<?php echo $fields[17]['value'] ?>"><?php echo $helper->getFieldLabel($fields[17]['value']); ?>
3790
- <?php if ($helper->getFieldRequire($fields[17]['value'])): ?>
3791
- <span class="required">*</span>
3792
- <?php endif; ?>
3793
- </label><br>
3794
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[17]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[17]['value']); ?>" value="" name="billing[<?php echo $fields[17]['value'] ?>]" id="billing:<?php echo $fields[17]['value'] ?>">
3795
- <?php endif; ?>
3796
- </div>
3797
- <?php endif; ?>
3798
- <?php endif; ?>
3799
- </li>
3800
- <li>
3801
- <?php if ($fields[18]['value'] != '0' || $fields[19]['value'] != '0'): ?>
3802
- <?php if ($fields[18]['value'] == '0' || $fields[19]['value'] == '0'): ?>
3803
- <div class="one-field">
3804
- <div class="one-field">
3805
- <?php if ($fields[18]['value'] != '0'): ?>
3806
- <!--begin-->
3807
- <?php if ($fields[18]['value'] == 'street'): ?>
3808
- <label for="billing:street1"><?php echo $this->__('Address') ?>
3809
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
3810
- <span class="required">*</span>
3811
- <?php endif ?>
3812
- </label><br />
3813
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo 'required-entry'; ?> input-text"/>
3814
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
3815
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
3816
- <?php endfor ?>
3817
- <?php elseif ($fields[18]['value'] == 'country'): ?>
3818
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
3819
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
3820
- <span class="required">*</span>
3821
- <?php endif ?>
3822
- </label><br />
3823
- <?php echo $this->getCountryHtmlSelect('billing') ?>
3824
- <?php if (!$helper->getFieldRequire($fields[18]['value'])): ?>
3825
- <script type="text/javascript">
3826
- if ($('billing:country_id'))
3827
- $('billing:country_id').removeClassName('validate-select');
3828
- </script>
3829
- <?php endif ?>
3830
- <?php elseif ($fields[18]['value'] == 'region'): ?>
3831
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
3832
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
3833
- <span class="required">*</span>
3834
- <?php endif ?>
3835
- </label><br/>
3836
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
3837
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3838
- </select>
3839
- <?php if (!$helper->enableGeoip()): ?>
3840
- <script type="text/javascript">
3841
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3842
- </script>
3843
- <?php endif; ?>
3844
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3845
- <?php if (!$helper->getFieldRequire($fields[18]['value'])): ?>
3846
- <script type="text/javascript">
3847
- if ($('billing:region_id'))
3848
- $('billing:region_id').removeClassName('validate-select');
3849
- </script>
3850
- <?php endif ?>
3851
- <?php elseif ($fields[18]['value'] == 'prefix'): ?>
3852
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3853
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3854
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
3855
- <span class="required">*</span>
3856
- <?php endif ?>
3857
- </label><br />
3858
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3859
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[18]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3860
- <?php else: ?>
3861
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3862
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3863
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3864
- <?php endforeach ?>
3865
- </select>
3866
- <?php endif; ?>
3867
- <?php elseif ($fields[18]['value'] == 'suffix'): ?>
3868
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3869
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3870
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
3871
- <span class="required">*</span>
3872
- <?php endif ?>
3873
- </label><br />
3874
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3875
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[18]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3876
- <?php else: ?>
3877
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3878
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3879
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3880
- <?php endforeach ?>
3881
- </select>
3882
- <?php endif; ?>
3883
- <?php elseif ($fields[18]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3884
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3885
- <?php elseif ($fields[18]['value'] == 'gender'): ?>
3886
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3887
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3888
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
3889
- <span class="required">*</span>
3890
- <?php endif ?>
3891
- </label><br />
3892
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3893
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3894
- <?php $value = $_gender->getGender(); ?>
3895
- <?php foreach ($options as $option): ?>
3896
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3897
- <?php endforeach; ?>
3898
- </select>
3899
- <?php else: ?>
3900
- <label for="billing:<?php echo $fields[18]['value'] ?>"><?php echo $helper->getFieldLabel($fields[18]['value']); ?>
3901
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
3902
- <span class="required">*</span>
3903
- <?php endif; ?>
3904
- </label><br>
3905
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[18]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[18]['value']); ?>" value="" name="billing[<?php echo $fields[18]['value'] ?>]" id="billing:<?php echo $fields[18]['value'] ?>">
3906
- <?php endif ?>
3907
- <!-- end -->
3908
- <?php else: ?>
3909
- <?php if ($fields[19]['value'] == 'street'): ?>
3910
- <label for="billing:street1"><?php echo $this->__('Address') ?>
3911
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
3912
- <span class="required">*</span>
3913
- <?php endif ?>
3914
- </label><br />
3915
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
3916
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
3917
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
3918
- <?php endfor ?>
3919
- <?php elseif ($fields[19]['value'] == 'country'): ?>
3920
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
3921
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
3922
- <span class="required">*</span>
3923
- <?php endif ?>
3924
- </label><br />
3925
- <?php echo $this->getCountryHtmlSelect('billing') ?>
3926
- <?php if (!$helper->getFieldRequire($fields[19]['value'])): ?>
3927
- <script type="text/javascript">
3928
- if ($('billing:country_id'))
3929
- $('billing:country_id').removeClassName('validate-select');
3930
- </script>
3931
- <?php endif ?>
3932
- <?php elseif ($fields[19]['value'] == 'region'): ?>
3933
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
3934
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
3935
- <span class="required">*</span>
3936
- <?php endif ?>
3937
- </label><br/>
3938
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
3939
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
3940
- </select>
3941
- <?php if (!$helper->enableGeoip()): ?>
3942
- <script type="text/javascript">
3943
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
3944
- </script>
3945
- <?php endif; ?>
3946
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
3947
- <?php if (!$helper->getFieldRequire($fields[19]['value'])): ?>
3948
- <script type="text/javascript">
3949
- if ($('billing:region_id'))
3950
- $('billing:region_id').removeClassName('validate-select');
3951
- </script>
3952
- <?php endif ?>
3953
- <?php elseif ($fields[19]['value'] == 'prefix'): ?>
3954
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3955
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
3956
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
3957
- <span class="required">*</span>
3958
- <?php endif ?>
3959
- </label><br />
3960
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
3961
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[19]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3962
- <?php else: ?>
3963
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3964
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
3965
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3966
- <?php endforeach ?>
3967
- </select>
3968
- <?php endif; ?>
3969
- <?php elseif ($fields[19]['value'] == 'suffix'): ?>
3970
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
3971
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
3972
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
3973
- <span class="required">*</span>
3974
- <?php endif ?>
3975
- </label><br />
3976
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
3977
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[19]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
3978
- <?php else: ?>
3979
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
3980
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
3981
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
3982
- <?php endforeach ?>
3983
- </select>
3984
- <?php endif; ?>
3985
- <?php elseif ($fields[19]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
3986
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
3987
- <?php elseif ($fields[19]['value'] == 'gender'): ?>
3988
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
3989
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
3990
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
3991
- <span class="required">*</span>
3992
- <?php endif ?>
3993
- </label><br />
3994
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
3995
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
3996
- <?php $value = $_gender->getGender(); ?>
3997
- <?php foreach ($options as $option): ?>
3998
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
3999
- <?php endforeach; ?>
4000
- </select>
4001
- <?php else: ?>
4002
- <label for="billing:<?php echo $fields[19]['value'] ?>"><?php echo $helper->getFieldLabel($fields[19]['value']); ?>
4003
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
4004
- <span class="required">*</span>
4005
- <?php endif; ?>
4006
- </label><br>
4007
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[19]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[19]['value']); ?>" value="" name="billing[<?php echo $fields[19]['value'] ?>]" id="billing:<?php echo $fields[19]['value'] ?>">
4008
- <?php endif; ?>
4009
- <?php endif; ?>
4010
- </div>
4011
- <?php else: ?>
4012
- <div class="two-fields">
4013
- <?php if ($fields[18]['value'] == 'street'): ?>
4014
- <label for="billing:street1"><?php echo $this->__('Address') ?>
4015
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
4016
- <span class="required">*</span>
4017
- <?php endif ?>
4018
- </label><br />
4019
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
4020
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
4021
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
4022
- <?php endfor ?>
4023
- <?php elseif ($fields[18]['value'] == 'country'): ?>
4024
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
4025
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
4026
- <span class="required">*</span>
4027
- <?php endif ?>
4028
- </label><br />
4029
- <?php echo $this->getCountryHtmlSelect('billing') ?>
4030
- <?php if (!$helper->getFieldRequire($fields[18]['value'])): ?>
4031
- <script type="text/javascript">
4032
- if ($('billing:country_id'))
4033
- $('billing:country_id').removeClassName('validate-select');
4034
- </script>
4035
- <?php endif ?>
4036
- <?php elseif ($fields[18]['value'] == 'region'): ?>
4037
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
4038
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
4039
- <span class="required">*</span>
4040
- <?php endif ?>
4041
- </label><br/>
4042
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
4043
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
4044
- </select>
4045
- <?php if (!$helper->enableGeoip()): ?>
4046
- <script type="text/javascript">
4047
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
4048
- </script>
4049
- <?php endif; ?>
4050
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
4051
- <?php if (!$helper->getFieldRequire($fields[18]['value'])): ?>
4052
- <script type="text/javascript">
4053
- if ($('billing:region_id'))
4054
- $('billing:region_id').removeClassName('validate-select');
4055
- </script>
4056
- <?php endif ?>
4057
- <?php elseif ($fields[18]['value'] == 'prefix'): ?>
4058
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
4059
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
4060
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
4061
- <span class="required">*</span>
4062
- <?php endif ?>
4063
- </label><br />
4064
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
4065
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[18]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
4066
- <?php else: ?>
4067
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
4068
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
4069
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
4070
- <?php endforeach ?>
4071
- </select>
4072
- <?php endif; ?>
4073
- <?php elseif ($fields[18]['value'] == 'suffix'): ?>
4074
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
4075
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
4076
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
4077
- <span class="required">*</span>
4078
- <?php endif ?>
4079
- </label><br />
4080
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
4081
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[18]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
4082
- <?php else: ?>
4083
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
4084
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
4085
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
4086
- <?php endforeach ?>
4087
- </select>
4088
- <?php endif; ?>
4089
- <?php elseif ($fields[18]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
4090
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
4091
- <?php elseif ($fields[18]['value'] == 'gender'): ?>
4092
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
4093
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
4094
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
4095
- <span class="required">*</span>
4096
- <?php endif ?>
4097
- </label><br />
4098
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[18]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
4099
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
4100
- <?php $value = $_gender->getGender(); ?>
4101
- <?php foreach ($options as $option): ?>
4102
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
4103
- <?php endforeach; ?>
4104
- </select>
4105
- <?php else: ?>
4106
- <label for="billing:<?php echo $fields[18]['value'] ?>"><?php echo $helper->getFieldLabel($fields[18]['value']); ?>
4107
- <?php if ($helper->getFieldRequire($fields[18]['value'])): ?>
4108
- <span class="required">*</span>
4109
- <?php endif; ?>
4110
- </label><br>
4111
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[18]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[18]['value']); ?>" value="" name="billing[<?php echo $fields[18]['value'] ?>]" id="billing:<?php echo $fields[18]['value'] ?>">
4112
- <?php endif; ?>
4113
- </div>
4114
- <div class="two-fields">
4115
- <?php if ($fields[19]['value'] == 'street'): ?>
4116
- <label for="billing:street1"><?php echo $this->__('Address') ?>
4117
- <?php if ($helper->getFieldRequire($helper->getFieldEnable($i))): ?>
4118
- <span class="required">*</span>
4119
- <?php endif ?>
4120
- </label><br />
4121
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if ($helper->getFieldRequire($helper->getFieldEnable($i))) echo 'required-entry'; ?> input-text"/>
4122
- <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
4123
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address ' . $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
4124
- <?php endfor ?>
4125
- <?php elseif ($fields[19]['value'] == 'country'): ?>
4126
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
4127
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
4128
- <span class="required">*</span>
4129
- <?php endif ?>
4130
- </label><br />
4131
- <?php echo $this->getCountryHtmlSelect('billing') ?>
4132
- <?php if (!$helper->getFieldRequire($fields[19]['value'])): ?>
4133
- <script type="text/javascript">
4134
- if ($('billing:country_id'))
4135
- $('billing:country_id').removeClassName('validate-select');
4136
- </script>
4137
- <?php endif ?>
4138
- <?php elseif ($fields[19]['value'] == 'region'): ?>
4139
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
4140
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
4141
- <span class="required">*</span>
4142
- <?php endif ?>
4143
- </label><br/>
4144
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
4145
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
4146
- </select>
4147
- <?php if (!$helper->enableGeoip()): ?>
4148
- <script type="text/javascript">
4149
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
4150
- </script>
4151
- <?php endif; ?>
4152
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
4153
- <?php if (!$helper->getFieldRequire($fields[19]['value'])): ?>
4154
- <script type="text/javascript">
4155
- if ($('billing:region_id'))
4156
- $('billing:region_id').removeClassName('validate-select');
4157
- </script>
4158
- <?php endif ?>
4159
- <?php elseif ($fields[19]['value'] == 'prefix'): ?>
4160
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
4161
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
4162
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
4163
- <span class="required">*</span>
4164
- <?php endif ?>
4165
- </label><br />
4166
- <?php if ($customerNameBlock->getPrefixOptions() === false): ?>
4167
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[19]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
4168
- <?php else: ?>
4169
- <select id="<?php echo $customerNameBlock->getFieldId('prefix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix') ?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
4170
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
4171
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
4172
- <?php endforeach ?>
4173
- </select>
4174
- <?php endif; ?>
4175
- <?php elseif ($fields[19]['value'] == 'suffix'): ?>
4176
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
4177
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
4178
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
4179
- <span class="required">*</span>
4180
- <?php endif ?>
4181
- </label><br />
4182
- <?php if ($customerNameBlock->getSuffixOptions() === false): ?>
4183
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if ($helper->getFieldRequire($fields[19]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
4184
- <?php else: ?>
4185
- <select id="<?php echo $customerNameBlock->getFieldId('suffix') ?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix') ?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
4186
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
4187
- <option value="<?php echo $_option ?>"><?php echo $this->__($_option) ?></option>
4188
- <?php endforeach ?>
4189
- </select>
4190
- <?php endif; ?>
4191
- <?php elseif ($fields[19]['value'] == 'birthday'): ?> <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
4192
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
4193
- <?php elseif ($fields[19]['value'] == 'gender'): ?>
4194
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
4195
- <label for="<?php echo $_gender->getFieldId('gender') ?>"><?php echo $this->__('Gender') ?>
4196
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
4197
- <span class="required">*</span>
4198
- <?php endif ?>
4199
- </label><br />
4200
- <select id="<?php echo $_gender->getFieldId('gender') ?>" name="billing[<?php echo $_gender->getFieldName('gender') ?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if ($helper->getFieldRequire($fields[19]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
4201
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(); ?>
4202
- <?php $value = $_gender->getGender(); ?>
4203
- <?php foreach ($options as $option): ?>
4204
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
4205
- <?php endforeach; ?>
4206
- </select>
4207
- <?php else: ?>
4208
- <label for="billing:<?php echo $fields[19]['value'] ?>"><?php echo $helper->getFieldLabel($fields[19]['value']); ?>
4209
- <?php if ($helper->getFieldRequire($fields[19]['value'])): ?>
4210
- <span class="required">*</span>
4211
- <?php endif; ?>
4212
- </label><br>
4213
- <input type="text" class="input-text <?php if ($helper->getFieldRequire($fields[19]['value'])) echo 'required-entry'; ?>" title="<?php echo $helper->getFieldLabel($fields[19]['value']); ?>" value="" name="billing[<?php echo $fields[19]['value'] ?>]" id="billing:<?php echo $fields[19]['value'] ?>">
4214
- <?php endif; ?>
4215
- </div>
4216
- <?php endif; ?>
4217
- <?php endif; ?>
4218
- </li>
4219
- <!-- end billing form data -->
4220
- <?php if ($checkCountry == 0): ?>
4221
- <div style="display:none;">
4222
- <?php echo $this->getCountryHtmlSelect('billing') ?>
4223
- </div>
4224
- <?php endif ?>
4225
- <?php if (!$this->isCustomerLoggedIn() && Mage::helper('onestepcheckout')->enableRegistration() && Mage::helper('onestepcheckout')->allowGuestCheckout()): ?>
4226
- <li>
4227
- <div>
4228
- <input id="create_account_checkbox_id" type="checkbox" name="create_account_checkbox" value="1" />
4229
- <label for="create_account_checkbox_id"><?php echo $this->__('Create an account for later use') ?></label>
4230
- </div>
4231
- </li>
4232
- <script type="text/javascript">
4233
- Event.observe('create_account_checkbox_id', 'click', function() {
4234
- if ($('create_account_checkbox_id').checked)
4235
- $('password_section_id').show();
4236
- else
4237
- $('password_section_id').hide();
4238
- });
4239
- </script>
4240
- <?php endif; ?>
4241
- <?php if (!$this->isCustomerLoggedIn() && (Mage::helper('onestepcheckout')->enableRegistration() || !Mage::helper('onestepcheckout')->allowGuestCheckout())): ?>
4242
- <li id="password_section_id" <?php if (!Mage::helper('onestepcheckout')->allowGuestCheckout()): ?>style="display:block"<?php else: ?>style="display:none"<?php endif ?>>
4243
- <div class="two-fields">
4244
- <label for="billing:customer_password"><?php echo $this->__('Password') ?> <span class="required">*</span></label><br/>
4245
- <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
4246
- </div>
4247
- <div class="two-fields">
4248
- <label for="billing:confirm_password"><?php echo $this->__('Confirm Password') ?> <span class="required">*</span></label><br/>
4249
- <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
4250
- </div>
4251
- </li>
4252
- <?php endif ?>
4253
- <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()): ?>
4254
- <li class="control">
4255
- <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)
4256
- shipping.setSameAsBilling(false);"<?php if ($this->getBillingAddress()->getSaveInAddressBook()): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
4257
- </li>
4258
- <?php else: ?>
4259
- <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
4260
- <?php endif; ?>
4261
- <li>
4262
- <input type="hidden" name="billing[use_for_shipping]" id="billing:use_for_shipping" value="1" />
4263
- </li>
4264
- </ul>
4265
- </fieldset>
4266
- <script type="text/javascript">var countryRegions = <?php echo $this->helper('directory')->getRegionJson() ?></script>
4267
- <script type="text/javascript">
4268
- //<![CDATA[
4269
-
4270
- if ($('billing:region') || $('billing:region_id'))
4271
- var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions);
4272
-
4273
- <?php if (!$helper->getFieldRequire('region')): ?>
4274
- if ($('billing:region_id')) {
4275
- $('billing:region_id').removeClassName('validate-select');
4276
- $('billing:region_id').removeClassName('required-entry');
4277
- }
4278
- <?php endif ?>
4279
- if ($('billing:email')) {
4280
- Event.observe('billing:email', 'blur', function() {
4281
- var url = '<?php echo $this->getUrl('onestepcheckout/index/is_valid_email', array('_secure' => true)) ?>';
4282
- var email_address = $('billing:email').value;
4283
- var parameters = {email_address: email_address};
4284
- var request = new Ajax.Request(
4285
- url,
4286
- {
4287
- parameters: parameters,
4288
- onComplete: check_valid_email.bindAsEventListener(this),
4289
- onFailure: ''
4290
- });
4291
- });
4292
- }
4293
- if ($('billing-address-select')) {
4294
- Event.observe('billing-address-select', 'change', function() {
4295
- var isNew = $('billing-address-select').value ? false : true;
4296
- setNewAddress(isNew, 'billing', save_address_url, update_address_shipping, update_address_payment, update_address_review);
4297
- });
4298
- }
4299
- //]]>
4300
- </script>
4301
-
4302
-
4303
- <script type="text/javascript">
4304
- <?php if ($helper->enableGeoip()): ?>
4305
- /*
4306
- Show list postcode billing
4307
- */
4308
- <?php if ($helper->allowDetectByPostcode()): ?>
4309
- new Ajax.Autocompleter(
4310
- 'billing:postcode',
4311
- 'billing:postcode_autocomplete',
4312
- '<?php echo $this->getUrl('onestepcheckout/geoip/checkPostcode') ?>',
4313
- {
4314
- paramName: 'postcode',
4315
- minChars:<?php echo $helper->getMinCharsPostcode() ?>,
4316
- indicator: 'billing_postcode_autocomplete_indicator',
4317
- updateElement: fillFilterBilling,
4318
- evalJSON: 'force'
4319
- }
4320
- );
4321
- <?php endif; ?>
4322
-
4323
- /*
4324
- Show list city billing
4325
- */
4326
- <?php if ($helper->allowDetectByCity()): ?>
4327
- new Ajax.Autocompleter(
4328
- 'billing:city',
4329
- 'billing:city_autocomplete',
4330
- '<?php echo $this->getUrl('onestepcheckout/geoip/checkCity') ?>',
4331
- {
4332
- paramName: 'city',
4333
- minChars:<?php echo $helper->getMinCharsCity() ?>,
4334
- indicator: 'billing_city_autocomplete_indicator',
4335
- updateElement: fillFilterBilling,
4336
- evalJSON: 'force'
4337
- }
4338
- );
4339
- <?php endif; ?>
4340
-
4341
- function fillFilterBilling(li)
4342
- {
4343
- var country = li.getAttribute('country');
4344
- var region = li.getAttribute('region');
4345
- var region_id = li.getAttribute('region_id');
4346
- var city = li.getAttribute('city');
4347
- var postcode = li.getAttribute('postcode');
4348
- if (city != '') {
4349
- if ($('billing:postcode')) {
4350
- $('billing:postcode').value = postcode;
4351
- }
4352
- }
4353
- if (country != '') {
4354
- if ($('billing:country_id')) {
4355
- $('billing:country_id').value = country;
4356
- }
4357
- }
4358
- if (region != '') {
4359
- if ($('billing:region')) {
4360
- $('billing:region').value = region;
4361
- }
4362
- }
4363
-
4364
- if (region_id != '') {
4365
- if ($('billing:region_id')) {
4366
- $('billing:region_id').value = region_id;
4367
- }
4368
- }
4369
-
4370
- if (city != '') {
4371
- if ($('billing:city')) {
4372
- $('billing:city').value = city;
4373
- }
4374
- }
4375
-
4376
- updateBillingRegion();
4377
-
4378
- }
4379
- <?php endif; ?>
4380
- function updateBillingRegion() {
4381
- var countryEl = $('billing:country_id');
4382
- var regionTextEl = $('billing:region');
4383
- var regionSelectEl = $('billing:region_id');
4384
- var regions = <?php echo $this->helper('directory')->getRegionJson() ?>;
4385
- var config = regions['config'];
4386
- delete regions.config;
4387
- var regions = regions;
4388
- var zipEl = $(zipEl);
4389
- disableAction = (typeof disableAction == 'undefined') ? 'hide' : disableAction;
4390
-
4391
- updateRegion(countryEl, regionTextEl, regionSelectEl, regions, disableAction, zipEl);
4392
- }
4393
- updateBillingRegion();
4394
- </script>
4395
-
4396
- <?php if (Mage::getStoreConfig('onestepcheckout/general/suggest_address', Mage::app()->getStore()->getStoreId())): ?>
4397
- <script type="text/javascript">
4398
- var autocompleteBilling;
4399
- var componentBillingForm = {
4400
- street_number: 'short_name',
4401
- route: 'long_name',
4402
- locality: 'long_name',
4403
- administrative_area_level_1: 'short_name',
4404
- country: 'short_name',
4405
- postal_code: 'short_name',
4406
- sublocality: 'long_name'
4407
- };
4408
-
4409
- autocompleteBilling = new google.maps.places.Autocomplete(
4410
- (document.getElementById('billing:street1')),
4411
- {types: ['geocode']});
4412
-
4413
- google.maps.event.addListener(autocompleteBilling, 'place_changed', function() {
4414
- fillBillingAddress();
4415
- });
4416
-
4417
- function fillBillingAddress() {
4418
- var place = autocompleteBilling.getPlace();
4419
- var street, city, region_id, region, country, postal_code, sublocality;
4420
-
4421
- for (var i = 0; i < place.address_components.length; i++) {
4422
- var addressType = place.address_components[i].types[0];
4423
- if (componentBillingForm[addressType]) {
4424
- if (addressType == 'street_number') {
4425
- if (street)
4426
- street += ' ' + place.address_components[i][componentBillingForm['street_number']];
4427
- else
4428
- street = place.address_components[i][componentBillingForm['street_number']];
4429
- }
4430
- if (addressType == 'route') {
4431
- if (street)
4432
- street += ' ' + place.address_components[i][componentBillingForm['route']];
4433
- else
4434
- street = place.address_components[i][componentBillingForm['route']];
4435
- }
4436
- if (addressType == 'locality')
4437
- city = place.address_components[i][componentBillingForm['locality']];
4438
- if (addressType == 'administrative_area_level_1') {
4439
- region_id = place.address_components[i]['short_name'];
4440
- region = place.address_components[i]['long_name'];
4441
- }
4442
- if (addressType == 'country')
4443
- country = place.address_components[i][componentBillingForm['country']];
4444
- if (addressType == 'postal_code')
4445
- postal_code = place.address_components[i][componentBillingForm['postal_code']];
4446
- if (addressType == 'sublocality')
4447
- sublocality = place.address_components[i][componentBillingForm['sublocality']];
4448
- }
4449
- }
4450
- fillAddress('billing', street, city, region_id, region, country, postal_code, sublocality);
4451
- }
4452
- </script>
4453
- <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/abserve/shoestore/template/onestepcheckout/onestepcheckout/billing.backup_20_05.phtml DELETED
@@ -1,397 +0,0 @@
1
- <?php
2
- /**
3
- * @category Abserve
4
- * @package Abserve_Module
5
- * @author Abserve Developer
6
- * @license http://abservetech.com/license-agreement/
7
- * @copyright Copyright (c) 2015 abservetech (http://abservetech.com)
8
- */
9
- ?>
10
- <h3 id="billing_step_header" class="step_1"><?php echo($this->__("BILLING ADDRESS")); ?></h3>
11
- <?php if ($this->customerHasAddresses()): ?>
12
- <p><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></p>
13
- <ul>
14
- <li>
15
- <p><?php echo $this->getAddressesHtmlSelect('billing') ?></p>
16
- </li>
17
- </ul>
18
- <?php endif; ?>
19
- <fieldset class="group-select" id="billing-new-address-form" <?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
20
- <input type="hidden" name="billing[address_id]" value="<?php echo $this->getBillingAddress()->getId() ?>" id="billing:address_id" />
21
- <ul>
22
- <?php $helper = Mage::helper('onestepcheckout') ?>
23
- <?php $fieldValue = $helper->getFieldValue() ?>
24
- <?php $checkCountry = 0 ?>
25
- <?php $checkRegion = 0 ?>
26
- <?php for($i=0;$i<20;$i++): ?>
27
- <?php if($fields[$i]['value']=='country') $checkCountry = 1 ?>
28
- <?php if($fields[$i]['value']=='region') $checkRegion = 1 ?>
29
- <?php if(Mage::getSingleton('customer/session')->isLoggedIn() && $fields[$i]['value']=='email') continue; ?>
30
- <?php if(!$fields[$i]['value']||$fields[$i]['value']=='0') continue; ?>
31
- <?php if(($i%2==0) || (($i%2!=0)&&(!$fields[$i-1]['value']||$fields[$i-1]['value']=='0'||(Mage::getSingleton('customer/session')->isLoggedIn() && $fields[$i-1]['value']=='email')))): ?>
32
- <li>
33
- <?php endif ?>
34
- <?php if((($i%2==0) && ($fields[$i]['value']&&$fields[$i]['value']!='0') && (!$fields[$i+1]['value']||$fields[$i+1]['value']=='0'||(Mage::getSingleton('customer/session')->isLoggedIn() && $fields[$i+1]['value']=='email')))
35
- || (($i%2!=0) && ($fields[$i]['value']&&$fields[$i]['value']!='0') && (!$fields[$i-1]['value'] || $fields[$i-1]['value']=='0'||(Mage::getSingleton('customer/session')->isLoggedIn() && $fields[$i-1]['value']=='email')))): ?>
36
- <div class="one-field">
37
- <?php else: ?>
38
- <div class="two-fields">
39
- <?php endif ?>
40
- <?php if(!$fields[$i]['value']||$fields[$i]['value']=='0') continue; ?>
41
- <?php if($fields[$i]['value']=='street'): ?>
42
- <label for="billing:street1"><?php echo $this->__('Address') ?>
43
- <?php if($helper->getFieldRequire($fields[$i]['value'])): ?>
44
- <span class="required">*</span>
45
- <?php endif ?>
46
- </label><br />
47
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet(1)) ?>" class="<?php if($helper->getFieldRequire($fields[$i]['value'])) echo 'required-entry'; ?> input-text"/>
48
- <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
49
- <input style="margin-bottom:10px;" type="text" title="<?php echo $this->__('Street Address '.$_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getStreet($_i)) ?>" class="input-text" />
50
- <?php endfor ?>
51
- <?php elseif($fields[$i]['value']=='country'): ?>
52
- <label for="billing:country_id"><?php echo $this->__('Country') ?>
53
- <?php if($helper->getFieldRequire($fields[$i]['value'])): ?>
54
- <span class="required">*</span>
55
- <?php endif ?>
56
- </label><br />
57
- <?php echo $this->getCountryHtmlSelect('billing') ?>
58
- <?php if(!$helper->getFieldRequire($fields[$i]['value'])): ?>
59
- <script type="text/javascript">
60
- if($('billing:country_id'))
61
- $('billing:country_id').removeClassName('validate-select');
62
- </script>
63
- <?php endif ?>
64
- <?php elseif($fields[$i]['value']=='region'): ?>
65
- <label for="billing:region"><?php echo $this->__('State/Province') ?>
66
- <?php if($helper->getFieldRequire($fields[$i]['value'])): ?>
67
- <span class="required">*</span>
68
- <?php endif ?>
69
- </label><br/>
70
- <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="<?php if($helper->getFieldRequire($fields[$i]['value'])) echo "validate-select"; ?>" style="display:none;width:135px;" >
71
- <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
72
- </select>
73
- <?php if(!$helper->enableGeoip()):?>
74
- <script type="text/javascript">
75
- $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->htmlEscape($this->getBillingAddress()->getRegionId()) ?>");
76
- </script>
77
- <?php endif;?>
78
- <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php if($helper->getFieldRequire($fields[$i]['value'])) echo 'required-entry'; ?> input-text" style="display:none" />
79
- <?php if(!$helper->getFieldRequire($fields[$i]['value'])): ?>
80
- <script type="text/javascript">
81
- if($('billing:region_id'))
82
- $('billing:region_id').removeClassName('validate-select');
83
- </script>
84
- <?php endif ?>
85
- <?php elseif($fields[$i]['value']=='prefix'): ?>
86
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
87
- <label for="billing:prefix"><?php echo $this->__('Prefix Name') ?>
88
- <?php if($helper->getFieldRequire($fields[$i]['value'])): ?>
89
- <span class="required">*</span>
90
- <?php endif ?>
91
- </label><br />
92
- <?php if ($customerNameBlock->getPrefixOptions()===false): ?>
93
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('prefix')?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix')?>]" value="" title="<?php echo $this->__('Prefix') ?>" class="input-text <?php if($helper->getFieldRequire($fields[$i]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
94
- <?php else: ?>
95
- <select id="<?php echo $customerNameBlock->getFieldId('prefix')?>" name="billing[<?php echo $customerNameBlock->getFieldName('prefix')?>]" title="<?php echo $this->__('Prefix') ?>" class="<?php if($helper->getFieldRequire($fields[$i]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
96
- <?php foreach ($customerNameBlock->getPrefixOptions() as $_option): ?>
97
- <option value="<?php echo $_option?>"><?php echo $this->__($_option)?></option>
98
- <?php endforeach ?>
99
- </select>
100
- <?php endif; ?>
101
- <?php elseif($fields[$i]['value']=='suffix'): ?>
102
- <?php $customerNameBlock = Mage::getBlockSingleton('customer/widget_name') ?>
103
- <label for="billing:prefix"><?php echo $this->__('Suffix Name') ?>
104
- <?php if($helper->getFieldRequire($fields[$i]['value'])): ?>
105
- <span class="required">*</span>
106
- <?php endif ?>
107
- </label><br />
108
- <?php if ($customerNameBlock->getSuffixOptions()===false): ?>
109
- <input type="text" id="<?php echo $customerNameBlock->getFieldId('suffix')?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix')?>]" value="" title="<?php echo $this->__('Suffix') ?>" class="input-text <?php if($helper->getFieldRequire($fields[$i]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?> />
110
- <?php else: ?>
111
- <select id="<?php echo $customerNameBlock->getFieldId('suffix')?>" name="billing[<?php echo $customerNameBlock->getFieldName('suffix')?>]" title="<?php echo $this->__('Suffix') ?>" class="<?php if($helper->getFieldRequire($fields[$i]['value'])) echo "required-entry"; ?>" <?php echo $customerNameBlock->getFieldParams() ?>>
112
- <?php foreach ($customerNameBlock->getSuffixOptions() as $_option): ?>
113
- <option value="<?php echo $_option?>"><?php echo $this->__($_option)?></option>
114
- <?php endforeach ?>
115
- </select>
116
- <?php endif; ?>
117
- <?php elseif($fields[$i]['value']=='birthday'): ?>
118
- <?php $_dob = $this->getLayout()->createBlock('onestepcheckout/widget_dob') ?>
119
- <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
120
- <?php elseif($fields[$i]['value']=='gender'): ?>
121
- <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
122
- <label for="<?php echo $_gender->getFieldId('gender')?>"><?php echo $this->__('Gender') ?>
123
- <?php if($helper->getFieldRequire($fields[$i]['value'])): ?>
124
- <span class="required">*</span>
125
- <?php endif ?>
126
- </label><br />
127
- <select id="<?php echo $_gender->getFieldId('gender')?>" name="billing[<?php echo $_gender->getFieldName('gender')?>]" title="<?php echo $this->__('Gender') ?>" class="<?php if($helper->getFieldRequire($fields[$i]['value'])) echo "validate-select"; ?>" <?php echo $_gender->getFieldParams() ?>>
128
- <?php $options = Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getAllOptions();?>
129
- <?php $value = $_gender->getGender();?>
130
- <?php foreach ($options as $option):?>
131
- <option value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' selected="selected"' ?>><?php echo $option['label'] ?></option>
132
- <?php endforeach;?>
133
- </select>
134
- <?php else: ?>
135
- <label for="billing:<?php echo $fields[$i]['value']; ?>"><?php echo $this->__($fieldValue[$fields[$i]['value']]) ?>
136
- <?php if($helper->getFieldRequire($fields[$i]['value']) || $fields[$i]['value']=='firstname'||$fields[$i]['value']=='lastname'|| $fields[$i]['value']=='email'): ?>
137
- <span class="required">*</span>
138
- <?php endif ?>
139
- </label><br/>
140
- <input type="text" id="billing:<?php echo $fields[$i]['value']; ?>" name="billing[<?php echo $fields[$i]['value']; ?>]" value="<?php echo $this->htmlEscape($this->getBillingAddress()->getData($fields[$i]['value'])) ?>" title="<?php echo $this->__($fieldValue[$fields[$i]['value']]) ?>" class="input-text <?php if($helper->getFieldRequire($fields[$i]['value'])||$fields[$i]['value']=='firstname'||$fields[$i]['value']=='lastname'||$fields[$i]['value']=='email') echo 'required-entry'; ?>" />
141
- <?php if($helper->enableGeoip()):?>
142
- <?php if(($fields[$i]['value'] == 'postcode') && $helper->allowDetectByPostcode()): ?>
143
- <span id="billing_<?php echo $fields[$i]['value']?>_autocomplete_indicator" class="autocomplete-indicator" style="display:none;">
144
- <img class="v-middle" alt="Loading..." src="<?php echo $this->getSkinUrl('images/geoip/indicator.gif')?>">
145
- </span>
146
- <div id="billing:<?php echo $fields[$i]['value'].'_autocomplete';?>" class="autocomplete" style="display:none; position:absolute; background-color:#FFFFFF; max-height:230px; overflow:auto; border:1px solid #B6B6B6"></div>
147
- <?php endif;?>
148
- <?php if(($fields[$i]['value'] == 'city') && $helper->allowDetectByCity()): ?>
149
- <span id="billing_<?php echo $fields[$i]['value']?>_autocomplete_indicator" class="autocomplete-indicator" style="display:none;">
150
- <img class="v-middle" alt="Loading..." src="<?php echo $this->getSkinUrl('images/geoip/indicator.gif')?>">
151
- </span>
152
- <div id="billing:<?php echo $fields[$i]['value'].'_autocomplete';?>" class="autocomplete" style="display:none; position:absolute; background-color:#FFFFFF; max-height:230px; overflow:auto; border:1px solid #B6B6B6"></div>
153
- <?php endif;?>
154
- <?php endif;?>
155
- <?php if($fields[$i]['value']=='email'): ?>
156
- <span id="valid_email_address_image" style="display:none;"><img src="<?php echo $this->getSkinUrl('images/onestepcheckout/valid.gif')?>" title="<?php echo $this->__('Valid Email Address');?>" alt="<?php echo $this->__('Valid Email Address');?>" width="18"/></span>
157
- <div id="email-error-message" class="error-message"></div>
158
- <?php endif ?>
159
- <?php endif ?>
160
- </div>
161
- <?php if(($i%2!=0)||(($i%2==0)&&(!$fields[$i+1]['value']||$fields[$i+1]['value']=='0'||(Mage::getSingleton('customer/session')->isLoggedIn() && $fields[$i+1]['value']=='email')))): ?>
162
- </li>
163
- <?php endif ?>
164
- <?php endfor ?>
165
- <?php if($checkCountry==0): ?>
166
- <div style="display:none;">
167
- <?php echo $this->getCountryHtmlSelect('billing') ?>
168
- </div>
169
- <?php endif ?>
170
- <?php if (!$this->isCustomerLoggedIn() && Mage::helper('onestepcheckout')->enableRegistration() && Mage::helper('onestepcheckout')->allowGuestCheckout()):?>
171
- <li>
172
- <div>
173
- <input id="create_account_checkbox_id" type="checkbox" name="create_account_checkbox" value="1" />
174
- <label for="create_account_checkbox_id"><?php echo $this->__('Create an account for later use') ?></label>
175
- </div>
176
- </li>
177
- <script type="text/javascript">
178
- Event.observe('create_account_checkbox_id', 'click', function() {
179
- if ($('create_account_checkbox_id').checked)
180
- $('password_section_id').show();
181
- else
182
- $('password_section_id').hide();
183
- });
184
- </script>
185
- <?php endif;?>
186
- <?php if (!$this->isCustomerLoggedIn() && (Mage::helper('onestepcheckout')->enableRegistration() || !Mage::helper('onestepcheckout')->allowGuestCheckout())):?>
187
- <li id="password_section_id" <?php if (!Mage::helper('onestepcheckout')->allowGuestCheckout()):?>style="display:block"<?php else:?>style="display:none"<?php endif?>>
188
- <div class="two-fields">
189
- <label for="billing:customer_password"><?php echo $this->__('Password') ?> <span class="required">*</span></label><br/>
190
- <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
191
- </div>
192
- <div class="two-fields">
193
- <label for="billing:confirm_password"><?php echo $this->__('Confirm Password') ?> <span class="required">*</span></label><br/>
194
- <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
195
- </div>
196
- </li>
197
- <?php endif?>
198
- <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
199
- <li class="control">
200
- <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->getBillingAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
201
- </li>
202
- <?php else:?>
203
- <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
204
- <?php endif;?>
205
- <li>
206
- <input type="hidden" name="billing[use_for_shipping]" id="billing:use_for_shipping" value="1" />
207
- </li>
208
- </ul>
209
- </fieldset>
210
- <script type="text/javascript">var countryRegions = <?php echo $this->helper('directory')->getRegionJson() ?></script>
211
- <script type="text/javascript">
212
- //<![CDATA[
213
-
214
- if ($('billing:region') || $('billing:region_id'))
215
- var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions);
216
-
217
- <?php if (!$helper->getFieldRequire('region')): ?>
218
- if ($('billing:region_id')) {
219
- $('billing:region_id').removeClassName('validate-select');
220
- $('billing:region_id').removeClassName('required-entry');
221
- }
222
- <?php endif ?>
223
- if ($('billing:email')) {
224
- Event.observe('billing:email', 'blur', function() {
225
- var url = '<?php echo $this->getUrl('onestepcheckout/index/is_valid_email', array('_secure' => true)) ?>';
226
- var email_address = $('billing:email').value;
227
- var parameters = {email_address: email_address};
228
- var request = new Ajax.Request(
229
- url,
230
- {
231
- parameters: parameters,
232
- onComplete: check_valid_email.bindAsEventListener(this),
233
- onFailure: ''
234
- });
235
- });
236
- }
237
- if ($('billing-address-select')) {
238
- Event.observe('billing-address-select', 'change', function() {
239
- var isNew = $('billing-address-select').value ? false : true;
240
- setNewAddress(isNew, 'billing', save_address_url, update_address_shipping, update_address_payment, update_address_review);
241
- });
242
- }
243
- //]]>
244
- </script>
245
-
246
-
247
- <script type="text/javascript">
248
- <?php if ($helper->enableGeoip()): ?>
249
- /*
250
- Show list postcode billing
251
- */
252
- <?php if ($helper->allowDetectByPostcode()): ?>
253
- new Ajax.Autocompleter(
254
- 'billing:postcode',
255
- 'billing:postcode_autocomplete',
256
- '<?php