Jump to content
Sign in to follow this  
ajsinopoli

USPS module help

Recommended Posts

Hi ,

I activated this module today and set up the required user login ID and password, however when I try to test this I see the following error when I go to check out.

 

 

United States Postal Service United States Postal Service

An error occured with the USPS shipping calculations.

If you prefer to use USPS as your shipping method, please contact the store owner.

 

 

This is in this version of the module

 

$Id: usps.php,v 1.47 2003/04/08 23:23:42 dgw_ Exp $

 

 

Any help is appreciated,

Thanks

Tony

Edited by ajsinopoli

Share this post


Link to post
Share on other sites

The USPS test server will only accept specific data which is not capable by osC. Go ahead and email USPS that you have completed tests and are ready to be switch to the production server. they will email you the server name to change in the module (or just confirm it) and then do your tests with the production server.


Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Share this post


Link to post
Share on other sites

The USPS test server will only accept specific data which is not capable by osC. Go ahead and email USPS that you have completed tests and are ready to be switch to the production server. they will email you the server name to change in the module (or just confirm it) and then do your tests with the production server.

 

Mark,

 

Is that old version 1.47? ok to use

 

Who do I email at USPS, we havent had that kind of interaction yet. I htought based on what it said in teh module that all I needed was a USPS login and pasword. I got that by signing into their web site today.

 

 

 

Thanks in advance,

Tony Sinopoli

Share this post


Link to post
Share on other sites

Mark,

 

Is that old version 1.47? ok to use

 

Who do I email at USPS, we havent had that kind of interaction yet. I htought based on what it said in teh module that all I needed was a USPS login and pasword. I got that by signing into their web site today.

 

 

 

Thanks in advance,

Tony Sinopoli

Don't know actually.. you should receive an email with your username and password, with instructions on how to do the tests and what to do when you complete testing. Don't know if a different module renders different procedures.


Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Share this post


Link to post
Share on other sites

Is that old version 1.47? ok to use

Ok, that is an old version, isn't it? My thoughts are always use the most recent versions of anything. Afterall, the post office has likely changed up things since 2003, don't you think? I am using a 7-24-2009 version by jmcmurr found here and it works well using the USPS version 3 api.

 

I'll see if I can find the contribution you are using and take a look at it.


Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Share this post


Link to post
Share on other sites

Ok, that is an old version, isn't it? My thoughts are always use the most recent versions of anything. Afterall, the post office has likely changed up things since 2003, don't you think? I am using a 7-24-2009 version by jmcmurr found here and it works well using the USPS version 3 api.

 

I'll see if I can find the contribution you are using and take a look at it.

 

I tried adding this and got the following errors.

 

on the top of the web page

Warning: fsockopen() [function.fsockopen]: unable to connect to http://stg-production.shippingapis.com/:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in /home/janddpr1/public_html/osc/includes/classes/http_client.php on line 330

 

and inthe osc commerce admin section for modules it shows this now when you choose the shipping module section

 

Fatal error: Cannot redeclare class usps in /home/janddpr1/public_html/osc/includes/modules/shipping/usps.php on line 44

 

I'm lost..:-(

Share this post


Link to post
Share on other sites

I tried adding this and got the following errors.

 

on the top of the web page

Warning: fsockopen() [function.fsockopen]: unable to connect to http://stg-production.shippingapis.com/:80 (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in /home/janddpr1/public_html/osc/includes/classes/http_client.php on line 330

 

and inthe osc commerce admin section for modules it shows this now when you choose the shipping module section

 

Fatal error: Cannot redeclare class usps in /home/janddpr1/public_html/osc/includes/modules/shipping/usps.php on line 44

 

I'm lost..:-(

That's because the correct host name is

 http://production.shippingapis.com

When you get the right information you will have to email them to request your account to be switched to the production server.


Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Share this post


Link to post
Share on other sites

That's because the correct host name is

 http://production.shippingapis.com

When you get the right information you will have to email them to request your account to be switched to the production server.

 

 

OK fixed what you suggested but I still see this error below in the OSC admin module section, any suggestions? So right now I cant even enable the this module.

 

Thanks,

Tony

 

Fatal error: Cannot redeclare class usps in /home/janddpr1/public_html/osc/includes/modules/shipping/usps.php on line 44

Share this post


Link to post
Share on other sites

That's because the correct host name is

 http://production.shippingapis.com

When you get the right information you will have to email them to request your account to be switched to the production server.

 

Hey I got rid of that last error and asked USPS to move me ot the production server.

 

Thanks for your hep everyone!!

 

Tony

Share this post


Link to post
Share on other sites

Hey I got rid of that last error and asked USPS to move me ot the production server.

 

Thanks for your hep everyone!!

 

Tony

 

 

I've gotten USPS to move me to the production server and I still get the socket error. Any ideas?

Share this post


Link to post
Share on other sites

Nevermind I got it!

 

VERY IMPORTANT STEP!!!

 

Uninstall the module (click "-remove" in the admin panel) and then re-install it after you get moved to the production server by USPS. You'll need to re-enter the user id and password they gave you.

 

Now mine works like a charm. Thanks folks!

Share this post


Link to post
Share on other sites

I'm having the same issue and I've made sure the Zip code is in the shipping config in the admin panel, the account has been switched to the production server, I have uninstalled and reinstalled the USPS module and re-added the username and password. STILL NOT WORKING. Does anyone have any other ideas?

Share this post


Link to post
Share on other sites

I'm having the same issue and I've made sure the Zip code is in the shipping config in the admin panel, the account has been switched to the production server, I have uninstalled and reinstalled the USPS module and re-added the username and password. STILL NOT WORKING. Does anyone have any other ideas?

Have it print the error message into a file so you can see the exact problem. You will have to change the file path below to match your environment.

 

      if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody();
       // print_r("<br>request=$request"); // DEBUG CODE
       $http->Disconnect();
     } else {
       return false;
     }

     $response = array();
     while (true) {
       if ($start = strpos($body, '<Package ID=')) {
         $body = substr($body, $start);
         $end = strpos($body, '</Package>');
         $response[] = substr($body, 0, $end+10);
         $my_response = substr($body, 0, $end+10); // DEBUG CODE
         //print_r("<br>response=$my_response"); // DEBUG CODE
// ******* error responses ************
$myFile = "/home/yourname/public_html/usps_errors.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $my_response;
fwrite($fh, $stringData);
fclose($fh);
// *********************************
         $body = substr($body, $end+9);
       } else {
// ******* error responses ************
$myFile = "/home/your_name/public_html/usps_errors.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $body;
fwrite($fh, $stringData);
fclose($fh);
// *********************************
         break;
       }
     }

 

Find that code in the /includes/modules/shipping/usps.php file and add the code between the // **************

Be sure to change the path and create the empty file with write permissions first. You may have to add the $my_response line or something else. I no longer have the original code to compare it.

I'm sort of lazy that way...


Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×