Zen Cart Logo
Forums / Addon Shipping Modules / Post Office CASS Address Verification module

Post Office CASS Address Verification module

Views: 14,983

Results 1 to 20 of 37
16 Dec 2008, 11:18 PM
#1
audleman avatar

audleman

New Zenner

Join Date:
Jul 2007
Posts:
69
Plugin Contributions:
0

Post Office CASS Address Verification module

Hi Zenners,

I've developed some code for ZenCard that will scrub the address a customer inputs via the United States Post Office CASS Address Verification API. If you want to see it in action, try filling in a gift subscription on this page:

http://www.yesmagazine.org/store/index.php?main_page=product_info&products_id=70

If you enter a correct address, on the shopping cart page you will see that the address is in the correct format, including zip+5. If you enter a bad address, you will see a prompt that alerts you to a problem with the USPS and asks if you want to correct the address or continue with it as entered.

I did a search on this forum and didn't see that anybody had developed something like this before. So I thought I'd put it out there and see if anybody is interested in having me wrap this code up into a module and making it open source. If you're interested, let me know.

Kevin Audleman

17 Dec 2008, 12:07 AM
#2
barco57 avatar

barco57

Totally Zenned

Join Date:
Apr 2006
Location:
West Salem, IL
Posts:
2,845
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

I would like to see it, I have a site I could use this on.

Mike
AEIIA - Zen Cart Certified & PCI Compliant Hosting
The Zen Cart Forum...Better than a monitor covered with post-it notes!

17 Dec 2008, 4:38 AM
#3
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,659
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

Please package the module and add it to the Free Add Ons section, I am sure it will be useful to many folks.

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

22 Dec 2008, 10:39 PM
#4
patternman avatar

patternman

New Zenner

Join Date:
Jul 2008
Posts:
63
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

I am developing a site right now and am very close to going live. I have been looking for exactly this kind of mod. Please post as soon as you can so that I might be able to put it on our new site. Very excited. Thanks. :smile:

9 Jan 2009, 1:46 AM
#5
audleman avatar

audleman

New Zenner

Join Date:
Jul 2007
Posts:
69
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

Hi gang,

I just finished wrapping up my code into a module. Here it is in beta form. I would call it a very strong beta, as I've been running the code on my site for almost a year (I just don't know what little issues might come up when somebody installs it fresh).

It is a very easy install as it doesn't touch any core files. Give it a go and let me know if you have any issues. I'll be happy to help debug them.

Cheers,
Kevin

12 Feb 2009, 5:48 PM
#6
audleman avatar

audleman

New Zenner

Join Date:
Jul 2007
Posts:
69
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

Hello,

Please use this new version 1.1. It fixes a problem where the sql patch file was missing a configuration value that allows you to toggle the module on/off!

Cheers,
Kevin Audleman

20 Feb 2009, 6:03 PM
#7
audleman avatar

audleman

New Zenner

Join Date:
Jul 2007
Posts:
69
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

Thanks to Jason for discovering a hard-coded table name in a sql query. Download the latest version, v 1.2, for a fix. If you want to make the fix yourself, go into the file

/includes/classes/observers/class.cass_validation.php

Around line 73 you will see this line:

$zone_query = "SELECT zone_code FROM zen_zones WHERE zone_id = " . $cass_address->fields['entry_zone_id'];

Replace it with this one:

$zone_query = "SELECT zone_code FROM ".TABLE_ZONES." WHERE zone_id = " . $cass_address->fields['entry_zone_id'];

Cheers,
Kevin Audleman

21 Apr 2009, 11:13 PM
#8
patternman avatar

patternman

New Zenner

Join Date:
Jul 2008
Posts:
63
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

Hi Kevin,
Sorry it took me so long to get back to this.
I have the mod installed. My site is live.
Everything seems to be working just fine.
It's really great.
Thank you for the contribution.

Just a note to anyone else looking to install this mod:
The USPS process may indeed be quite tiresome.
On this page:
http://www.usps.com/webtools/webtoolsapirequestform.htm
Be sure to only check the top box. All of the rest are invalid uses of the API. I don't know why they feel like they need to quiz the customers. Anyhow, if you pick more than the top box, you'll have to beg and plead and explain yourself. Then maybe they'll let you in.
Also, do not expect quick service, friendly communication, or a helpful staff. So as long as you're prepared, no worries. Just be patient.

Cheers. :smile:
Jason

12 May 2009, 5:56 PM
#9
techdog avatar

techdog

New Zenner

Join Date:
Dec 2008
Location:
Long Beach, WA
Posts:
10
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

patternman:

Hi Kevin,
Sorry it took me so long to get back to this.
I have the mod installed. My site is live.
Everything seems to be working just fine.
It's really great.
Thank you for the contribution.

Just a note to anyone else looking to install this mod:
The USPS process may indeed be quite tiresome.
On this page:
http://www.usps.com/webtools/webtoolsapirequestform.htm
Be sure to only check the top box. All of the rest are invalid uses of the API. I don't know why they feel like they need to quiz the customers. Anyhow, if you pick more than the top box, you'll have to beg and plead and explain yourself. Then maybe they'll let you in.
Also, do not expect quick service, friendly communication, or a helpful staff. So as long as you're prepared, no worries. Just be patient.

Cheers. :smile:
Jason

While I can be patient. I have a client that might not be. How soon after you put in the request form did you get a response. I'm hoping I receive an email affirmative that will let me know when I can configure everything else.

4 Aug 2009, 12:14 AM
#10
weswin7 avatar

weswin7

New Zenner

Join Date:
Jul 2009
Posts:
1
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

how do i do validation on the billing address too
whats the best way to do the same validation for billing as for the shipping address

12 Aug 2009, 2:33 PM
#11
violeteye avatar

violeteye

New Zenner

Join Date:
Feb 2008
Posts:
9
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

I can't install this module--

when I tried to use the uploader in the patch section, I got a syntax error. (I apologize for not having the wherewithal to actually copy it)

On a second try, I got a duplicate entry error:

1062 Duplicate entry 'USPS_CASS_USER_ID' for key 2
in:
[INSERT INTO zen_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('USPS CASS User ID', 'USPS_CASS_USER_ID', '', 'Your user id for the CASS API as provided by the USPS.', 7, 20, now());]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

Can anyone help me out with this? I tried version 1.2.
Thanks.

9 Nov 2009, 9:34 PM
#12
deere20 avatar

deere20

New Zenner

Join Date:
Sep 2009
Posts:
9
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

Hi,

Anyone using the CASS usps address validator shipping module successfully ?

It's the one at -
http://www.zen-cart.com/forum/showthread.php?t=115744

I've installed but when it goes to confirm the shipping address, I get a zen '404 page not found'.

Thanks

9 Nov 2009, 10:08 PM
#13
deere20 avatar

deere20

New Zenner

Join Date:
Sep 2009
Posts:
9
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

I've installed this module, but when it goes to display the shipping address warning (index.php?main_page=checkout_shipping_address_warning), I get a zen 404 page not found ...

19 Jan 2010, 12:15 AM
#14
jmatthewgore avatar

jmatthewgore

New Zenner

Join Date:
Jan 2010
Posts:
7
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

VioletEye:

I can't install this module--

when I tried to use the uploader in the patch section, I got a syntax error. (I apologize for not having the wherewithal to actually copy it)

On a second try, I got a duplicate entry error:

1062 Duplicate entry 'USPS_CASS_USER_ID' for key 2
in:
[INSERT INTO zen_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('USPS CASS User ID', 'USPS_CASS_USER_ID', '', 'Your user id for the CASS API as provided by the USPS.', 7, 20, now());]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

Can anyone help me out with this? I tried version 1.2.
Thanks.

The exact same thing happened to me today. I was installing this so that I could reliably use the local tax codes for WA state, which require the +4 zip codes.

I don't get a "Enable CASS Address Validation" in Shipping/Packaging as the readme.txt indicates I should, although there is a place to enter the CASS Username.

When I go through the checkout process, there is no indication that anything is different than pre-installation of this mod. No errors, but also no functionality.

I'm using Zen Cart 1.3.8a, minimal modification at this point, but the USPS Shipping module is active.

Would appreciate any help!

  • Matt
19 Jan 2010, 12:36 AM
#15
jmatthewgore avatar

jmatthewgore

New Zenner

Join Date:
Jan 2010
Posts:
7
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

This is the error message from ZenCart:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '·, NULL, 'zen_cfg_select_option(array(''true'', ''false''), ' )' at line 1
in:
[INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function) VALUES ( 'Enable CASS Address Validation', 'USPS_CASS_ENABLED', 'true', 'Toggle the USPS CASS Address checking module.', 7, 21·, NULL, 'zen_cfg_select_option(array(''true'', ''false''), ' );]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

19 Jan 2010, 12:40 AM
#16
jmatthewgore avatar

jmatthewgore

New Zenner

Join Date:
Jan 2010
Posts:
7
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

FARK! Just took the time to inspect the error message a little more closely and I saw the little dot next to the "21". I removed the dot and it installed.

  • Matt
19 Jan 2010, 1:43 AM
#17
jmatthewgore avatar

jmatthewgore

New Zenner

Join Date:
Jan 2010
Posts:
7
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

OK, let me start over and explain the problem, how I made it worse, how I made it better, and how I resolved it.

  1. Tried to upload the SQL Patch and got a syntax error. "> 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '·, NULL, 'zen_cfg_select_option(array(''true'', ''false''), ' )' at line 1

in:
[INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function) VALUES ( 'Enable CASS Address Validation', 'USPS_CASS_ENABLED', 'true', 'Toggle the USPS CASS Address checking module.', 7, 21·, NULL, 'zen_cfg_select_option(array(''true'', ''false''), ' );]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

  1. Thought that it might be a problem caused by uploading the file rather than copying and pasting, so I copied the whole thing and pasted it into the SQL Patch pane and submitted it. That got me the error listed by VioletEye.

  2. So, I realized that the first half of the patch had installed correctly on the first try, it was just the second that was a problem, so I copied that and pasted it, and stopped getting the Duplicate Error, but got the Syntax Error instead.

  3. Looked at the syntax (finally!) and found an extra dot next to "21" and deleted it, then copied the second half of the code into the patcher, and it worked just fine.

The syntax is an error in the 1.2 release, so hopefully the author will notice this post and fix it!

  • Matt
24 Feb 2010, 9:54 PM
#18
stamper avatar

stamper

New Zenner

Join Date:
Mar 2008
Posts:
38
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

I'm having problems with this module.

Using Zen Cart 1.3.8a

I received the API access confirmation from USPS. USPS sent the email indicating I'm enabled for their production server. The user ID and enable CASS fields appear in my MySQL database after installation. The includes files appeared to copy over to my installation OK. However, address validation does not occur in my Zen Cart site (yes, it is enabled and user ID added in the Admin Panel).

Can anyone suggest what the problem may be? Are there any known compatibility issues with certain templates or other mods?

Thanks!

2 Sep 2010, 1:27 PM
#19
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

Is there supposed to be something in this folder?

CASSValidation_v1.2\includes\modules\pages\checkout_shipping_address_warning\

~ jasmel : ** My Store** Using Contributions: Wallet Theme | Simple Google | Quantity Discounts | Godaddy | FAQ's | Confirm Email Address Entry | Admin login as customer | Newsletter Subscribe | CampaingMonitor

2 Sep 2010, 4:23 PM
#20
jasmel avatar

jasmel

Zen Follower

Join Date:
Feb 2008
Location:
Washington State
Posts:
230
Plugin Contributions:
0

Re: Post Office CASS Address Verification module

JMatthewGore:

  1. Looked at the syntax (finally!) and found an extra dot next to "21" and deleted it, then copied the second half of the code into the patcher, and it worked just fine.

The syntax is an error in the 1.2 release, so hopefully the author will notice this post and fix it!

  • Matt

Same error here. Just had to remove the · after the 21

INSERT INTO configuration (configuration_title, 
						   configuration_key,
						   configuration_value,
						   configuration_description, 
						   configuration_group_id, 
						   sort_order, 
						   use_function, 
						   set_function) VALUES (
						   'Enable CASS Address Validation', 
						   'USPS_CASS_ENABLED', 
						   'true', 
						   'Toggle the USPS CASS Address checking module.', 
						   7, 
						   21·,
						   NULL, 
						   'zen_cfg_select_option(array(''true'', ''false''), '
						   );

~ jasmel : ** My Store** Using Contributions: Wallet Theme | Simple Google | Quantity Discounts | Godaddy | FAQ's | Confirm Email Address Entry | Admin login as customer | Newsletter Subscribe | CampaingMonitor