glampkin Posted July 1, 2008 Share Posted July 1, 2008 I am having some problems with my the usps shipping calculation. I am getting this message at the check out box: "An error occured with the USPS shipping calculations. If you prefer to use USPS as your shipping method, please contact the store owner." I have asked the USPS to change me over to the production server but am still having the same issue. I'm using USPS shipping lables 2.04. Can anyone help me? Thanks Quote Link to comment Share on other sites More sharing options...
cristina.solana Posted July 3, 2008 Share Posted July 3, 2008 I am having some problems with my the usps shipping calculation. I am getting this message at the check out box: "An error occured with the USPS shipping calculations. If you prefer to use USPS as your shipping method, please contact the store owner." I have asked the USPS to change me over to the production server but am still having the same issue. I'm using USPS shipping lables 2.04. Can anyone help me? Thanks Call USPS and have them switch you from the test to the production server, that should do the trick. Quote Link to comment Share on other sites More sharing options...
glampkin Posted July 3, 2008 Author Share Posted July 3, 2008 Call USPS and have them switch you from the test to the production server, that should do the trick. Hi Cristina, I called the USPS and they did switch me over to the production server. They say everything is fine on there side. Do you know what else it could be? Thanks, Quote Link to comment Share on other sites More sharing options...
satish Posted July 3, 2008 Share Posted July 3, 2008 There is a request and a response that is generated thru the module quote. Do add some code so YOu can write that to a file and then paste the file here for further analysis. Satish Quote Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does. Link to comment Share on other sites More sharing options...
glampkin Posted July 3, 2008 Author Share Posted July 3, 2008 There is a request and a response that is generated thru the module quote. Do add some code so YOu can write that to a file and then paste the file here for further analysis. Satish Thanks Satish, but where do I find the module quote. Do you know the path? Is it a .php file? Please let me know, I'll be glad to post it. Quote Link to comment Share on other sites More sharing options...
satish Posted July 3, 2008 Share Posted July 3, 2008 $request = 'API=IntlRate&XML=' . urlencode($request); line 206 in include/modules/usps.php and var_dump $response after line 140 Quote Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does. Link to comment Share on other sites More sharing options...
cristina.solana Posted July 4, 2008 Share Posted July 4, 2008 Hi Cristina, I called the USPS and they did switch me over to the production server. They say everything is fine on there side. Do you know what else it could be?Thanks, Did you get an email saying you had been switched over? Sometimes it is not immediate. If you did not get an email it may not have switched over yet. Mine was pretty fast, but I got an email telling me I had been switched over. I have no idea what else it could be. Sorry. Quote Link to comment Share on other sites More sharing options...
HotBuckles.com Posted July 5, 2008 Share Posted July 5, 2008 Sometimes when USPS update their rates they change their code a little, you have to adjust accordingly Quote Belt Buckles Link to comment Share on other sites More sharing options...
glampkin Posted July 5, 2008 Author Share Posted July 5, 2008 $request = 'API=IntlRate&XML=' . urlencode($request); line 206 in include/modules/usps.php and var_dump $response after line 140 Hi Satish: Here is the first part of the code: $request = 'API=IntlRate&XML=' . urlencode($request); } switch (MODULE_SHIPPING_USPS_SERVER) { case 'production': $usps_server = 'production.shippingapis.com'; $api_dll = 'shippingapi.dll'; break; case 'test': default: $usps_server = 'testing.shippingapis.com'; $api_dll = 'ShippingAPITest.dll'; break; } $body = ''; $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; } $response = array(); while (true) { if ($start = strpos($body, '<Package ID=')) { $body = substr($body, $start); $end = strpos($body, '</Package>'); $response[] = substr($body, 0, $end+10); $body = substr($body, $end+9); } else { break; } } $rates = array(); if ($order->delivery['country']['id'] == SHIPPING_ORIGIN_COUNTRY) { if (sizeof($response) == '1') { if (ereg('<Error>', $response[0])) { $number = ereg('<Number>(.*)</Number>', $response[0], $regs); $number = $regs[1]; $description = ereg('<Description>(.*)</Description>', $response[0], $regs); $description = $regs[1]; return array('error' => $number . ' - ' . $description); } } $n = sizeof($response); for ($i=0; $i<$n; $i++) { if (strpos($response[$i], '<Postage>')) { $service = ereg('<Service>(.*)</Service>', $response[$i], $regs); $service = $regs[1]; $postage = ereg('<Postage>(.*)</Postage>', $response[$i], $regs); $postage = $regs[1]; $rates[] = array($service => $postage); } } } else { if (ereg('<Error>', $response[0])) { $number = ereg('<Number>(.*)</Number>', $response[0], $regs); $number = $regs[1]; $description = ereg('<Description>(.*)</Description>', $response[0], $regs); $description = $regs[1]; return array('error' => $number . ' - ' . $description); } else { $body = $response[0]; $services = array(); while (true) { if ($start = strpos($body, '<Service ID=')) { $body = substr($body, $start); $end = strpos($body, '</Service>'); $services[] = substr($body, 0, $end+10); $body = substr($body, $end+9); } else { break; } } $size = sizeof($services); for ($i=0, $n=$size; $i<$n; $i++) { if (strpos($services[$i], '<Postage>')) { $service = ereg('<SvcDescription>(.*)</SvcDescription>', $services[$i], $regs); $service = $regs[1]; $postage = ereg('<Postage>(.*)</Postage>', $services[$i], $regs); $postage = $regs[1]; if (isset($this->service) && ($service != $this->service) ) { continue; } $rates[] = array($service => $postage); } } } } I can net find an var_dump $response after line 140. Maybe this is the problem? Thanks for all, glampkin Quote Link to comment Share on other sites More sharing options...
satish Posted July 9, 2008 Share Posted July 9, 2008 $n = sizeof($response); before this You place a var dump for response. Satish Quote Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does. Link to comment Share on other sites More sharing options...
cjmac Posted July 11, 2008 Share Posted July 11, 2008 We were having a problem with the shipping choice changing for domestic purchases, but this code fixed that. Thanks! Quote Link to comment Share on other sites More sharing options...
ayeronnie Posted July 14, 2008 Share Posted July 14, 2008 I am getting the same error, but I don't understand how to add the code your talking about. I also did get the e-mail saying it was switched over to production. But still get the error. Quote Link to comment Share on other sites More sharing options...
satish Posted July 14, 2008 Share Posted July 14, 2008 I am getting the same error, but I don't understand how to add the code your talking about. I also did get the e-mail saying it was switched over to production. But still get the error. Whats the error that You are getting. can YOu trap the requesta dn response and paste here. Satish Mantri Quote Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does. Link to comment Share on other sites More sharing options...
ayeronnie Posted July 18, 2008 Share Posted July 18, 2008 Whats the error that You are getting.can YOu trap the requesta dn response and paste here. Satish Mantri I am getting the same error as the person who started this thread. USPS has switched the account to production. I received the e-mail to say it was switched and verified on the phone it was switched. When I called to have it switched, I told them I was using OSC, do I need to make sure they know that? I don't know how to trap the response as you mentioned. what exact code do I use and where do I put it. Also, what is the best contribution to use? I've tried a couple with no luck. At a loss here. Quote Link to comment Share on other sites More sharing options...
satish Posted July 18, 2008 Share Posted July 18, 2008 Go to includes>>Modules>>Shipping >> USPS module file. Here You will find in quote function request and response variables. serializ and write toa file. then paste or else chek if code writes to a log.If so chek the log and paste. Satish Mantri Quote Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does. Link to comment Share on other sites More sharing options...
ayeronnie Posted July 18, 2008 Share Posted July 18, 2008 Go to includes>>Modules>>Shipping >> USPS module file. Here You will find in quote function request and response variables. serializ and write toa file. then paste or else chek if code writes to a log.If so chek the log and paste. Satish Mantri Thank you for the quick reply. Problem is I don't know how to do what your saying. Sorry, just not a coder, or not much of one..:( I understand your saying to get the error, to help figure out what is not working. But I don't know how to code that in to get the error. Quote Link to comment Share on other sites More sharing options...
ayeronnie Posted July 18, 2008 Share Posted July 18, 2008 Okay I fixed my problem. Actually was a real simple fix. Shouldn't have needed to be fix. When I signed up for account on the site, to testing everything, I did not put in the entire state name, just the abbreviation. That was the problem. I still have to wonder why they would have just a fill in text box for the state, very odd and could cause all kinds of errors like this one. If customers do not spell their state right or abbreviate it, they would not be getting shipping and see the error. I know I've seen a mod for this, to make the states a drop down instead of fill in the blank, which is should be by default. Next thing I do is install that mod. So any one getting this error, double check the state, could save a lot of grief and time! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.