Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

An error occurred with the USPS shipping calculations


emwhite

Recommended Posts

I am building a brand new store for my organization, but I have very limited experience with website design and html. Our website is hosted on Register.com. and we're using osCommerce to actually build our store.

 

One of things we're using osCommerce for is to process credit card information for people signing up for membership. This requires no shipping, and so naturally I assigned the membership 'products' a weight of 0.00. When I tried to purchase a membership, not only does it take me through the shipping process (which I don't want), but I also get this error message saying: "An error occurred with the USPS shipping calculation." I'm assuming this message stems from the fact that we have a product that doesn't have any weight to it, but in all honesty I really don't know what's going on.

 

Does anyone have any insight into the problem or suggestions as to fixing it?

 

Thanks!

Em

Link to comment
Share on other sites

  • 2 weeks later...
I am building a brand new store for my organization, but I have very limited experience with website design and html. Our website is hosted on Register.com. and we're using osCommerce to actually build our store.

 

One of things we're using osCommerce for is to process credit card information for people signing up for membership. This requires no shipping, and so naturally I assigned the membership 'products' a weight of 0.00. When I tried to purchase a membership, not only does it take me through the shipping process (which I don't want), but I also get this error message saying: "An error occurred with the USPS shipping calculation." I'm assuming this message stems from the fact that we have a product that doesn't have any weight to it, but in all honesty I really don't know what's going on.

 

Does anyone have any insight into the problem or suggestions as to fixing it?

 

Thanks!

Em

 

I am getting this same error. It appears as if everything is working right. We contacted USPS and got the ok, we are in production mode email, but the module is on the fritz. Any help out there, please? This is a national shrine I am working with ... non-profit.

 

An error occured with the USPS shipping calculations.

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

 

Thanks,

Suzi

Link to comment
Share on other sites

I am getting this same error. It appears as if everything is working right. We contacted USPS and got the ok, we are in production mode email, but the module is on the fritz. Any help out there, please? This is a national shrine I am working with ... non-profit.

 

An error occured with the USPS shipping calculations.

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

 

Thanks,

Suzi

Hi Suzi,

 

I'm not seeing your problem, but I am seeing a problem with my website. I assume you are seeing the problem when checkout_shipping.php is attempting to display the available shipping costs for objects in the cart.

 

On my website, I get a list of available options / costs, but regardless of which option the customer selects, they are always billed for the cost of the first item in the USPS list.

 

I'm going to look into my problem, but this isn't going to help you.

 

To figure out what your problem is, you will need to dump the contents of the USPS response to your query. In the includes/modules/shipping/usps.php file find the following code near line 223:

	  $http = new httpClient();
  if ($http->Connect($usps_server, 80)) {
	$http->addHeader('Host', $usps_server);
	$http->addHeader('User-Agent', 'osCommerce');
	$http->addHeader('Connection', 'Close');

	if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody();

	$http->Disconnect();
  } else {
	return false;
  }

Right after this code, add the following line to print out the USPS response to the browser window:

var_dump(htmlspecialchars($body, ENT_QUOTES));

You'll want to make this mode on a development / test server if you have one. Otherwise, the customers who happen to be using the live site will see the debug output also.

 

Post the output that appears at the top of the browser here and we can start figure out what is going wrong.

 

Ben

Edited by bpopelar
Link to comment
Share on other sites

Post the output that appears at the top of the browser here and we can start figure out what is going wrong.

 

Ben

 

Thank you, Ben! I appreciate your help. Here is the code I get.

 

string(1698) "<?xml version="1.0"?> <RateResponse><Package ID="0"><Error><Number>-2147219433</Number><Source>DomesticRatesV2:clsRateV2IDSErrorsFound:clsRateV2: CreateSinglePostage Mail type 2;RateEngineV2.ProcessRequest</Source><Description>Destination ZIP Code is invalid.</Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error></Package><Package ID="1"><Error><Number>-2147219433</Number><Source>DomesticRatesV2:clsRateV2IDSErrorsFound:clsRateV2: CreateSinglePostage Mail type 2;RateEngineV2.ProcessRequest</Source><Description>Destination ZIP Code is invalid.</Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error></Package><Package ID="2"><Error><Number>-2147219433</Number><Source>DomesticRatesV2:clsRateV2IDSErrorsFound:clsRateV2: CreateSinglePostage Mail type 2;RateEngineV2.ProcessRequest</Source><Description>Destination ZIP Code is invalid.</Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error></Package><Package ID="3"><Error><Number>-2147219433</Number><Source>DomesticRatesV2:clsRateV2IDSErrorsFound:clsRateV2: CreateSinglePostage Mail type 2;RateEngineV2.ProcessRequest</Source><Description>Destination ZIP Code is invalid.</Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error></Package></RateResponse> "

Link to comment
Share on other sites

I found the error!!! Thank you for allowing me to use the debugging code! The user put in an invalid zip code...but it didn't tell me that until I used the debugging code! Perfectly delightful to get this sorted out. Now I am going out to play!

 

Thank you, thank you, thank you!

 

Suzi

Link to comment
Share on other sites

On my website, I get a list of available USPS options / costs, but regardless of which USPS option the customer selects, they are always billed for the cost of the first item in the USPS list.

 

I'm going to look into my problem, but this isn't going to help you.

I found the problem with my site. I'm not quite certain when this started and I haven't found any posting here on the forum documenting my solution.

 

The USPS server now returns the Service name in all upper case letters (i.e., it returns "EXPRESS" instead of "Express") for a domestic (USA) query. The standard osCommerce USPS shipping module defines the Service name as a mixed case string. This results in the customer being billed the price of the first item in the USPS list instead of the user selected item in the USPS list.

 

The solution is quite simple. In the includes/modules/shipping/usps.php file near line 46 replace:

	  $this->types = array('Express' => 'Express Mail',
					   'First Class' => 'First-Class Mail',
					   'Priority' => 'Priority Mail',
					   'Parcel' => 'Parcel Post');

with:

	  $this->types = array('EXPRESS' => 'Express Mail',
					   'FIRST CLASS' => 'First-Class Mail',
					   'PRIORITY' => 'Priority Mail',
					   'PARCEL' => 'Parcel Post');

Ben

Edited by bpopelar
Link to comment
Share on other sites

Hi Ben.

 

I am having a similar problem with the usps module. I performed the dump you suggested and I get the message "invalid sender zip code". Can you tell me where I have to set that zip code. I have search the admin module front to back and could not locate the field.

 

Lewis

 

 

 

Hi Suzi,

 

I'm not seeing your problem, but I am seeing a problem with my website. I assume you are seeing the problem when checkout_shipping.php is attempting to display the available shipping costs for objects in the cart.

 

On my website, I get a list of available options / costs, but regardless of which option the customer selects, they are always billed for the cost of the first item in the USPS list.

 

I'm going to look into my problem, but this isn't going to help you.

 

To figure out what your problem is, you will need to dump the contents of the USPS response to your query. In the includes/modules/shipping/usps.php file find the following code near line 223:

	  $http = new httpClient();
  if ($http->Connect($usps_server, 80)) {
	$http->addHeader('Host', $usps_server);
	$http->addHeader('User-Agent', 'osCommerce');
	$http->addHeader('Connection', 'Close');

	if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody();

	$http->Disconnect();
  } else {
	return false;
  }

Right after this code, add the following line to print out the USPS response to the browser window:

var_dump(htmlspecialchars($body, ENT_QUOTES));

You'll want to make this mode on a development / test server if you have one. Otherwise, the customers who happen to be using the live site will see the debug output also.

 

Post the output that appears at the top of the browser here and we can start figure out what is going wrong.

 

Ben

Link to comment
Share on other sites

Hi Ben.

 

I am having a similar problem with the usps module. I performed the dump you suggested and I get the message "invalid sender zip code". Can you tell me where I have to set that zip code. I have search the admin module front to back and could not locate the field.

 

Lewis

Lewis,

 

The sender's (store's) zip code parameter is defined in:

 

admin -> Configuration -> Shipping/Packaging

 

Define all the parameters in that section and you should be fine.

 

Ben

Edited by bpopelar
Link to comment
Share on other sites

Hi Ben,

 

I was hoping you could help me out.

 

I used the code that you suggested, and the error I received was:

 

string(186) "<Error> <Number>80040b1a</Number> <Description>Username exceeds maximum length.</Description> <Source>UspsCom::DoAuth</Source> </Error>"

 

Am I correct in thinking the username is too long? From what I understand, the username is the e-mail address. How can I fix this?

 

Thanks!

Emma

 

 

Hi Suzi,

 

I'm not seeing your problem, but I am seeing a problem with my website. I assume you are seeing the problem when checkout_shipping.php is attempting to display the available shipping costs for objects in the cart.

 

On my website, I get a list of available options / costs, but regardless of which option the customer selects, they are always billed for the cost of the first item in the USPS list.

 

I'm going to look into my problem, but this isn't going to help you.

 

To figure out what your problem is, you will need to dump the contents of the USPS response to your query. In the includes/modules/shipping/usps.php file find the following code near line 223:

	  $http = new httpClient();
  if ($http->Connect($usps_server, 80)) {
	$http->addHeader('Host', $usps_server);
	$http->addHeader('User-Agent', 'osCommerce');
	$http->addHeader('Connection', 'Close');

	if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody();

	$http->Disconnect();
  } else {
	return false;
  }

Right after this code, add the following line to print out the USPS response to the browser window:

var_dump(htmlspecialchars($body, ENT_QUOTES));

You'll want to make this mode on a development / test server if you have one. Otherwise, the customers who happen to be using the live site will see the debug output also.

 

Post the output that appears at the top of the browser here and we can start figure out what is going wrong.

 

Ben

Link to comment
Share on other sites

Hi Ben,

 

I was hoping you could help me out.

 

I used the code that you suggested, and the error I received was:

 

string(186) "<Error> <Number>80040b1a</Number> <Description>Username exceeds maximum length.</Description> <Source>UspsCom::DoAuth</Source> </Error>"

 

Am I correct in thinking the username is too long? From what I understand, the username is the e-mail address. How can I fix this?

 

Thanks!

Emma

Emma,

 

The username is a machine generated name provided by USPS (along with a password) when you sign up for an account with them. It is not an email address.

 

You will need to register for an account with USPS at http://www.uspsprioritymail.com/et_regcert.html if you haven't done so already.

 

Ben

Link to comment
Share on other sites

  • 1 year later...

.... When I tried to purchase a membership, not only does it take me through the shipping process (which I don't want), but I also get this error message saying: "An error occurred with the USPS shipping calculation." I'm assuming this message stems from the fact that we have a product that doesn't have any weight to it, but in all honesty I really don't know what's going on.

 

Does anyone have any insight into the problem or suggestions as to fixing it?

 

Thanks!

Em

 

Not sure about the weight thing, but, when testing, I get this message if I enter a non-existent zip code by choice or typo. I didn't need to go into the code of the site at all as discussed above.

 

Use a valid zip in the shipping and billing addresses and the module worked fine - maybe you need to go into the admin settings at most if your own zip is not set correctly.

 

Seems to key off the zip - if your city and/or state are incorrect, the module will still show up OK (eventhough wrong) as long as a valid zip code is entered. The zip doesn't have to be the right one, just valid somewhere in the US.

 

Hope this helps someone!

Edited by flowergirl
Link to comment
Share on other sites

  • 3 weeks later...

Hi Suzi,

 

I'm not seeing your problem, but I am seeing a problem with my website. I assume you are seeing the problem when checkout_shipping.php is attempting to display the available shipping costs for objects in the cart.

 

On my website, I get a list of available options / costs, but regardless of which option the customer selects, they are always billed for the cost of the first item in the USPS list.

 

I'm going to look into my problem, but this isn't going to help you.

 

To figure out what your problem is, you will need to dump the contents of the USPS response to your query. In the includes/modules/shipping/usps.php file find the following code near line 223:

	  $http = new httpClient();
  if ($http->Connect($usps_server, 80)) {
	$http->addHeader('Host', $usps_server);
	$http->addHeader('User-Agent', 'osCommerce');
	$http->addHeader('Connection', 'Close');

	if ($http->Get('/' . $api_dll . '?' . $request)) $body = $http->getBody();

	$http->Disconnect();
  } else {
	return false;
  }

Right after this code, add the following line to print out the USPS response to the browser window:

var_dump(htmlspecialchars($body, ENT_QUOTES));

You'll want to make this mode on a development / test server if you have one. Otherwise, the customers who happen to be using the live site will see the debug output also.

 

Post the output that appears at the top of the browser here and we can start figure out what is going wrong.

 

Ben

 

Ben, Thank you for your quick response. I get the following when adding the debugging code:

 

string(377) "<?xml version="1.0"?> <Error><Number>-2147219085</Number><Source>Rate_Respond.DomesticRatesV2;SOLServerRates.Rate_Respond</Source><Description>Invalid XML Element cannot be empty according to the DTD/Schema. </Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error> "

Link to comment
Share on other sites

Ben, Thank you for your quick response. I get the following when adding the debugging code:

 

string(377) "<?xml version="1.0"?> <Error><Number>-2147219085</Number><Source>Rate_Respond.DomesticRatesV2;SOLServerRates.Rate_Respond</Source><Description>Invalid XML Element cannot be empty according to the DTD/Schema. </Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error> "

 

I sure need to get this figured out fast. The store just got 3 orders in with no postage.

Link to comment
Share on other sites

I sure need to get this figured out fast. The store just got 3 orders in with no postage.

 

I have been sitting here too long. I JUST realized I am replying to a very old post...geez. I'm getting too old for this stuff.

Link to comment
Share on other sites

Emma,

 

The username is a machine generated name provided by USPS (along with a password) when you sign up for an account with them. It is not an email address.

 

You will need to register for an account with USPS at http://www.uspsprioritymail.com/et_regcert.html if you haven't done so already.

 

Ben

 

 

Hi Ben,

 

The address you list gives an error message:

 

Sorry, that’s not a valid address.

Please double-check the URL and try again.

 

I found a new address:

https://secure.shippingapis.com/registration/

Edited by mangaskahn
Link to comment
Share on other sites

  • 4 months later...

Hi All,

 

Am having difficulty where I can not get any actual rates to display in the shipping section of my checkout process with this module. I have done the debug stuff mentioned above, and I'm not getting any errors. It looks to me like everything is being returned by usps, but for some reason it's not being displayed to the customer at checkout.

 

How or where do I set which shipping options are available to customers? I don't see it in the admin->config .. and I don't immediately see where I am supposed to edit it in the usps.php file?

 

What additional details can I provide to help?

 

Thanks,

Chris

Link to comment
Share on other sites

  • 1 year later...

I am scratching my head.

Installed the module, emailed the postal folks to move us to to production server,

All is well if I set the module to present rates for Cont. U.S.

But.

We only use the post office for Alaska, Hawaii and APO and FPO addresses.

When I test a known APO, AE address I get:

<Package ID="1">

<Error>

<Number>-2147219401</Number>

<Source>;clsRateV4.CreateSinglePostage-CreateSinglePostage;RateEngineV4.ProcessRequest</Source>

<Description> Error Information: The Destination ZIP Code you have entered is invalid.</Description>

<HelpFile></HelpFile>

<HelpContext>1000440</HelpContext>

</Error>

</Package>

</RateV4Response>

 

Address is:

APO, AE 09391

This is a valid US Postal Service zip code.

This did not happen with the old USPS module that went dark on us.

Any thoughts?

If you choose not to decide you still have made a choice, I will choose a purpose clear, I will choose Free Will. --Neal Peart - Rush

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...