Jump to content



Photo
- - - - -

USPS Basic Install Error


  • Please log in to reply
7 replies to this topic

#1   lplplpx3

lplplpx3
  • Members
  • 33 posts
  • Real Name:Lola Phelps

Posted 16 July 2012 - 19:59

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, 16 July 2012 - 20:00.


#2   Praful Kamble

Praful Kamble
  • Members
  • 325 posts
  • Real Name:Praful
  • Gender:Male
  • Location:Pune, India

Posted 17 July 2012 - 07:29

@lplplpx3

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

Edited by Praful Kamble, 17 July 2012 - 07:32.

Like post..hit LIKE button.

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

Guaranteed Website Speed Optimization!!

#3   lplplpx3

lplplpx3
  • Members
  • 33 posts
  • Real Name:Lola Phelps

Posted 17 July 2012 - 19:18

@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, 17 July 2012 - 19:19.


#4   DunWeb

DunWeb

    The Censored One

  • Members
  • 13,084 posts
  • Real Name:Chris
  • Gender:Male
  • Location:Ontario, Canada

Posted 18 July 2012 - 01:37

@lplplpx3

I suggest installing USPS Methods which has updated code for USPS




Chris
:|: Was this post helpful ? Click the LIKE THIS button :|:

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

#5   Praful Kamble

Praful Kamble
  • Members
  • 325 posts
  • Real Name:Praful
  • Gender:Male
  • Location:Pune, India

Posted 18 July 2012 - 05:46

@lplplpx3

Go with the module Chris suggested.
Like post..hit LIKE button.

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

Guaranteed Website Speed Optimization!!

#6   lplplpx3

lplplpx3
  • Members
  • 33 posts
  • Real Name:Lola Phelps

Posted 21 July 2012 - 01:59

@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, 21 July 2012 - 02:06.


#7   lplplpx3

lplplpx3
  • Members
  • 33 posts
  • Real Name:Lola Phelps

Posted 21 July 2012 - 05:54

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...m</Description> <Source>UspsCom::DoAuth</Source> </Error>"

#8   lplplpx3

lplplpx3
  • Members
  • 33 posts
  • Real Name:Lola Phelps

Posted 21 July 2012 - 08:12

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('you@yourdomain.com','USPS rate quote response',$body,'From: <you@yourdomain.com>');
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;
}