| ||||||||||
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 |
#1
|
|||||||
|
|||||||
ZipCode Validation Module
I really appreciate all of the help I have received here on the forums during the development of our site. I know this is a small gesture, but I wanted to show that appreciation by posting our Zipcode Validation module.
In register.php, look for the line "$smarty->assign("error",$error);". Put the following directly under that: Code:
Create a file named "validate_zipcode.php" in the "include" directory of Xcart. Fill that file with the following code: Code:
Here is check_zipcode_js.tpl. I am unsure if the javascript is still having some problems, but I have not run into any after the latest revisions. Code:
And that is it. Enjoy! Ohh, and by the way...I do give the Xcart development team explicit permission to include this into their Xcart source code, and alter it to their hearts content.
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#2
|
|||||||
|
|||||||
Thanks for the post, do you have any Idea how I would include Canadian postal codes as well?
|
|||||||
#3
|
|||||||||
|
|||||||||
It's a bigger mod, but I've also done something like this with the data from www.zipcodedownload.com. You have to pay for the database, but with that info I'm able to verify their city / state match their zipcode. It saves a ton of money on reshipping packages and changing addresses en route.
__________________
X-cart Featured Products Manager from http://www.firetanksoftware.com - Put your products where you want, how you want. |
|||||||||
#4
|
|||||||||
|
|||||||||
I just checked out their site again and they now have info for Canada as well. They didn't have this when I bought the U.S. info.
__________________
X-cart Featured Products Manager from http://www.firetanksoftware.com - Put your products where you want, how you want. |
|||||||||
#5
|
|||||||
|
|||||||
Quote:
I'd have to rewrite it a bit to get Canadian codes to work for this. I am going to have to do that because we do sell to Canada. I will post it once I get it finished.
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#6
|
|||||||
|
|||||||
Please note that the module I posted here earlier is non-functional and will not properly check zip codes. I left out a pair of parenthesis in the preg_match() statement.
Here is the fully functional, Canadian postal code compatible, version... In register.php, look for the line "$smarty->assign("error",$error);". Put the following updated function call directly under that: Code:
If you have not already done so, create a file named "validate_zipcode.php" in the "include" directory of Xcart. Fill that file with the following code: Code:
There have been no changes to "check_zipcode_js.tpl" since the original posting of the code. Let me know if you see any further problems. I setup this version to switch via country so that you can easily add another "case" to the conditional statement for postal codes from countries not included in this release. If you do add postal code checks for more countries, please do us all a favor and post them here. As stated before, I do give the Xcart developers explicit permission to use this code in any future release of Xcart.
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#7
|
|||||||
|
|||||||
Another update for this module. Better detection of one too many characters in postal codes and additional correction of 'fat-fingering' the dash.
Code:
Again, let me know if you have problems with this so that I can correct any bugs.
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#8
|
|||||||
|
|||||||
WOOOO HOOOOO!!! Thanks! Very, Very AWESOME!
I am still not sure how "check_zipcode_js.tpl" is called? Where do I put it? Can someone please explain it to me. |
|||||||
#9
|
|||||||
|
|||||||
Quote:
You put it in the root of your skins directory. There should already be one there, so just replace the code with what I posted.
__________________
X-Cart Pro 4.5.5 Platinum X-Payments 1.0.6 PHP 5.3.14 MySQL 5.1.68 Apache 2.2.23 |
|||||||
#10
|
|||||||
|
|||||||
OK... THAT DOES IT! I'M OFFICIALLY A NEWBIE AGAIN!
How embarrassing man... DOH! |
|||||||
|
|||
X-Cart forums © 2001-2020
|