Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

USPS Basic Install Error


lplplpx3

Recommended Posts

On version 2.2. Got webtools account and ugraded to the production server. No mods are on the USPS files. When checking out, I get the following error:

An error occured with the USPS shipping calculations. If you prefer to use USPS as your shipping method, please contact the store owner.

 

The unaltered code looks like this:

$http = new httpClient();

if ($http->Connect('production.shippingapis.com', 80)) {

$http->addHeader('Host', 'production.shippingapis.com');

$http->addHeader('User-Agent', 'osCommerce');

$http->addHeader('Connection', 'Close');

 

if ($http->Get('production.shippingapis.com/shippingapi.dll?' . $request)) $body = $http->getBody();

 

If the transaction is performed from a secure page (that starts with https) does this code need to be changed in any way? Any ideas why I'm getting an error? I have enabled the module, updated my zip (5 characters only), set the Sort Order to 1, of course added my username and password but not joy.

 

Any help would be much appreciated. Thanks.

Edited by lplplpx3
Link to comment
Share on other sites

@@lplplpx3

 

What version of USPS module are you using? Try to debug and check the error log.

Edited by Praful Kamble

Like post..hit LIKE button.

 

osCommerce | Joomla | WordPress | Magento | SEO | CakePHP | CI

 

Guaranteed Website Speed Optimization!!

Link to comment
Share on other sites

@@Praful Kamble

 

Not sure what module this is but the top of the file reads:

 

$Id: usps.php 1783 2008-01-10 01:16:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2008 osCommerce

 

Not sure how to debug and check the error log. If I need to update module. Please advise. Thanks.

Edited by lplplpx3
Link to comment
Share on other sites

@@DunWeb @Praful Kamble

 

I saw this page but got completely stuck as to which version or what exactly I needed to install. I went with 3.0 as I read this worked flawlessly for someone else recently who was getting the same error. Did the install and attempted to follow steps BUT step 6 required code be changed in the catalog/admin/includes/functions/general.php file. When I searched for the code it wasnt in the file at all and therefore couldnt be replaced so I was back to square 1.

 

What is your suggestion? When you say USPS methods do you mean start with the very first version (with no version no) from 16 Nov 2002? Please explain what number I need exactly and how its done ie do I need to start with nov 2002 and then do each one after that (which would be over 30-something installs)? Confused!!! Im a newbie but can (usually) follow directions well. Thanks much.

Edited by lplplpx3
Link to comment
Share on other sites

OK installed version 3.0...still get error. Did a dump and here's the output:

 

string(310) "<Error> <Number>80040b1a</Number> <Description>API Disabled: Rate. This API has been retired. Please use RateV4. Documentation can be found at https://www.usps.com/business/webtools-technical-guides.htm</Description> <Source>UspsCom::DoAuth</Source> </Error>"

Link to comment
Share on other sites

Fixed. Thanks for everyones help and just in case anyone has this nightmare...from Version 3.0 installed "USPS Methods 5.2.0 V4IntlV2 Compatible" which has everything working fine.

 

Also, got the browser dump error message by adding the the line to includes/modules/shipping/usps.php:

var_dump(htmlspecialchars($body, ENT_QUOTES));

 

right after:

$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();

// mail('[email protected]','USPS rate quote response',$body,'From: <[email protected]>');

if ($transit && is_array($transreq) && ($order->delivery['country']['id'] == STORE_COUNTRY)) {

while (list($key, $value) = each($transreq)) {

if ($http->Get('/' . $api_dll . '?' . $value)) $transresp[$key] = $http->getBody();

}

}

 

$http->Disconnect();

 

} else {

return false;

}

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...