Shatam_Fixaddress - Version 1.0.0

Version Notes

Initial Relese

Download this release

Release Info

Developer shatam
Extension Shatam_Fixaddress
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Shatam/Fixaddress/Block/Address/Edit.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * To change this license header, choose License Headers in Project Properties.
5
+ * To change this template file, choose Tools | Templates
6
+ * and open the template in the editor.
7
+ */
8
+
9
+ class Shatam_Fixaddress_Block_Address_Edit extends Mage_Customer_Block_Address_Edit
10
+ {
11
+ public function getSelfName() {
12
+ $state=$this->escapeHtml($this->getAddress()->getRegion());
13
+ return $state;
14
+ }
15
+
16
+ }
app/code/local/Shatam/Fixaddress/etc/config.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <config>
3
+ <modules>
4
+ <Shatam_Fixaddress>
5
+ <version>0.1.0</version>
6
+ </Shatam_Fixaddress>
7
+ </modules>
8
+
9
+ <frontend>
10
+
11
+ <routers>
12
+ <shatam> I make this match my front name but I'm not sure it matters
13
+ <use>standard</use> Use standard routing as opposed to admin. IE: frontend vs admin
14
+ <args>
15
+ <module>Shatam_Fixaddress</module> The module to search for controllers
16
+ <frontName>shatam</frontName> The first descriminator in the path. "spinonesolutions" in http://localhost/spinonesolutions/
17
+ </args>
18
+ </shatam>
19
+ </routers>
20
+
21
+ <layout>
22
+
23
+ <updates>
24
+
25
+ <shatam>
26
+
27
+ <file>fixaddress.xml</file>
28
+
29
+ </shatam>
30
+ </updates>
31
+
32
+ </layout>
33
+
34
+ </frontend>
35
+
36
+ <blocks>
37
+
38
+ <blocks>
39
+
40
+ <rewrite>
41
+
42
+ <address_edit>Shatam_Fixaddress_Block_Address_Edit</address_edit>
43
+ <onepage_billing>Shatam_Fixaddress_Block_Address_Billing</onepage_billing>
44
+ <onepage_shiping>Shatam_Fixaddress_Block_Address_Shiping</onepage_shiping>
45
+ </rewrite>
46
+
47
+ </blocks>
48
+
49
+ </blocks>
50
+
51
+ </config>
app/design/frontend/default/default/layout/fixaddress.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ To change this license header, choose License Headers in Project Properties.
4
+ To change this template file, choose Tools | Templates
5
+ and open the template in the editor.
6
+ -->
7
+
8
+
9
+ <layout version="0.1.0">
10
+
11
+ <customer_address_form>
12
+ <reference name="customer_address_edit">
13
+ <action method="setTemplate">
14
+ <template>shatam/edit.phtml</template>
15
+ </action>
16
+ </reference>
17
+ </customer_address_form>
18
+
19
+ <checkout_onepage_index>
20
+ <reference name="checkout.onepage.billing">
21
+ <action method="setTemplate">
22
+ <template>shatam/billing.phtml</template>
23
+ </action>
24
+ </reference>
25
+ </checkout_onepage_index>
26
+
27
+ <checkout_onepage_index>
28
+ <reference name="checkout.onepage.shipping">
29
+ <action method="setTemplate">
30
+ <template>shatam/shipping.phtml</template>
31
+ </action>
32
+ </reference>
33
+ </checkout_onepage_index>
34
+
35
+ </layout>
app/design/frontend/default/default/template/shatam/billing.phtml ADDED
@@ -0,0 +1,893 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+
29
+ <script >
30
+ function demop()
31
+ {
32
+
33
+
34
+ alert("<?php echo $this->getAddress()->getCustomerAddressId(); ?>");
35
+ // document.getElementById('billing-buttons-container').style.display = "block";
36
+ // document.getElementById('billing').style.display = "none";
37
+ }
38
+
39
+ var selectState="<?php echo $this->escapeHtml($this->getAddress()->getRegion())?>";
40
+
41
+ function demo(a)
42
+ {
43
+
44
+ selectState=a;
45
+ }
46
+
47
+ var map = {'Arizona': 'AZ', 'Alabama':'AL','Alaska':'AK','Arkansas':'AR','American Samoa':'AS','California':'CA','Colorado':'CO','Connecticut':'CT','Delaware':'DE',
48
+ 'District of Columbia':'DC','Florida':'FL','Federated States of Micronesia':'FM','Georgia':'GA','Hawaii':'HI','Guam':'GU','Idaho':'ID','Illinois':'IL','Iowa':'IA',
49
+ 'Indiana':'IN','Kansas':'Ks','Kentucky':'KY','Louisiana':'LA','Maine':'ME','Maryland':'MD','Massachusetts':'MA',
50
+ 'Marshall Islands':'MH','Michigan':'MI','Minnesota':'MN','Northern Mariana Islands':'MP','Mississippi':'MS','Missouri':'MO','Montana':'MT','North Carolina':'NC',
51
+ 'North Dakota':'ND','Nebraska':'NE','New Hampshire':'NH','New Jersey':'NJ','New Mexico':'NM','New York':'NY','Nevada':'NV','Ohio':'OH','Oklahoma':'OK','Oregon':'OR','Pennsylvania':'PA',
52
+ 'Puerto Rico':'PR','Palau':'PW','Rhode Island':'RI','South Carolina':'SC','South Dakota':'SD',
53
+ 'Tennessee':'TN','Texas':'TX','U.S. Minor Outlying Islands':'UM','Utah':'UT','Virginia':'VA','Virgin Islands':'VI','Vermont':'VT','Washington':'WA','West Virginia':'WV','Wisconsin':'WA','Wyoming':'WY'};
54
+ function getValue(state)
55
+ {
56
+
57
+ if (state in map)
58
+ {
59
+ return map[state];
60
+ }
61
+ else
62
+ {
63
+ return 'Not US state!!!!';
64
+ }
65
+ }
66
+
67
+ // create the XMLHttpRequest object, according browser
68
+ function get_XmlHttp() {
69
+ // create the variable that will contain the instance of the XMLHttpRequest object (initially with null value)
70
+ var xmlHttp = null;
71
+
72
+ if(window.XMLHttpRequest) { // for Forefox, IE7+, Opera, Safari, ...
73
+ xmlHttp = new XMLHttpRequest();
74
+ }
75
+ else if(window.ActiveXObject) { // for Internet Explorer 5 or 6
76
+ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
77
+ }
78
+
79
+ return xmlHttp;
80
+ }
81
+
82
+
83
+
84
+ function chckSpace(val){
85
+ var pattr=/\s{2,}/g;
86
+ if(val.match(pattr)){
87
+
88
+ return val.replace(/\s{2,}/g," ");
89
+ }
90
+ else{return val;}
91
+ }
92
+
93
+
94
+ function chkcontainOnlyWhitespace(val){
95
+ var isnum = /^\s+/.test(val);
96
+ if(isnum==true){
97
+
98
+ return val.replace(/^\s+/,"");}
99
+ else{return val;}
100
+ }
101
+
102
+
103
+ function chkNonWordChar(vall){
104
+ var pattrs=/[^A-Za-z0-9\s_]{2,}/g;
105
+ if(vall.match(pattrs)){
106
+
107
+ var result= vall.replace(/[^A-Za-z0-9\s_]{2,}/g,"");
108
+
109
+ return result;
110
+ }
111
+ else{return vall;}
112
+ }
113
+
114
+ function chkZero(vall){
115
+ var patt=/^[^1-9]+\s[0_9a-zA-Z]+/g;
116
+ if(vall.match(patt))
117
+ {
118
+ return true;
119
+ }else{
120
+ return false;
121
+ }
122
+
123
+ }
124
+
125
+ function chkZip(val){
126
+ var pat=/^[^1-9]+/g;
127
+
128
+ if(val.match(pat))
129
+ {
130
+ return true;
131
+ }else{
132
+ return false;
133
+ }
134
+ }
135
+
136
+
137
+ function ifUss(){
138
+ document.getElementById('shatam').style.display = "none";
139
+ var array_resp="";
140
+
141
+ var request = get_XmlHttp();
142
+ var street = document.getElementById('billing:street1').value;
143
+
144
+
145
+
146
+ var street2=document.getElementById("billing:street2").value
147
+ var city=document.getElementById('billing:city').value;
148
+
149
+ var state=selectState;
150
+
151
+ var zip=document.getElementById('billing:postcode').value;
152
+
153
+ var abbr=getValue(state);
154
+
155
+
156
+ document.getElementById('pp').style.display = "block";
157
+ // alert("Please wait .... address validation is in process.");
158
+
159
+ var url = 'http://Fixaddress.com/API3/SAC/?address1='+street+"&address2="+street2+"&city="+city+"&state="+abbr+"&zip="+zip;
160
+ // alert(url);
161
+ request.open("GET", url, false); // define the request
162
+
163
+
164
+ request.send(null); // sends data
165
+
166
+
167
+ var address = request.responseText;
168
+ // alert("kk="+address);
169
+
170
+ if(address!="Internal Server Error Occurred !"){
171
+
172
+ document.getElementById('hiddendivid').style.display = "block";
173
+ // alert("pirti");
174
+ var foo = document.getElementById("hiddendivid");
175
+
176
+ var myb = document.createElement('p');
177
+ foo.appendChild(myb);
178
+
179
+
180
+
181
+
182
+ var oridiv = document.getElementById("origionaladd");
183
+
184
+ oridiv.appendChild(myb);
185
+ var lab = document.createElement("label");
186
+ var element = document.createElement("input");
187
+ // alert("oriadd==="+changecolor(street,street)+" , "+changecolor(city,city)+" , "+changecolor(state,state)+" , "+changecolor(zip,zip));
188
+ var Oriadd=changecolor(street+" "+street2,street+" "+street2)+" , "+changecolor(city,city)+" , "+changecolor(state,state)+" , "+changecolor(zip,zip);
189
+
190
+ element.setAttribute("type", 'radio');
191
+ element.setAttribute("value",Oriadd);
192
+ element.setAttribute("name", 'radio');
193
+
194
+ lab.appendChild(element);
195
+
196
+ lab.innerHTML +=Oriadd;
197
+
198
+ oridiv.appendChild(lab);
199
+ oridiv.appendChild(myb);
200
+
201
+
202
+
203
+
204
+
205
+
206
+ var add=JSON.parse(address);
207
+
208
+ for(var j=0;j<=add.length-1;j++)
209
+ {
210
+
211
+ var str = JSON.stringify(add[j]);
212
+
213
+ var newArr = JSON.parse(str);
214
+
215
+ var CorrectZip=changecolor(zip,newArr[9]);
216
+ var CorrectStreet=changecolor(street,newArr[0]+" "+newArr[1]+" "+newArr[4]+" "+newArr[5]);
217
+ var CorrectCity=changecolor(city,newArr[7]);
218
+ var CorrectState=changecolor(newArr[8],newArr[8]);
219
+
220
+
221
+ var chkString=CorrectStreet+" , "+CorrectCity+" , "+CorrectState+" , "+CorrectZip;;
222
+ // alert(array_resp);
223
+ if(array_resp!==chkString)
224
+
225
+ {
226
+
227
+ array_resp=CorrectStreet+" , "+CorrectCity+" , "+CorrectState+" , "+CorrectZip;
228
+
229
+
230
+ var mybr = document.createElement('p');
231
+ document.body.appendChild(mybr);
232
+
233
+ //Add radio button
234
+ var label = document.createElement("label");
235
+ var element = document.createElement("input");
236
+
237
+ //Assign different attributes to the element.
238
+ element.setAttribute("type", 'radio');
239
+ element.setAttribute("value",array_resp);
240
+ element.setAttribute("name", 'radio');
241
+
242
+ label.appendChild(element);
243
+ label.innerHTML += array_resp;
244
+ var foo = document.getElementById("hiddendivid");
245
+ foo.appendChild(label);
246
+
247
+ foo.appendChild(mybr);
248
+
249
+ }
250
+ }
251
+ var coffee = document.getElementsByName('radio');
252
+
253
+ for (var i=0;i<coffee.length-1;i++)
254
+ {
255
+
256
+ if(i===0)
257
+ {
258
+
259
+ coffee[0].checked = true;
260
+ myFunction('first');
261
+ document.getElementById('billing-new-address-form').style.display = "none";
262
+
263
+ document.getElementById('listboxadd').style.display = "none";
264
+ document.getElementById('pp').style.display = "block";
265
+ document.getElementById('billing-buttons-container').style.display = "block";
266
+ document.getElementById('billing').style.display = "none";
267
+ }
268
+ }
269
+
270
+
271
+ }
272
+ else{
273
+ alert("Sorry!!due to internal server error address validation is currently unavailable.");
274
+ billing.save();
275
+ document.getElementById('billing-buttons-container').style.display = "block";
276
+ document.getElementById('billing').style.display = "none";
277
+
278
+ }
279
+
280
+ }
281
+
282
+
283
+
284
+ function changeText2(){
285
+
286
+ var array_resp="";
287
+
288
+ var request = get_XmlHttp();
289
+ var street = document.getElementById('billing:street1').value;
290
+
291
+
292
+
293
+ var street2=document.getElementById("billing:street2").value
294
+ var city=document.getElementById('billing:city').value;
295
+
296
+ var state=selectState;
297
+
298
+ var zip=document.getElementById('billing:postcode').value;
299
+
300
+ var abbr=getValue(state);
301
+
302
+
303
+
304
+
305
+ if(document.getElementById('billing-new-address-form').style.display=="none")
306
+ {
307
+
308
+ document.getElementById('billing-buttons-container').style.display = "block";
309
+
310
+ document.getElementById('billing').style.display = "none";
311
+ }
312
+
313
+ else{
314
+
315
+ street= chckSpace(street);
316
+ street=chkcontainOnlyWhitespace(street);
317
+ street= chkNonWordChar(street);
318
+ document.getElementById('billing:street1').value=street;
319
+
320
+ street2= chckSpace(street2);
321
+ street2=chkcontainOnlyWhitespace(street2);
322
+ street2= chkNonWordChar(street2);
323
+ document.getElementById("billing:street2").value = street2;
324
+
325
+
326
+ city= chckSpace(city);
327
+ city=chkcontainOnlyWhitespace(city);
328
+ city= chkNonWordChar(city);
329
+ document.getElementById('billing:city').value=city;
330
+
331
+ zip= chckSpace(zip);
332
+ zip=chkcontainOnlyWhitespace(zip);
333
+ document.getElementById('billing:postcode').value=zip;
334
+
335
+
336
+ var isnum = /^\d+$/.test(street);
337
+
338
+ if(isnum==true){
339
+ alert("Enter correct street address.");
340
+ }else{
341
+
342
+
343
+ if(street.length==0){alert("Street address is blank.");}else{
344
+ if(street.length<6){alert("Street name is too small.");}else{
345
+ if(street.length>100){alert("Street name is too large.");}else{
346
+ if(chkZero(street)==true){alert("Invalid house number.");}else{
347
+ if(city.length==0){alert("City name is blank.");}else{
348
+ if(city.length<3){alert("City name is too small.");}else{
349
+ if(chkZip(zip)==true){alert("Invalid zip.");}else{
350
+ if(zip.length==0){alert("Zip is blank.");}else{
351
+ if(zip.length<5){alert("Zip length is too small.");}else{
352
+ if(zip.length>11){alert("Zip length is too large.");}else{
353
+
354
+ var Pattern = /^\d{2,8}\s+[0-9A-Za-z]+/g;
355
+
356
+ // alert(street.match(Pattern));
357
+ if (!street.match(Pattern)) {
358
+ // alert('error');
359
+ alert("Invalid street address.");
360
+ return;
361
+ }
362
+ else{
363
+ var adrregex = /\d{2}\s/g;
364
+ if(!street.match(adrregex)){
365
+ alert("House number is required in the street address.");
366
+ }
367
+
368
+ else{
369
+ var patt=/\d{7}\s*/g;
370
+ if(street.match(patt)){
371
+ alert("Invalid street address.");
372
+ }
373
+
374
+ else{
375
+
376
+
377
+
378
+ var e = document.getElementById("billing:country_id");
379
+ var strUser = e.options[e.selectedIndex].text;
380
+ // alert('show');
381
+ if(strUser=='United States')
382
+ {
383
+ document.getElementById('shatam').style.display = "block";
384
+
385
+ setTimeout(function(){ifUss()},3000);
386
+
387
+ }
388
+
389
+ else{
390
+
391
+ billing.save();
392
+ document.getElementById('billing-buttons-container').style.display = "block";
393
+ document.getElementById('billing').style.display = "none";
394
+ }
395
+
396
+
397
+
398
+ }}}}}}}}}}}}}}
399
+
400
+ }
401
+
402
+
403
+
404
+ }
405
+
406
+
407
+
408
+ function myFunction(k)
409
+ {
410
+
411
+ var coffee = document.getElementsByName('radio');
412
+
413
+ var txt = "";
414
+
415
+ var i;
416
+ if(document.getElementById('billing-new-address-form').style.display=="none")
417
+ {
418
+ if(document.getElementById('pp').style.display == "block"){
419
+ myFunction2(coffee,k);
420
+
421
+ }
422
+ else{
423
+
424
+ billing.save();
425
+
426
+ document.getElementById('billing-buttons-container').style.display = "none";
427
+ document.getElementById('billing').style.display = "block";
428
+ }
429
+ }
430
+ else
431
+ {
432
+ myFunction2(coffee,k);
433
+
434
+
435
+ }
436
+
437
+ }
438
+
439
+ function myFunction2(coffee,k){
440
+ var txt = "";
441
+
442
+ var i;
443
+
444
+ if(coffee.length > 0)
445
+ {
446
+ if(coffee[0].checked)
447
+ {
448
+ var n=coffee[0].parentNode.childNodes.length;
449
+
450
+ for (var l=0;l<=n-1;l++){
451
+
452
+ txt = txt + coffee[0].parentNode.childNodes[l].innerHTML + " ";
453
+
454
+ }
455
+
456
+ var replace=txt.replace(/undefined/gi,",");
457
+ // txt = txt + coffee[0].value+"";
458
+ var result=replace.split(",");
459
+ document.getElementById("billing:street2").value = "";
460
+ document.getElementById('billing:city').value=result[1];
461
+ document.getElementById('billing:street1').value=result[0];
462
+
463
+ document.getElementById('billing:postcode').value=result[3];
464
+
465
+ if(k==='sub'){
466
+
467
+
468
+ document.getElementById('billing-buttons-container').style.display = "none";
469
+
470
+ document.getElementById('billing').style.display = "block";
471
+
472
+ document.getElementById('listboxadd').style.display = "block";
473
+
474
+ document.getElementById('billing-new-address-form').style.display = "block";
475
+
476
+ document.getElementById('pp').style.display = "none";
477
+ var h;
478
+
479
+ for (h=0;coffee.length!==0;h--)
480
+ {
481
+
482
+
483
+ coffee[h].parentNode.parentNode.removeChild( coffee[h].parentNode );
484
+ h++;
485
+
486
+
487
+ }
488
+
489
+ document.getElementById('hiddendivid').style.display="none";
490
+
491
+ billing.save();
492
+ }
493
+ }
494
+ else
495
+ {
496
+
497
+ for (i=1;i<=coffee.length-1;i++)
498
+ {
499
+
500
+ if (coffee[i].checked)
501
+ {
502
+
503
+ var n=coffee[i].parentNode.childNodes.length;
504
+
505
+ for (l=0;l<=n-1;l++){
506
+
507
+ txt = txt + coffee[i].parentNode.childNodes[l].innerHTML + " ";
508
+
509
+ }
510
+
511
+ var replac=txt.replace(/undefined/gi,",");
512
+
513
+ var result=replac.split(",");
514
+
515
+ document.getElementById("billing:street2").value = "";
516
+ document.getElementById('billing:city').value=result[1];
517
+ document.getElementById('billing:street1').value=result[0];
518
+
519
+ document.getElementById('billing:postcode').value=result[3];
520
+ if(k==='sub'){
521
+
522
+ document.getElementById('billing-buttons-container').style.display = "none";
523
+
524
+ document.getElementById('billing').style.display = "block";
525
+
526
+ document.getElementById('listboxadd').style.display = "block";
527
+
528
+ document.getElementById('billing-new-address-form').style.display = "block";
529
+
530
+ document.getElementById('pp').style.display = "none";
531
+
532
+ var d;
533
+
534
+ for (d=0;coffee.length!==0;d--)
535
+ {
536
+
537
+ coffee[d].parentNode.parentNode.removeChild( coffee[d].parentNode );
538
+ d++;
539
+ }
540
+ document.getElementById('hiddendivid').style.display="none";
541
+ billing.save();
542
+ }
543
+ }
544
+ }
545
+ }
546
+ }
547
+ else{
548
+
549
+
550
+ changeText2();
551
+
552
+ document.getElementById('billing-buttons-container').style.display = "block";
553
+ document.getElementById('billing').style.display = "none";
554
+ }
555
+ }
556
+
557
+
558
+ function changecolor(val1,val2){
559
+ var result;
560
+ var m=val1.indexOf(val2);
561
+
562
+ if(m===-1){
563
+
564
+ result= "<span style='color:#1e7ec8;'>"+val2+"</span>";
565
+ }
566
+ else{
567
+
568
+ result= "<span style='color:#000000;'>"+val2+"</span>";
569
+
570
+ }
571
+ return result;
572
+ }
573
+
574
+
575
+
576
+
577
+ var specialKeys = new Array();
578
+ specialKeys.push(8); //Backspace
579
+ function IsNumeric(e) {
580
+
581
+ var keyCode = e.which ? e.which : e.keyCode
582
+ var ret = ((keyCode >= 48 && keyCode <= 57) || specialKeys.indexOf(keyCode) != -1||keyCode==45);
583
+ if(ret==false){
584
+ if((keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122))
585
+ {
586
+ alert("Alphabets are not allowed.");
587
+ }
588
+ else
589
+ {
590
+ alert("Special charectors are not allowed.");
591
+ }
592
+ }
593
+
594
+ return ret;//}
595
+ }
596
+
597
+
598
+
599
+ var specialKeys2 = new Array();
600
+ specialKeys2.push(8); //Backspace
601
+ specialKeys2.push(9); //Tab
602
+ specialKeys2.push(46); //Delete
603
+ specialKeys2.push(36); //Home
604
+ specialKeys2.push(35); //End
605
+ specialKeys2.push(37); //Left
606
+ specialKeys2.push(39); //Right
607
+ function IsAlphaNumeric(e) {
608
+ var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
609
+ var ret = ((keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122) || (specialKeys2.indexOf(e.keyCode) != -1 && e.charCode != e.keyCode));
610
+
611
+ return ret;
612
+ }
613
+
614
+
615
+
616
+ var specialKeys23 = new Array();
617
+ specialKeys23.push(8); //Backspace
618
+ specialKeys23.push(9); //Tab
619
+ specialKeys23.push(46); //Delete
620
+ specialKeys23.push(36); //Home
621
+ specialKeys23.push(35); //End
622
+ specialKeys23.push(37); //Left
623
+ specialKeys23.push(39); //Right
624
+ function IsAlpha(e) {
625
+
626
+ var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
627
+ var ret = ((keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122) || (specialKeys23.indexOf(e.keyCode) != -1 && e.charCode != e.keyCode));
628
+
629
+
630
+ if(keyCode=='32'||keyCode=='39'||keyCode=='45'||keyCode=='46'){
631
+ return true;}else{
632
+
633
+ if(ret==false){
634
+
635
+ if(keyCode>='48'&& keyCode<='57')
636
+ {
637
+ alert("Numbers are not allowed.");
638
+ }else{
639
+ alert("Only ' - . these special charectors are allowed.");
640
+ }
641
+ }
642
+
643
+ return ret;
644
+ }
645
+ }
646
+
647
+
648
+ function validateSpecialCharacters(e)
649
+ {
650
+ var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
651
+
652
+ var spclChars = "!@$%^*()<>\\|}{[]_+=\";"; // specify special characters
653
+ var content = document.getElementById("billing:street1").value;
654
+
655
+ if (spclChars.indexOf(String.fromCharCode(keyCode)) != -1)
656
+ {
657
+ alert ("Only - . , & ' # these special charectors are allowed.");
658
+
659
+ return false;
660
+ }
661
+ }
662
+ //<p class="required"><?php echo $this->__('* Required Fields') ?></p>
663
+ </script>
664
+ <form id="co-billing-form" action="">
665
+ <fieldset>
666
+ <ul class="form-list" id="billingAddress">
667
+ <?php if ($this->customerHasAddresses()): ?>
668
+ <li class="wide" id="listboxadd" style="display: block;">
669
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
670
+ <div class="input-box">
671
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
672
+ </div>
673
+ </li>
674
+ <?php endif; ?>
675
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?> >
676
+ <fieldset>
677
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
678
+ <ul>
679
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress()->getFirstname() ? $this->getAddress() : $this->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$this->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
680
+ <li class="fields">
681
+ <div class="field">
682
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
683
+ <div class="input-box">
684
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
685
+ </div>
686
+ </div>
687
+ <?php if(!$this->isCustomerLoggedIn()): ?>
688
+ <div class="field">
689
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
690
+ <div class="input-box">
691
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
692
+ </div>
693
+ </div>
694
+ <?php endif; ?>
695
+ </li>
696
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
697
+ <li class="wide">
698
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
699
+ <div class="input-box">
700
+ <input type="text" placeholder="Line 1" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onkeypress="return validateSpecialCharacters(event);" ondrop="return false;"
701
+ onpaste="return false;"/>
702
+ </div>
703
+ </li>
704
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
705
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
706
+ <li class="wide">
707
+ <div class="input-box">
708
+ <input type="text" placeholder="Line 2" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onkeypress="return validateSpecialCharacters(event);" ondrop="return false;"
709
+ onpaste="return false;"/>
710
+ </div>
711
+ </li>
712
+ <?php endfor; ?>
713
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
714
+ <li class="wide">
715
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number') ?></label>
716
+ <div class="input-box">
717
+ <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
718
+ </div>
719
+ </li>
720
+ <?php endif; ?>
721
+ <li class="fields">
722
+ <div class="field">
723
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
724
+ <div class="input-box">
725
+ <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="billing:city" onkeypress="return IsAlpha(event);" ondrop="return false;"
726
+ onpaste="return false;"/>
727
+ </div>
728
+ </div>
729
+ <div class="field">
730
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
731
+ <div class="input-box">
732
+ <select id="billing:region_id" onchange="demo(this.options[this.selectedIndex].text)" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
733
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
734
+ </select>
735
+ <script type="text/javascript">
736
+ //<![CDATA[
737
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
738
+ //]]>
739
+ </script>
740
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
741
+ </div>
742
+ </div>
743
+ </li>
744
+ <li class="fields">
745
+ <div class="field">
746
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
747
+ <div class="input-box">
748
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onkeypress="return IsNumeric(event);" ondrop="return false;"
749
+ onpaste="return false;"/>
750
+ </div>
751
+ </div>
752
+ <div class="field">
753
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
754
+ <div class="input-box">
755
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
756
+ </div>
757
+ </div>
758
+ </li>
759
+ <li class="fields">
760
+ <div class="field">
761
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
762
+ <div class="input-box">
763
+ <input type="text" name="billing[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
764
+ </div>
765
+ </div>
766
+ <div class="field">
767
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
768
+ <div class="input-box">
769
+ <input type="text" name="billing[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
770
+ </div>
771
+ </div>
772
+ </li>
773
+ <?php if(!$this->isCustomerLoggedIn()): ?>
774
+
775
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
776
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
777
+ <?php if ($_dob->isEnabled() || $_gender->isEnabled()): ?>
778
+ <li class="fields">
779
+ <?php if ($_dob->isEnabled()): ?>
780
+ <div class="field">
781
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
782
+ </div>
783
+ <?php endif; ?>
784
+ <?php if ($_gender->isEnabled()): ?>
785
+ <div class="field">
786
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
787
+ </div>
788
+ <?php endif ?>
789
+ </li>
790
+ <?php endif ?>
791
+
792
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
793
+ <?php if ($_taxvat->isEnabled()): ?>
794
+ <li>
795
+ <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
796
+ </li>
797
+ <?php endif ?>
798
+
799
+ <li class="fields" id="register-customer-password">
800
+ <div class="field">
801
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
802
+ <div class="input-box">
803
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
804
+ </div>
805
+ </div>
806
+ <div class="field">
807
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
808
+ <div class="input-box">
809
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
810
+ </div>
811
+ </div>
812
+ </li>
813
+ <?php endif; ?>
814
+
815
+ </ul>
816
+ </fieldset>
817
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
818
+ </li>
819
+
820
+
821
+
822
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
823
+ <li class="control" id="pp" style="display: none;">
824
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if(window.shipping) shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
825
+ </li>
826
+ <?php else:?>
827
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
828
+ <?php endif; ?>
829
+ <?php echo $this->getChildHtml('form.additional.info'); ?>
830
+
831
+
832
+
833
+
834
+
835
+
836
+ <?php /* Extensions placeholder */ ?>
837
+ <?php echo $this->getChildHtml('checkout.onepage.billing.extra')?>
838
+ <?php if ($this->canShip()): ?>
839
+ <li class="control">
840
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
841
+ <li class="control">
842
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
843
+ </li>
844
+ <?php endif; ?>
845
+ </ul>
846
+ <?php if (!$this->canShip()): ?>
847
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
848
+ <?php endif; ?>
849
+ <div class="buttons-set" id="billing">
850
+
851
+ <button type="button" class="button" onclick="changeText2()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
852
+ <div id="shatam" style="display: none;" >
853
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Please wait .... address validation is in process...') ?>" title="<?php echo $this->__('Please wait .... address validation is in process') ?>" class="v-middle" /> <?php echo $this->__('Please wait address validation is in process..') ?>
854
+ </div>
855
+ </div>
856
+
857
+
858
+ <div class="fieldset" id="hiddendivid" style="display: none;">
859
+ <h2 class="legend">Correct Addresses</h2>
860
+ There's a problem with the address provided - we've marked our suggestions in below. Please choose which version of the address you want to use, and click to the address you want to select.
861
+ <p></p>
862
+
863
+ <div id="origionaladd">
864
+ <h4>Address you entered...<h4>
865
+ </div>
866
+
867
+ <h3>Corrected addresses:<h3>
868
+
869
+ </div>
870
+
871
+
872
+ <div class="buttons-set" id="billing-buttons-container" style="display: none;">
873
+
874
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="myFunction('sub')"><span><span><?php echo $this->__('Click To Continue') ?></span></span></button>
875
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
876
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
877
+ </span>
878
+ </div>
879
+
880
+ </fieldset>
881
+ </form>
882
+ <script type="text/javascript">
883
+ //<![CDATA[
884
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
885
+
886
+ var billingForm = new VarienForm('co-billing-form');
887
+
888
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
889
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
890
+
891
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'billing:postcode');
892
+ //]]>
893
+ </script>
app/design/frontend/default/default/template/shatam/edit.phtml ADDED
@@ -0,0 +1,743 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <script >
29
+
30
+ var selectState="<?php echo $this->escapeHtml($this->getAddress()->getRegion())?>";
31
+
32
+ function demo(a)
33
+ {
34
+
35
+ selectState=a;
36
+ }
37
+
38
+ var map = {'Arizona': 'AZ', 'Alabama':'AL','Alaska':'AK','Arkansas':'AR','American Samoa':'AS','California':'CA','Colorado':'CO','Connecticut':'CT','Delaware':'DE',
39
+ 'District of Columbia':'DC','Florida':'FL','Federated States of Micronesia':'FM','Georgia':'GA','Hawaii':'HI','Guam':'GU','Idaho':'ID','Illinois':'IL','Iowa':'IA',
40
+ 'Indiana':'IN','Kansas':'Ks','Kentucky':'KY','Louisiana':'LA','Maine':'ME','Maryland':'MD','Massachusetts':'MA',
41
+ 'Marshall Islands':'MH','Michigan':'MI','Minnesota':'MN','Northern Mariana Islands':'MP','Mississippi':'MS','Missouri':'MO','Montana':'MT','North Carolina':'NC',
42
+ 'North Dakota':'ND','Nebraska':'NE','New Hampshire':'NH','New Jersey':'NJ','New Mexico':'NM','New York':'NY','Nevada':'NV','Ohio':'OH','Oklahoma':'OK','Oregon':'OR','Pennsylvania':'PA',
43
+ 'Puerto Rico':'PR','Palau':'PW','Rhode Island':'RI','South Carolina':'SC','South Dakota':'SD',
44
+ 'Tennessee':'TN','Texas':'TX','U.S. Minor Outlying Islands':'UM','Utah':'UT','Virginia':'VA','Virgin Islands':'VI','Vermont':'VT','Washington':'WA','West Virginia':'WV','Wisconsin':'WA','Wyoming':'WY'};
45
+
46
+ function getValue(state)
47
+ {
48
+
49
+ if (state in map)
50
+ {
51
+ return map[state];
52
+ }
53
+ else
54
+ {
55
+ return 'Not US state!!!!';
56
+ }
57
+ }
58
+
59
+ //Object.prototype.getKeyValue = function(value)
60
+ //{
61
+ //
62
+ // for(var key in this)
63
+ // {
64
+ // if(this[key] == value)
65
+ // {
66
+ // return key;
67
+ // }
68
+ // }
69
+ //
70
+ //}
71
+
72
+
73
+ // create the XMLHttpRequest object, according browser
74
+ function get_XmlHttp() {
75
+ // create the variable that will contain the instance of the XMLHttpRequest object (initially with null value)
76
+ var xmlHttp = null;
77
+
78
+ if(window.XMLHttpRequest) { // for Forefox, IE7+, Opera, Safari, ...
79
+ xmlHttp = new XMLHttpRequest();
80
+ }
81
+ else if(window.ActiveXObject) { // for Internet Explorer 5 or 6
82
+ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
83
+ }
84
+
85
+ return xmlHttp;
86
+ }
87
+
88
+ function chckSpace(val){
89
+ var pattr=/\s{2,}/g;
90
+ if(val.match(pattr)){
91
+
92
+ return val.replace(/\s{2,}/g," ");
93
+ }
94
+ else{return val;}
95
+ }
96
+
97
+
98
+ function chkcontainOnlyWhitespace(val){
99
+ var isnum = /^\s+/.test(val);
100
+ if(isnum==true){
101
+
102
+ return val.replace(/^\s+/,"");}
103
+ else{return val;}
104
+ }
105
+
106
+
107
+ function chkNonWordChar(vall){
108
+ var pattrs=/[^A-Za-z0-9\s_]{2,}/g;
109
+ if(vall.match(pattrs)){
110
+
111
+ var result= vall.replace(/[^A-Za-z0-9\s_]{2,}/g,"");
112
+
113
+ return result;
114
+ }
115
+ else{return vall;}
116
+ }
117
+
118
+ function chkZero(vall){
119
+ var patt=/^[^1-9]+\s[0_9a-zA-Z]+/g;
120
+ if(vall.match(patt))
121
+ {
122
+ return true;
123
+ }else{
124
+ return false;
125
+ }
126
+
127
+ }
128
+
129
+ function chkZip(val){
130
+ var pat=/^[^1-9]+/g;
131
+
132
+ if(val.match(pat))
133
+ {
134
+ return true;
135
+ }else{
136
+ return false;
137
+ }
138
+ }
139
+
140
+ function ifUS(abbr,state){
141
+
142
+ var street = document.getElementById('street_1').value;
143
+ var street2 = document.getElementById('street_2').value;
144
+ var city=document.getElementById('city').value;
145
+ var reg=document.getElementById("region_id");
146
+ var zip=document.getElementById('zip').value;
147
+
148
+ var array_resp="";
149
+ var request = get_XmlHttp();
150
+ var url = 'http://Fixaddress.com/API3/SAC?address1='+street+"&address2="+street2+"&city="+city+"&state="+abbr+"&zip="+zip;
151
+
152
+ request.open("GET", url, false); // define the request
153
+
154
+
155
+
156
+ request.send(null); // sends data
157
+
158
+
159
+ var address = request.responseText;
160
+
161
+
162
+ document.getElementById('shatam').style.display = "none";
163
+
164
+
165
+ if(address!="Internal Server Error Occurred !")
166
+
167
+ {
168
+ if(address!="No Matching Address Found")
169
+ {
170
+ document.getElementById('hiddendivid').style.display = "block";
171
+ var foo = document.getElementById("hiddendivid");
172
+
173
+ var myb = document.createElement('p');
174
+ foo.appendChild(myb);
175
+
176
+
177
+
178
+
179
+ var oridiv = document.getElementById("origionaladd");
180
+
181
+ oridiv.appendChild(myb);
182
+ var lab = document.createElement("label");
183
+ var element = document.createElement("input");
184
+ var Oriadd=street+" "+street2+" , "+city+" , "+state+" , "+zip;
185
+
186
+ element.setAttribute("type", 'radio');
187
+ element.setAttribute("value",Oriadd);
188
+ element.setAttribute("name", 'radio');
189
+
190
+ lab.appendChild(element);
191
+
192
+ lab.innerHTML +=Oriadd;
193
+
194
+ oridiv.appendChild(lab);
195
+ oridiv.appendChild(myb);
196
+
197
+
198
+
199
+
200
+
201
+
202
+ var add=JSON.parse(address);
203
+
204
+ for(var j=0;j<=add.length-1;j++)
205
+ {
206
+
207
+ var str = JSON.stringify(add[j]);
208
+
209
+ var newArr = JSON.parse(str);
210
+
211
+ var CorrectZip=changecolor(zip,newArr[9]);
212
+ var CorrectStreet=changecolor(street,newArr[0]+" "+newArr[1]+" "+newArr[4]+" "+newArr[5]);
213
+ var CorrectCity=changecolor(city,newArr[7]);
214
+ var CorrectState=changecolor(newArr[8],newArr[8]);
215
+
216
+
217
+ var chkString=CorrectStreet+" , "+CorrectCity+" , "+CorrectState+" , "+CorrectZip;;
218
+ if(array_resp!==chkString)
219
+
220
+ {
221
+
222
+ array_resp=CorrectStreet+" , "+CorrectCity+" , "+CorrectState+" , "+CorrectZip;
223
+
224
+
225
+ var mybr = document.createElement('p');
226
+ document.body.appendChild(mybr);
227
+
228
+ var label = document.createElement("label");
229
+ var element = document.createElement("input");
230
+
231
+ element.setAttribute("type", 'radio');
232
+ element.setAttribute("value",array_resp);
233
+ element.setAttribute("name", 'radio');
234
+
235
+ label.appendChild(element);
236
+ label.innerHTML += array_resp;
237
+ var foo = document.getElementById("hiddendivid");
238
+ foo.appendChild(label);
239
+
240
+ foo.appendChild(mybr);
241
+
242
+ }
243
+
244
+ var coffee = document.getElementsByName('radio');
245
+ for (i=0;i<coffee.length;i++)
246
+ {
247
+
248
+ if(i==0)
249
+ {
250
+
251
+ coffee[0].checked = true;
252
+ myFunction('first');
253
+
254
+ document.getElementById('div').style.display = "block";
255
+
256
+ document.getElementById('chkaddress').style.display = "none";
257
+
258
+ document.getElementById('addressblock').style.display = "none";
259
+ }
260
+ }
261
+
262
+
263
+
264
+ }
265
+ }
266
+ else
267
+ {
268
+
269
+ alert("Sorry!!due to internal server error address validation is currently unavailable.");
270
+ document.getElementById('chkaddress').style.display = "none";
271
+ document.getElementById('div').style.display = "block";
272
+
273
+ }
274
+ }
275
+ else
276
+ {
277
+
278
+ alert("Sorry!!due to internal server error address validation is currently unavailable.");
279
+ document.getElementById('chkaddress').style.display = "none";
280
+ document.getElementById('div').style.display = "block";
281
+
282
+ }
283
+
284
+ }
285
+
286
+
287
+
288
+ function changeText2(){
289
+
290
+
291
+ var array_resp="";
292
+ var request = get_XmlHttp();
293
+ var street = document.getElementById('street_1').value;
294
+ street= chckSpace(street);
295
+ street=chkcontainOnlyWhitespace(street);
296
+ street= chkNonWordChar(street);
297
+ document.getElementById('street_1').value=street;
298
+
299
+ var street2 = document.getElementById('street_2').value;
300
+ street2= chckSpace(street2);
301
+ street2=chkcontainOnlyWhitespace(street2);
302
+ street2= chkNonWordChar(street2);
303
+ document.getElementById('street_2').value=street2;
304
+
305
+
306
+ var city=document.getElementById('city').value;
307
+ city= chckSpace(city);
308
+ city=chkcontainOnlyWhitespace(city);
309
+ city= chkNonWordChar(city);
310
+ document.getElementById('city').value=city;
311
+
312
+ var reg=document.getElementById("region_id");
313
+ var state=reg.options[reg.selectedIndex].text; ;
314
+
315
+ var zip=document.getElementById('zip').value;
316
+ zip= chckSpace(zip);
317
+ zip=chkcontainOnlyWhitespace(zip);
318
+
319
+ var isnum = /^\d+$/.test(street);
320
+
321
+ if(isnum==true){
322
+ alert("Enter correct street address.");
323
+ }else{
324
+
325
+ if(street.length==0){alert("Street address is blank.");}else{
326
+ if(street.length<6){alert("Street name too small.");}else{
327
+ if(street.length>100){alert("Street name too large.");}else{
328
+
329
+ if(city.length==0){alert("City name is blank.");}else{
330
+ if(city.length<3){alert("City name is too small.");}else{
331
+ if(chkZip(zip)==true){alert("Invalid zip.");}else{
332
+ if(zip.length==0){alert("Zip is blank.");}else{
333
+ if(zip.length<5){alert("Zip length is too small.");}else{
334
+ if(zip.length>11){alert("Zip length is too large.");}else{
335
+
336
+ var Pattern = /^\d{2,8}\s+[0-9A-Za-z]+/g;
337
+
338
+ // alert(street.match(Pattern));
339
+
340
+ if (!street.match(Pattern)) {
341
+ // alert('error');
342
+ alert("Invalid house number.");
343
+ return;
344
+ }
345
+ else{
346
+ var adrregex = /\d{2}\s/g;
347
+ if(!street.match(adrregex)){
348
+ alert("House number is required in the street address.");
349
+ }
350
+
351
+ else{
352
+ var patt=/\d{7}\s*/g;
353
+ if(street.match(patt)){
354
+ alert("Invalid street address.");
355
+ }
356
+
357
+ else{
358
+ if(chkZero(street)==true){alert("Invalid house number.");}else{
359
+
360
+ var abbr=getValue(state);
361
+
362
+
363
+ var e = document.getElementById("country");
364
+ var strUser = e.options[e.selectedIndex].text;
365
+
366
+ //http://208.113.232.126:3307/magentoPost
367
+ if(strUser=='United States'){
368
+
369
+
370
+
371
+
372
+ document.getElementById('shatam').style.display = "block";
373
+
374
+ setTimeout(function(){ifUS(abbr,state)},3000);
375
+
376
+ }
377
+
378
+
379
+
380
+
381
+ else{
382
+
383
+ document.getElementById('chkaddress').style.display = "none";
384
+ document.getElementById('div').style.display = "block";
385
+ }
386
+
387
+ }
388
+ }}}}}}}}}}}}}
389
+ }
390
+
391
+ function myFunction(k)
392
+ {
393
+
394
+ var coffee = document.getElementsByName('radio');
395
+
396
+ var txt = "";
397
+ var i;
398
+ if(coffee[0].checked)
399
+ {
400
+
401
+ txt = txt + coffee[0].value+"";
402
+ var result=txt.split(",");
403
+ document.getElementById("street_2").value = "";
404
+ document.getElementById("city").value=result[1];
405
+ document.getElementById('street_1').value=result[0];
406
+
407
+ document.getElementById('zip').value=result[3];
408
+ if(k==='sub'){
409
+ document.getElementById('addressblock').style.display = "block";
410
+
411
+ }
412
+ }
413
+ else
414
+ {
415
+ for (i=1;i<=coffee.length-1;i++)
416
+ {
417
+
418
+ if (coffee[i].checked)
419
+ {
420
+ var n=coffee[i].parentNode.childNodes.length;
421
+ for (l=0;l<=n-1;l++){
422
+
423
+ txt = txt + coffee[i].parentNode.childNodes[l].innerHTML + " ";
424
+ }
425
+
426
+ var replace=txt.replace(/undefined/gi,",");
427
+ var result=replace.split(",");
428
+
429
+ document.getElementById("street_2").value = "";
430
+ document.getElementById('city').value=result[1];
431
+ document.getElementById('street_1').value=result[0];
432
+
433
+ document.getElementById('zip').value=result[3];
434
+ if(k==='sub'){
435
+ document.getElementById('addressblock').style.display = "block";
436
+
437
+ }
438
+ }
439
+ }
440
+ }
441
+ }
442
+
443
+
444
+
445
+
446
+ function changecolor(val1,val2){
447
+ var result;
448
+ var m=val1.indexOf(val2);
449
+
450
+ if(m===-1){
451
+
452
+ result= "<span style='color:#1e7ec8;'>"+val2+"</span>";
453
+ }
454
+ else{
455
+
456
+ result= "<span style='color:#000000;'>"+val2+"</span>";
457
+
458
+ }
459
+ return result;
460
+ }
461
+
462
+ var specialKeys = new Array();
463
+ specialKeys.push(8); //Backspace
464
+ function IsNumeric(e) {
465
+
466
+ var keyCode = e.which ? e.which : e.keyCode
467
+
468
+
469
+
470
+ var ret = ((keyCode >= 48 && keyCode <= 57) || specialKeys.indexOf(keyCode) != -1||keyCode==45);
471
+
472
+ if(ret==false)
473
+ {
474
+ if((keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122))
475
+ {
476
+ alert("Alphabets are not allowed.");
477
+ }
478
+ else
479
+ {
480
+ alert("Special charecters are not allowed.");
481
+ }
482
+
483
+ }
484
+ return ret;//}
485
+ }
486
+
487
+
488
+
489
+ var specialKeys2 = new Array();
490
+ specialKeys2.push(8); //Backspace
491
+ specialKeys2.push(9); //Tab
492
+ specialKeys2.push(46); //Delete
493
+ specialKeys2.push(36); //Home
494
+ specialKeys2.push(35); //End
495
+ specialKeys2.push(37); //Left
496
+ specialKeys2.push(39); //Right
497
+ function IsAlphaNumeric(e) {
498
+
499
+ var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
500
+
501
+ var ret = ((keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122) || (specialKeys2.indexOf(e.keyCode) != -1 && e.charCode != e.keyCode));
502
+ //document.getElementById("error").style.display = ret ? "none" : "inline";
503
+ if(ret==false){
504
+
505
+ alert("Special charecters and alphabets are not allowed.");
506
+
507
+ }
508
+ return ret;
509
+ }
510
+
511
+
512
+
513
+ var specialKeys23 = new Array();
514
+ specialKeys23.push(8); //Backspace
515
+ specialKeys23.push(9); //Tab
516
+ specialKeys23.push(46); //Delete
517
+ specialKeys23.push(36); //Home
518
+ specialKeys23.push(35); //End
519
+ specialKeys23.push(37); //Left
520
+ specialKeys23.push(39); //Right
521
+
522
+ function IsAlpha(e) {
523
+
524
+
525
+
526
+ var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
527
+ var ret = ((keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122) || (specialKeys23.indexOf(e.keyCode) != -1 && e.charCode != e.keyCode));
528
+
529
+ if(keyCode=='32'||keyCode=='39'||keyCode=='45'||keyCode=='46'||e.altKey || e.ctrlKey){return true;}else{
530
+
531
+ if(ret==false){
532
+ if(keyCode>='48'&& keyCode<='57')
533
+ {
534
+ alert("Numbers are not allowed.");
535
+
536
+ }else{
537
+ alert("Only ' - . these special charecters are allowed.");
538
+ }
539
+ }
540
+ return ret;}
541
+ }
542
+
543
+
544
+
545
+ function validateSpecialCharacters(e)
546
+ {
547
+ var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
548
+
549
+ var spclChars = "!@$%^*()<>\\|}{[]_+=\"?:"; // specify special characters
550
+ var content = document.getElementById("street_1").value;
551
+
552
+ if (spclChars.indexOf(String.fromCharCode(keyCode)) != -1)
553
+ {
554
+ alert ("Only - . , & ' # these special charecters are allowed.");
555
+ //document.getElementById("street_1").value = "";
556
+ return false;
557
+ }
558
+ }
559
+
560
+
561
+
562
+ </script>
563
+
564
+
565
+
566
+ <?php
567
+ /**
568
+ * Edit customer address template
569
+ *
570
+ * @see Mage_Customer_Block_Address_Edit
571
+ */
572
+ ?>
573
+ <?php if($this->getTitle()): ?>
574
+
575
+
576
+
577
+ <div class="page-title">
578
+ <h1><?php echo $this->getTitle() ?></h1>
579
+ </div>
580
+ <?php endif; ?>
581
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
582
+ <form action="<?php echo $this->getSaveUrl() ?>" method="post" id="form-validate">
583
+ <div class="fieldset">
584
+ <?php echo $this->getBlockHtml('formkey')?>
585
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
586
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
587
+ <h2 class="legend"><?php echo $this->__('Contact Information') ?></h2>
588
+ <ul class="form-list">
589
+ <li class="fields">
590
+ <?php echo $this->getNameBlockHtml() ?>
591
+ </li>
592
+
593
+ <li class="wide">
594
+ <label for="company"><?php echo $this->__('Company') ?></label>
595
+ <div class="input-box">
596
+ <input type="text" name="company" id="company" title="<?php echo $this->__('Company') ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" />
597
+ </div>
598
+ </li>
599
+ <li class="fields">
600
+ <div class="field">
601
+ <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
602
+ <div class="input-box">
603
+ <input type="text" name="telephone" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="telephone" />
604
+ </div>
605
+ </div>
606
+ <div class="field">
607
+ <label for="fax"><?php echo $this->__('Fax') ?></label>
608
+ <div class="input-box">
609
+ <input type="text" name="fax" id="fax" title="<?php echo $this->__('Fax') ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" />
610
+ </div>
611
+ </div>
612
+ </li>
613
+ </ul>
614
+ </div>
615
+ <div class="fieldset" id="addressblock" style="display: block;">
616
+ <h2 class="legend"><?php echo $this->__('Address') ?></h2>
617
+ <ul class="form-list">
618
+
619
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
620
+ <li class="wide">
621
+ <label for="street_1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
622
+ <div class="input-box">
623
+
624
+ <input type="text" placeholder="Line 1" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="input-text <?php echo $_streetValidationClass ?>" onkeypress="return validateSpecialCharacters(event);" ondrop="return false;"
625
+ onpaste="return false;"/>
626
+ </div>
627
+ </li>
628
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
629
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
630
+ <li class="wide">
631
+ <div class="input-box">
632
+ <input type="text" placeholder="Line 2" name="street[]" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address %s', $_i) ?>" id="street_<?php echo $_i ?>" class="input-text <?php echo $_streetValidationClass ?>" onkeypress="return validateSpecialCharacters(event);" ondrop="return false;"
633
+ onpaste="return false;"/>
634
+ </div>
635
+ </li>
636
+ <?php endfor; ?>
637
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
638
+ <li class="wide">
639
+ <label for="vat_id"><?php echo $this->__('VAT Number') ?></label>
640
+ <div class="input-box">
641
+ <input type="text" name="vat_id" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()) ?>" title="<?php echo $this->__('VAT Number') ?>" id="vat_id" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
642
+ </div>
643
+ </li>
644
+ <?php endif; ?>
645
+ <li class="fields">
646
+ <div class="field">
647
+ <label for="city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
648
+ <div class="input-box">
649
+ <input type="text" name="city" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" onkeypress="return IsAlpha(event);" ondrop="return false;"
650
+ onpaste="return false;"/>
651
+ </div>
652
+ </div>
653
+ <div class="field">
654
+ <label for="region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
655
+ <div class="input-box">
656
+ <select id="region_id" onchange="demo(this.options[this.selectedIndex].text)" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
657
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
658
+ </select>
659
+ <script type="text/javascript">
660
+ //<![CDATA[
661
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
662
+ //]]>
663
+ </script>
664
+ <input type="text" id="region" name="region" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" />
665
+ </div>
666
+ </div>
667
+ </li>
668
+ <li class="fields">
669
+ <div class="field">
670
+ <label for="zip" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
671
+ <div class="input-box">
672
+ <input type="text" name="postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"/>
673
+ </div>
674
+ </div>
675
+ <div class="field">
676
+ <label for="country" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
677
+ <div class="input-box">
678
+ <?php echo $this->getCountryHtmlSelect() ?>
679
+ </div>
680
+ </div>
681
+ </li>
682
+ <li<?php if($this->canSetAsDefaultBilling()) echo ' class="control"' ?>>
683
+ <?php if($this->isDefaultBilling()): ?>
684
+ <strong><?php echo $this->__('Default Billing Address') ?></strong>
685
+ <?php elseif($this->canSetAsDefaultBilling()): ?>
686
+ <input type="checkbox" id="primary_billing" name="default_billing" value="1" title="<?php echo $this->__('Use as My Default Billing Address') ?>" class="checkbox" /><label for="primary_billing"><?php echo $this->__('Use as my default billing address') ?></label>
687
+ <?php else: ?>
688
+ <input type="hidden" name="default_billing" value="1" />
689
+ <?php endif; ?>
690
+ </li>
691
+ <li<?php if($this->canSetAsDefaultShipping()) echo ' class="control"' ?>>
692
+ <?php if($this->isDefaultShipping()): ?>
693
+ <strong><?php echo $this->__('Default Shipping Address') ?></strong>
694
+ <?php elseif($this->canSetAsDefaultShipping()): ?>
695
+ <input type="checkbox" id="primary_shipping" name="default_shipping" value="1" title="<?php echo $this->__('Use as My Default Shipping Address') ?>" class="checkbox" /><label for="primary_shipping"><?php echo $this->__('Use as my default shipping address') ?></label>
696
+ <?php else: ?>
697
+ <input type="hidden" name="default_shipping" value="1" />
698
+ <?php endif; ?>
699
+ </li>
700
+ </ul>
701
+ </div>
702
+ <div class="buttons-set" id="chkaddress">
703
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
704
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
705
+ <!-- <button type="submit" title="" class="button"><span><span><?php echo $this->__('fggghfg') ?></span></span></button>-->
706
+
707
+ <button type="button" style="padding:2px 6px 3px; border:#EE0000;background-color:#f18200; height:19px;color:white;font:bold 12px/19px Arial, Helvetica, sans-serif;text-align:center;vertical-align: middle;" onclick="changeText2()" value=" Save Address"><span><span>Save Address</span></span></button>
708
+ <div id="shatam" style="display: none;" >
709
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Please wait .... address validation is in process...') ?>" title="<?php echo $this->__('Please wait .... address validation is in process') ?>" class="v-middle" /> <?php echo $this->__('Please wait address validation is in process..') ?>
710
+ </div>
711
+ </div>
712
+
713
+
714
+
715
+ <!-- style="display: none;"-->
716
+
717
+ <div class="fieldset" id="hiddendivid" style="display: none;">
718
+ <h2 class="legend">Correct Addresses</h2>
719
+ There's a problem with the address provided - we've marked our suggestions in below. Please choose which version of the address you want to use, and click to the address you want to select.
720
+ <p></p>
721
+ <div id="origionaladd">
722
+ <h4>Address you entered...<h4>
723
+ </div>
724
+
725
+ <h4>Corrected addresses:<h4>
726
+
727
+ </div>
728
+
729
+
730
+ <div class="buttons-set" id="div" style="display: none;">
731
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
732
+ <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
733
+ <button type="submit" class="button" name="truemagentosubmit" id="truemagentosubmit" value="Save Address" onclick="myFunction('sub')"><span><span>Click To Continue</span></span></button>
734
+
735
+ </div>
736
+ </form>
737
+ <script type="text/javascript">
738
+ //<![CDATA[
739
+ var dataForm = new VarienForm('form-validate', true);
740
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
741
+
742
+ //]]>
743
+ </script>
app/design/frontend/default/default/template/shatam/shipping.phtml ADDED
@@ -0,0 +1,779 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+
28
+ <script>
29
+ var selectStateShiping="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>";
30
+
31
+ function sdemo(a)
32
+ {
33
+ // alert('kirti');
34
+ selectStateShiping=a;
35
+ }
36
+
37
+
38
+ var map = {'Arizona': 'AZ', 'Alabama':'AL','Alaska':'AK','Arkansas':'AR','American Samoa':'AS','California':'CA','Colorado':'CO','Connecticut':'CT','Delaware':'DE',
39
+ 'District of Columbia':'DC','Florida':'FL','Federated States of Micronesia':'FM','Georgia':'GA','Hawaii':'HI','Guam':'GU','Idaho':'ID','Illinois':'IL','Iowa':'IA',
40
+ 'Indiana':'IN','Kansas':'Ks','Kentucky':'KY','Louisiana':'LA','Maine':'ME','Maryland':'MD','Massachusetts':'MA',
41
+ 'Marshall Islands':'MH','Michigan':'MI','Minnesota':'MN','Northern Mariana Islands':'MP','Mississippi':'MS','Missouri':'MO','Montana':'MT','North Carolina':'NC',
42
+ 'North Dakota':'ND','Nebraska':'NE','New Hampshire':'NH','New Jersey':'NJ','New Mexico':'NM','New York':'NY','Nevada':'NV','Ohio':'OH','Oklahoma':'OK','Oregon':'OR','Pennsylvania':'PA',
43
+ 'Puerto Rico':'PR','Palau':'PW','Rhode Island':'RI','South Carolina':'SC','South Dakota':'SD',
44
+ 'Tennessee':'TN','Texas':'TX','U.S. Minor Outlying Islands':'UM','Utah':'UT','Virginia':'VA','Virgin Islands':'VI','Vermont':'VT','Washington':'WA','West Virginia':'WV','Wisconsin':'WA','Wyoming':'WY'};
45
+ function getValue(state)
46
+ {
47
+
48
+ if (state in map)
49
+ {
50
+ return map[state];
51
+ }
52
+ else
53
+ {
54
+ return 'Not US state!!!!';
55
+ }
56
+ }
57
+
58
+
59
+ function get_XmlHttp() {
60
+
61
+ var xmlHttp = null;
62
+
63
+ if(window.XMLHttpRequest) { // for Forefox, IE7+, Opera, Safari, ...
64
+ xmlHttp = new XMLHttpRequest();
65
+ }
66
+ else if(window.ActiveXObject) { // for Internet Explorer 5 or 6
67
+ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
68
+ }
69
+
70
+ return xmlHttp;
71
+ }
72
+
73
+
74
+
75
+ function chckSpace(val){
76
+ var pattr=/\s{2,}/g;
77
+ if(val.match(pattr)){
78
+
79
+ return val.replace(/\s{2,}/g," ");
80
+ }
81
+ else{return val;}
82
+ }
83
+
84
+
85
+ function chkcontainOnlyWhitespace(val){
86
+ var isnum = /^\s+/.test(val);
87
+ if(isnum==true){
88
+
89
+ return val.replace(/^\s+/,"");}
90
+ else{return val;}
91
+ }
92
+
93
+
94
+ function chkNonWordChar(vall){
95
+ var pattrs=/[^A-Za-z0-9\s_]{2,}/g;
96
+ if(vall.match(pattrs)){
97
+ // alert("Chacked Input Address!");
98
+ var result= vall.replace(/[^A-Za-z0-9\s_]{2,}/g,"");
99
+ // alert (vall.match(pattrs));
100
+ return result;
101
+ }
102
+ else{return vall;}
103
+ }
104
+
105
+ function chkZero(vall){
106
+ var patt=/^[^1-9]+\s[0_9a-zA-Z]+/g;
107
+ if(vall.match(patt))
108
+ {
109
+ return true;
110
+ }else{
111
+ return false;
112
+ }
113
+
114
+ }
115
+
116
+ function chkZip(val){
117
+ var pat=/^[^1-9]+/g;
118
+
119
+ if(val.match(pat))
120
+ {
121
+ return true;
122
+ }else{
123
+ return false;
124
+ }
125
+ }
126
+ function ifUs(){
127
+ document.getElementById('shatamK').style.display = "none";
128
+ var array_resp="";
129
+
130
+ var request = get_XmlHttp();
131
+ var street = document.getElementById('shipping:street1').value;
132
+ var street2=document.getElementById("shipping:street2").value;
133
+ var city=document.getElementById('shipping:city').value;
134
+
135
+ var state=selectStateShiping;
136
+
137
+ var zip=document.getElementById('shipping:postcode').value;
138
+
139
+ var abbr=getValue(state);
140
+
141
+ document.getElementById('qq').style.display = "block";
142
+ // alert("Please wait .... address validation is in process.");
143
+
144
+ var url = 'http://Fixaddress.com/API3/SAC/?address1='+street+"&address2="+street2+"&city="+city+"&state="+abbr+"&zip="+zip;
145
+ // alert(url);
146
+ request.open("GET", url, false); // define the request
147
+
148
+
149
+ request.send(null); // sends data
150
+
151
+
152
+ var address = request.responseText;
153
+ // alert("kk="+address);
154
+ if(address!="Internal Server Error Occurred !"){
155
+
156
+ document.getElementById('hiddendividd').style.display = "block";
157
+ // alert("kirti");
158
+ var foo = document.getElementById("hiddendividd");
159
+
160
+ var myb = document.createElement('p');
161
+ foo.appendChild(myb);
162
+
163
+
164
+
165
+
166
+ var oridiv = document.getElementById("origionaladdd");
167
+
168
+ oridiv.appendChild(myb);
169
+ var lab = document.createElement("label");
170
+ var element = document.createElement("input");
171
+ var Oriadd=street+" "+street2+" , "+city+" , "+state+" , "+zip;
172
+
173
+ element.setAttribute("type", 'radio');
174
+ element.setAttribute("value",Oriadd);
175
+ element.setAttribute("name", 'shipradio');
176
+
177
+ lab.appendChild(element);
178
+
179
+ lab.innerHTML +=Oriadd;
180
+
181
+ oridiv.appendChild(lab);
182
+ oridiv.appendChild(myb);
183
+
184
+
185
+
186
+
187
+
188
+
189
+ var add=JSON.parse(address);
190
+
191
+ for(var j=0;j<=add.length-1;j++)
192
+ {
193
+
194
+ var str = JSON.stringify(add[j]);
195
+
196
+ var newArr = JSON.parse(str);
197
+
198
+ var CorrectZip=shipChangecolor(zip,newArr[9]);
199
+ var CorrectStreet=shipChangecolor(street,newArr[0]+" "+newArr[1]+" "+newArr[4]+" "+newArr[5]);
200
+ var CorrectCity=shipChangecolor(city,newArr[7]);
201
+ var CorrectState=shipChangecolor(newArr[8],newArr[8]);
202
+
203
+
204
+ var chkString=CorrectStreet+" , "+CorrectCity+" , "+CorrectState+" , "+CorrectZip;;
205
+ // alert(array_resp);
206
+ if(array_resp!==chkString)
207
+
208
+ {
209
+
210
+ array_resp=CorrectStreet+" , "+CorrectCity+" , "+CorrectState+" , "+CorrectZip;
211
+
212
+
213
+ var mybr = document.createElement('p');
214
+ document.body.appendChild(mybr);
215
+
216
+ //Add radio button
217
+ var label = document.createElement("label");
218
+ var element = document.createElement("input");
219
+
220
+ //Assign different attributes to the element.
221
+ element.setAttribute("type", 'radio');
222
+ element.setAttribute("value",array_resp);
223
+ element.setAttribute("name", 'shipradio');
224
+
225
+ label.appendChild(element);
226
+ label.innerHTML += array_resp;
227
+ var foo = document.getElementById("hiddendividd");
228
+ foo.appendChild(label);
229
+
230
+ foo.appendChild(mybr);
231
+
232
+ }
233
+ }
234
+ var tea = document.getElementsByName('shipradio');
235
+ for (i=0;i<tea.length;i++)
236
+ {
237
+
238
+ if(i==0)
239
+ {
240
+
241
+ tea[0].checked = true;
242
+ shipMyFunction('first');
243
+ document.getElementById('shipping-new-address-form').style.display = "none";
244
+
245
+ document.getElementById('listboxaddd').style.display = "none";
246
+ document.getElementById('qq').style.display = "block";
247
+ document.getElementById('shipping-buttons-container').style.display = "block";
248
+ document.getElementById('shipping').style.display = "none";
249
+ }
250
+ }
251
+
252
+
253
+ }else{
254
+ alert("Sorry!!due to internal server error address validation is currently unavailable.");
255
+
256
+ shipping.save();
257
+ document.getElementById('shipping-buttons-container').style.display = "block";
258
+ document.getElementById('shipping').style.display = "none";
259
+ }
260
+ }
261
+
262
+
263
+ function shipChangeText2(){
264
+ var array_resp="";
265
+
266
+ var request = get_XmlHttp();
267
+ var street = document.getElementById('shipping:street1').value;
268
+ var street2=document.getElementById("shipping:street2").value;
269
+ var city=document.getElementById('shipping:city').value;
270
+
271
+ var state=selectStateShiping;
272
+
273
+ var zip=document.getElementById('shipping:postcode').value;
274
+
275
+ var abbr=getValue(state);
276
+
277
+
278
+
279
+
280
+
281
+ if(document.getElementById('shipping-new-address-form').style.display=="none"){
282
+
283
+ document.getElementById('shipping-buttons-container').style.display = "block";
284
+ document.getElementById('shipping').style.display = "none";
285
+ }else{
286
+
287
+ street= chckSpace(street);
288
+ street=chkcontainOnlyWhitespace(street);
289
+ street= chkNonWordChar(street);
290
+ document.getElementById('shipping:street1').value=street;
291
+
292
+ street2= chckSpace(street2);
293
+ street2=chkcontainOnlyWhitespace(street2);
294
+ street2= chkNonWordChar(street2);
295
+ document.getElementById("shipping:street2").value = street2;
296
+
297
+
298
+ city= chckSpace(city);
299
+ city=chkcontainOnlyWhitespace(city);
300
+ city= chkNonWordChar(city);
301
+ document.getElementById('shipping:city').value=city;
302
+
303
+ zip= chckSpace(zip);
304
+ zip=chkcontainOnlyWhitespace(zip);
305
+ document.getElementById('shipping:postcode').value=zip;
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+ var isnum = /^\d+$/.test(street);
314
+ if(isnum==true){
315
+ alert("Enter correct street address.");
316
+ }else{
317
+
318
+
319
+
320
+ if(street.length==0){alert("Street address is blank.");}else{
321
+ if(street.length<6){alert("Street name is too small.");}else{
322
+ if(street.length>100){alert("Street name is too large.");}else{
323
+ if(chkZero(street)==true){alert("Invalid house number.");}else{
324
+ if(city.length==0){alert("City name is blank.");}else{
325
+ if(city.length<3){alert("City name is too small.");}else{
326
+ if(chkZip(zip)==true){alert("Invalid zip.");}else{
327
+ if(zip.length==0){alert("Zip is blank.");}else{
328
+ if(zip.length<5){alert("Zip length is too small.");}else{
329
+ if(zip.length>11){alert("Zip length is too large.");}else{
330
+
331
+ var Pattern = /^\d{2,8}\s+[0-9A-Za-z]+/g;
332
+
333
+ // alert(street.match(Pattern));
334
+ if (!street.match(Pattern)) {
335
+ // alert('error');
336
+ alert("Invalid street address.");
337
+ return;
338
+ }
339
+ else{
340
+ var adrregex = /\d{2}\s/g;
341
+ if(!street.match(adrregex)){
342
+ alert("House number is required in the street address.");
343
+ }
344
+
345
+ else{
346
+ var patt=/\d{7}\s*/g;
347
+ if(street.match(patt)){
348
+ alert("Invalid street address.");
349
+ }
350
+
351
+
352
+ else{
353
+
354
+
355
+ var e = document.getElementById("shipping:country_id");
356
+ var strUser = e.options[e.selectedIndex].text;
357
+ // alert('show');
358
+ if(strUser=='United States'){
359
+
360
+ document.getElementById('shatamK').style.display = "block";
361
+
362
+ setTimeout(function(){ifUs()},3000);
363
+
364
+
365
+
366
+ }
367
+
368
+ else{
369
+
370
+ shipping.save();
371
+ document.getElementById('shipping-buttons-container').style.display = "block";
372
+ document.getElementById('shipping').style.display = "none";
373
+ }
374
+
375
+
376
+ }}}}}}}}}}}}}}
377
+ }
378
+
379
+ }
380
+
381
+ function shipMyFunction(k)
382
+ {
383
+ //alert('suc');
384
+ var tea = document.getElementsByName('shipradio');
385
+ //alert(tea.length);
386
+ var txt = "";
387
+ //alert("hello");
388
+ var i;
389
+ if(document.getElementById('shipping-new-address-form').style.display=="none")
390
+ {
391
+ if(document.getElementById('qq').style.display == "block"){
392
+ shipmyFunction2(tea,k);
393
+ }
394
+ else{
395
+ // alert("good!!...");
396
+ shipping.save();
397
+ document.getElementById('shipping-buttons-container').style.display = "none";
398
+
399
+ document.getElementById('shipping').style.display = "block";
400
+ }
401
+ }
402
+ else
403
+ {
404
+ shipmyFunction2(tea,k);
405
+
406
+ }
407
+ }
408
+
409
+ function shipmyFunction2(tea,k)
410
+ {
411
+ var txt = "";
412
+ //alert("hello");
413
+ var i;
414
+ if(tea.length > 0)
415
+ {
416
+
417
+ if(tea[0].checked)
418
+ {
419
+
420
+ txt = txt + tea[0].value+"";
421
+ var result=txt.split(",");
422
+ document.getElementById("shipping:street2").value = "";
423
+ document.getElementById('shipping:city').value=result[1];
424
+ document.getElementById('shipping:street1').value=result[0];
425
+
426
+ document.getElementById('shipping:postcode').value=result[3];
427
+ // alert("hellok");
428
+ if(k==='sub'){
429
+
430
+ document.getElementById('shipping-buttons-container').style.display = "none";
431
+ document.getElementById('shipping').style.display = "block";
432
+ document.getElementById('listboxaddd').style.display = "block";
433
+ document.getElementById('shipping-new-address-form').style.display = "block";
434
+ document.getElementById('qq').style.display = "none";
435
+ var d;
436
+ // var coffee = document.getElementsByName('radio');
437
+ for (d=0;tea.length!=0;d--)
438
+ {
439
+ //coffee[d].remove();
440
+ // tea[d].parentNode.innerHTML="";
441
+ tea[d].parentNode.parentNode.removeChild( tea[d].parentNode );
442
+ d++;
443
+ }
444
+ document.getElementById('hiddendividd').style.display="none";
445
+ // alert("Your Selected Address Is...\n"+"\nstreet="+result[0]+"\ncity="+result[1]+"\nstate="+result[2]+ "\nzip="+result[3]+"\n");
446
+ shipping.save();
447
+ }
448
+ }
449
+ else
450
+ {
451
+
452
+ for (i=1;i<=tea.length-1;i++)
453
+ {
454
+
455
+ if (tea[i].checked)
456
+ {
457
+ var n=tea[i].parentNode.childNodes.length;
458
+
459
+ for (l=0;l<=n-1;l++){
460
+
461
+ txt = txt + tea[i].parentNode.childNodes[l].innerHTML + " ";
462
+
463
+ }
464
+
465
+ var replace=txt.replace(/undefined/gi,",");
466
+
467
+ var result=replace.split(",");
468
+
469
+ document.getElementById("shipping:street2").value = "";
470
+ document.getElementById('shipping:city').value=result[1];
471
+ document.getElementById('shipping:street1').value=result[0];
472
+
473
+ document.getElementById('shipping:postcode').value=result[3];
474
+ if(k==='sub'){
475
+
476
+ document.getElementById('shipping-buttons-container').style.display = "none";
477
+ document.getElementById('shipping').style.display = "block";
478
+ document.getElementById('listboxaddd').style.display = "block";
479
+ document.getElementById('shipping-new-address-form').style.display = "block";
480
+ document.getElementById('qq').style.display = "none";
481
+ var d;
482
+
483
+ for (d=0;tea.length!=0;d--)
484
+ {
485
+
486
+ tea[d].parentNode.parentNode.removeChild( tea[d].parentNode );
487
+ d++;
488
+ }
489
+ document.getElementById('hiddendividd').style.display="none";
490
+
491
+ shipping.save();
492
+ }
493
+ }
494
+ }
495
+ }
496
+ }
497
+
498
+ else{
499
+
500
+ changeText2();
501
+ document.getElementById('shipping-buttons-container').style.display = "none";
502
+ document.getElementById('shipping').style.display = "block";
503
+
504
+ }
505
+
506
+ }
507
+
508
+
509
+ function shipChangecolor(val1,val2){
510
+ var result;
511
+ var m=val1.indexOf(val2);
512
+
513
+ if(m===-1){
514
+
515
+ result= "<span style='color:#1e7ec8;'>"+val2+"</span>";
516
+
517
+ }
518
+ else{
519
+
520
+ result= "<span style='color:#000000;'>"+val2+"</span>";
521
+
522
+ }
523
+ return result;
524
+ }
525
+
526
+
527
+
528
+
529
+
530
+
531
+ var specialKeys = new Array();
532
+ specialKeys.push(8); //Backspace
533
+ function IsNumeric(e) {
534
+
535
+ var keyCode = e.which ? e.which : e.keyCode
536
+ var ret = ((keyCode >= 48 && keyCode <= 57) || specialKeys.indexOf(keyCode) != -1||keyCode==45);
537
+
538
+ if(ret==false){
539
+ if((keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122))
540
+ {
541
+ alert("Alphabets are not allowed.");
542
+ }
543
+ else
544
+ {
545
+ alert("Special charecters are not allowed.");
546
+ }
547
+ }
548
+ return ret;
549
+
550
+ }
551
+
552
+
553
+
554
+ var specialKeys2 = new Array();
555
+ specialKeys2.push(8); //Backspace
556
+ specialKeys2.push(9); //Tab
557
+ specialKeys2.push(46); //Delete
558
+ specialKeys2.push(36); //Home
559
+ specialKeys2.push(35); //End
560
+ specialKeys2.push(37); //Left
561
+ specialKeys2.push(39); //Right
562
+ function IsAlphaNumeric(e) {
563
+ var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
564
+ var ret = ((keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122) || (specialKeys2.indexOf(e.keyCode) != -1 && e.charCode != e.keyCode));
565
+ return ret;
566
+ }
567
+
568
+
569
+
570
+ var specialKeys23 = new Array();
571
+ specialKeys23.push(8); //Backspace
572
+ specialKeys23.push(9); //Tab
573
+ specialKeys23.push(46); //Delete
574
+ specialKeys23.push(36); //Home
575
+ specialKeys23.push(35); //End
576
+ specialKeys23.push(37); //Left
577
+ specialKeys23.push(39); //Right
578
+ function IsAlpha(e) {
579
+ var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
580
+ var ret = ((keyCode >= 65 && keyCode <= 90) || (keyCode >= 97 && keyCode <= 122) || (specialKeys23.indexOf(e.keyCode) != -1 && e.charCode != e.keyCode));
581
+ if(keyCode=='32'||keyCode=='39'||keyCode=='45'||keyCode=='46'){return true;}else{
582
+ if(ret==false){
583
+ if(keyCode>='48'&& keyCode<='57')
584
+ {
585
+ alert("Numbers are not allowed.");
586
+ }
587
+ else
588
+ {
589
+ alert("Only ' - . these special charecters are allowed.");
590
+ }
591
+ }
592
+ return ret;
593
+ }
594
+ }
595
+
596
+
597
+ function validateSpecialCharacters(e)
598
+ {
599
+ var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
600
+ var spclChars = "!@$%^*()<>\\|}{[]_+=\"";
601
+ var content = document.getElementById("shipping:street1").value;
602
+
603
+ if (spclChars.indexOf(String.fromCharCode(keyCode)) != -1)
604
+ {
605
+ alert ("Only - . , & ' # these special charecters are allowed.");
606
+ return false;
607
+ }
608
+ }
609
+
610
+
611
+ </script>
612
+
613
+
614
+ <form action="" id="co-shipping-form">
615
+ <ul class="form-list">
616
+ <?php if ($this->customerHasAddresses()): ?>
617
+ <li class="wide" id="listboxaddd">
618
+ <label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
619
+ <div class="input-box">
620
+ <?php echo $this->getAddressesHtmlSelect('shipping') ?>
621
+ </div>
622
+ </li>
623
+ <?php endif ?>
624
+ <li id="shipping-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
625
+ <fieldset>
626
+ <input type="hidden" name="shipping[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="shipping:address_id" />
627
+ <ul>
628
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->setFieldParams('onchange="shipping.setSameAsBilling(false)"')->toHtml() ?></li>
629
+ <li class="fields">
630
+ <div class="fields">
631
+ <label for="shipping:company"><?php echo $this->__('Company') ?></label>
632
+ <div class="input-box">
633
+ <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $this->escapeHtml($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('company') ?>" onchange="shipping.setSameAsBilling(false);" />
634
+ </div>
635
+ </div>
636
+ </li>
637
+ <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
638
+ <li class="wide">
639
+ <label for="shipping:street1" class="required"><em>*</em><?php echo $this->__('Street Address') ?></label>
640
+ <div class="input-box">
641
+ <input type="text" placeholder="Line 1" title="<?php echo $this->__('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet(1)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" onkeypress="return validateSpecialCharacters(event);" ondrop="return false;"
642
+ onpaste="return false;"/>
643
+ </div>
644
+ </li>
645
+ <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
646
+ <?php for ($_i = 2, $_n = $this->helper('customer/address')->getStreetLines(); $_i <= $_n; $_i++): ?>
647
+ <li class="wide">
648
+ <div class="input-box">
649
+ <input type="text" placeholder="Line 2" title="<?php echo $this->__('Street Address %s', $_i) ?>" name="shipping[street][]" id="shipping:street<?php echo $_i ?>" value="<?php echo $this->escapeHtml($this->getAddress()->getStreet($_i)) ?>" class="input-text <?php echo $_streetValidationClass ?>" onchange="shipping.setSameAsBilling(false);" onkeypress="return validateSpecialCharacters(event);" ondrop="return false;"
650
+ onpaste="return false;"/>
651
+ </div>
652
+ </li>
653
+ <?php endfor; ?>
654
+ <?php if ($this->helper('customer/address')->isVatAttributeVisible()) : ?>
655
+ <li class="wide">
656
+ <label for="billing:vat_id"><?php echo $this->__('VAT Number'); ?></label>
657
+ <div class="input-box">
658
+ <input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $this->escapeHtml($this->getAddress()->getVatId()); ?>" title="<?php echo $this->__('VAT Number'); ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('vat_id') ?>" />
659
+ </div>
660
+ </li>
661
+ <?php endif; ?>
662
+ <li class="fields">
663
+ <div class="field">
664
+ <label for="shipping:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
665
+ <div class="input-box">
666
+ <input type="text" title="<?php echo $this->__('City') ?>" name="shipping[city]" value="<?php echo $this->escapeHtml($this->getAddress()->getCity()) ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="shipping:city" onchange="shipping.setSameAsBilling(false);" onkeypress="return IsAlpha(event);" ondrop="return false;"
667
+ onpaste="return false;"/>
668
+ </div>
669
+ </div>
670
+ <div class="field">
671
+ <label for="shipping:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
672
+ <div class="input-box">
673
+ <select id="shipping:region_id" name="shipping[region_id]" onchange="sdemo(this.options[this.selectedIndex].text)" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
674
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
675
+ </select>
676
+ <script type="text/javascript">
677
+ //<![CDATA[
678
+ $('shipping:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
679
+ //]]>
680
+ </script>
681
+ <input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $this->escapeHtml($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
682
+ </div>
683
+ </div>
684
+ </li>
685
+ <li class="fields">
686
+ <div class="field">
687
+ <label for="shipping:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
688
+ <div class="input-box">
689
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" onchange="shipping.setSameAsBilling(false);" onkeypress="return IsNumeric(event);" ondrop="return false;"
690
+ onpaste="return false;"/>
691
+ </div>
692
+ </div>
693
+ <div class="field">
694
+ <label for="shipping:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
695
+ <div class="input-box">
696
+ <?php echo $this->getCountryHtmlSelect('shipping') ?>
697
+ </div>
698
+ </div>
699
+ </li>
700
+ <li class="fields">
701
+ <div class="field">
702
+ <label for="shipping:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
703
+ <div class="input-box">
704
+ <input type="text" name="shipping[telephone]" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" onchange="shipping.setSameAsBilling(false);" />
705
+ </div>
706
+ </div>
707
+ <div class="field">
708
+ <label for="shipping:fax"><?php echo $this->__('Fax') ?></label>
709
+ <div class="input-box">
710
+ <input type="text" name="shipping[fax]" value="<?php echo $this->escapeHtml($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" onchange="shipping.setSameAsBilling(false);" />
711
+ </div>
712
+ </div>
713
+ </li>
714
+
715
+ </ul>
716
+ </fieldset>
717
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
718
+ </li>
719
+
720
+
721
+
722
+
723
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
724
+ <li class="control" id="qq" style="display: none;">
725
+ <input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label></li>
726
+ <?php else:?>
727
+ <li class="no-display"><input type="hidden" name="shipping[save_in_address_book]" value="1" /></li>
728
+ <?php endif;?>
729
+
730
+
731
+
732
+
733
+ <li class="control">
734
+ <input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if($this->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> title="<?php echo $this->__('Use Billing Address') ?>" onclick="shipping.setSameAsBilling(this.checked)" class="checkbox" /><label for="shipping:same_as_billing"><?php echo $this->__('Use Billing Address') ?></label>
735
+ </li>
736
+ </ul>
737
+ <div class="buttons-set" id="shipping">
738
+ <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
739
+ <button type="button" class="button" onclick="shipChangeText2()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
740
+ <div id="shatamK" style="display: none;" >
741
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Please wait .... address validation is in process...') ?>" title="<?php echo $this->__('Please wait .... address validation is in process') ?>" class="v-middle" /> <?php echo $this->__('Please wait address validation is in process..') ?>
742
+ </div>
743
+ </div>
744
+
745
+
746
+ <div class="fieldset" id="hiddendividd" style="display: none;">
747
+ <h2 class="legend">Correct Addresses</h2>
748
+ There's a problem with the address provided - we've marked our suggestions in below. Please choose which version of the address you want to use, and click to the address you want to select.
749
+ <p></p>
750
+
751
+ <div id="origionaladdd">
752
+ <h4>Address you entered...</h4>
753
+ </div>
754
+
755
+ <h4>Corrected addresses:</h4>
756
+
757
+ </div>
758
+
759
+ <div class="buttons-set" id="shipping-buttons-container" style="display: none;">
760
+
761
+ <p class="back-link"><a href="#" onclick="checkout.back(); return false;"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
762
+ <button type="button" class="button" title="<?php echo $this->__('Continue') ?>" onclick="shipMyFunction('sub')"><span><span><?php echo $this->__('Click To Continue') ?></span></span></button>
763
+ <span id="shipping-please-wait" class="please-wait" style="display:none;">
764
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
765
+ </span>
766
+ </div>
767
+ </form>
768
+ <script type="text/javascript">
769
+ //<![CDATA[
770
+ var shipping = new Shipping('co-shipping-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveShipping') ?>',
771
+ '<?php echo $this->getUrl('checkout/onepage/shippingMethod') ?>');
772
+ var shippingForm = new VarienForm('co-shipping-form');
773
+ shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
774
+ //shippingForm.setElementsRelation('shipping:country_id', 'shipping:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
775
+ $('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
776
+
777
+ var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'shipping:postcode');
778
+ //]]>
779
+ </script>
app/etc/modules/Shatam_Fixaddress.xml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Shatam_Fixaddress>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+
8
+ </Shatam_Fixaddress>
9
+
10
+ </modules>
11
+ </config>
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Shatam_Fixaddress</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php ">OCL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension are used for verify billing and shipping addresses specified by customers during the checkout process and My Account Address Book entries also.&#xD;
10
+ </summary>
11
+ <description>Helps store owners verify billing and shipping addresses specified by customers during the checkout process and My Account Address Book entries also.&#xD;
12
+ Fixaddress will correct minor mistakes and fix critical errors in address,ensure order deliverability and improve customer satisfaction.&#xD;
13
+ </description>
14
+ <notes>Initial Relese</notes>
15
+ <authors><author><name>shatam</name><user>shatam</user><email>shatamtech@gmail.com</email></author><author><name>kirti</name><user>misal</user><email>kirti.shatam@gmail.com</email></author></authors>
16
+ <date>2014-06-11</date>
17
+ <time>13:34:21</time>
18
+ <contents><target name="magelocal"><dir><dir name="Shatam"><dir name="Fixaddress"><dir name="Block"><dir name="Address"><file name="Edit.php" hash="6d85f3f45d8a890c62fac0500810f559"/></dir></dir><dir name="etc"><file name="config.xml" hash="485304536b188f8ce5a05e41ac9acb97"/></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="shatam"><file name="billing.phtml" hash="1bc760dc45ec3939f36287453a9c20fd"/><file name="edit.phtml" hash="8211aeac368cc2c7262b5a32007b71fb"/><file name="shipping.phtml" hash="8c9a152016d549d006df23459defbe88"/></dir></dir><dir name="layout"><file name="fixaddress.xml" hash="60583cdeb49465152787e792ec535ed5"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="Shatam_Fixaddress.xml" hash="dbaf3c26dc455762379d41ca21acd14c"/></dir></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
21
+ </package>