| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
ZipCode Validation Module | ||||
|
|
Thread Tools | Search this Thread |
#31
|
|||||||
|
|||||||
Hi,
I'm on 3.5.8, my include/register.php doesn't have this syntax: $smarty->assign("error",$error); but it does have if (!empty($reg_error)) $smarty->assign("reg_error",$reg_error); should i just put the code after that? thanks |
|||||||
#32
|
|||||||
|
|||||||
That I am not sure of. I am guessing this difference isn't signifigant. You can try putting the code under that line ad give it a try. Test a user sign-up with and intentional bad zip code before using this on your live server.
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#33
|
|||||||||
|
|||||||||
Short form of ZIP check -
Replace the function in check_zipcode_js.tpl:
function check_zip_code_field(cnt, zip){ var valid = "0123456789-"; var hyphencount = 0; if (cnt.options[cnt.selectedIndex].value=="US") { if (zip.value.length!=5 && zip.value.length!=10 && zip.value!="") { alert("Please enter your 5 digit or 5 digit+4 zip code formated like '12345-6789'."); zip.focus(); return false; } for (var i=0; i < zip.value.length; i++) { temp = "" + zip.value.substring(i, i+1); if (temp == "-") hyphencount++; if (valid.indexOf(temp) == "-1") { alert("Invalid characters in your zip code. Please try again."); zip.focus(); return false; } if ((hyphencount > 1) || ((zip.value.length==10) && ""+zip.value.charAt(5)!="-")) { alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'. Please try again."); zip.focus(); return false; } } return true; }else if (cnt.value=="CA") { if (zip.value.length!=6 && zip.value.length!=7 && zip.value!="") { alert("Ensure that you have 6 or 7 characters in your postal code") zip.focus() return false } } return true }
__________________
X-cart 3.3.1 ~ 4.0.18 4.1.1 PHP4/5 MySQL 4.1.10a/5.1 CENTOS 4.1 / SuSE 9.3 / MS Server Authorize.Net Partner |
|||||||||
#34
|
|||||||
|
|||||||
This module is actually supposed to be able to take into account the presence or lack of hyphens in a zip+4 code within the PHP code.
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#35
|
|||||||
|
|||||||
Here is a minor update to take care of a problem with Canadian zip code validation...
Code:
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#36
|
|||||||
|
|||||||
Have anyone tried this on Xcart 4.0.9 or 4.0.10 or 4.0.11?
I tried to put on 4.0.11, it is not working at all.
__________________
X-Cart Gold version 4.4.4 X-Cart directory /home/web/u/ugchweb/cart PHP 5 MySQL server 5 |
|||||||
#37
|
|||||||
|
|||||||
I haven't had the opportunity to set this up with 4.0.x.
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#38
|
|||||||
|
|||||||
Re: ZipCode Validation Module
Just a heads up for anyone looking at this thread... this module may allow 9-digit US zip code validation, but that doesn't mean your realtime rates are going to be able to figure out what to do with a 9-digit zip code. Many of the rate charts only have the 5-digit zip codes, so having the full 9 may cause your shipping calculations to break.
__________________
...as a matter of fact it's all dark. v4.1.6 |
|||||||
|
|||
X-Cart forums © 2001-2020
|