Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: USPS extension on but not showing up  (Read 14868 times)

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5774
  • Karma: +274/-2
    • View Profile
Re: USPS extension on but not showing up
« Reply #15 on: September 10, 2018, 01:18:13 AM »
The top of default_usps.php installed in my store still says © 2011-2017 Belavier Commerce LLC.  Is that right, or does that indicate that it is not the right version of default_usps.php for v 1.2.13?

Upgrade package usually do not contain small changes like year in comments. But you can always get latest code from https://github.com/abantecart/abantecart-src/tree/master/public_html/extensions

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #16 on: September 11, 2018, 10:28:01 PM »
I guess what I'm saying is that it does not appear that the USPS extension upgraded when I upgraded from AbanteCart 1.2.12 to 1.2.13.  I suspect that is the reason it is no longer working. 

How do I download the entire default_usps folder from GitHub so that I can copy it into CPanel?  Or can I delete the extension from within the store admin site and reinstall it?

Thanks!

Offline natdroid

  • Full Member
  • ***
  • Posts: 113
  • Karma: +36/-3
    • View Profile

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #18 on: September 12, 2018, 11:01:29 PM »
Thanks for the link. 

It appears that the USPS extension did not update when I updated to AbanteCart 1.2.13.  I updated the extension manually, uninstalled it, and then reinstalled it and tried it out in a test shopping cart.  It is still not working.

I added the following to public_html/store/extensions/default_usps/storefront/model/extension/default_usps.php (lines 234-241):

Code: [Select]
$this->log->write(var_export($xml,true));
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://secure.shippingapis.com/ShippingAPI.dll?'.$request);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
$this->log->write(var_export($result,true));

I'm not getting a response back from the USPS after clicking "Estimate" in the shopping cart.

This is what the log file shows:
2018-09-13 2:47:06 - '<RateV4Request USERID="XXX" PASSWORD="XXX">   <Package ID="1"> <Service>ALL</Service> <ZipOrigination>02138</ZipOrigination> <ZipDestination>02138</ZipDestination> <Pounds>0</Pounds> <Ounces>2.08</Ounces> <Container>VARIABLE</Container> <Size>REGULAR</Size> <Width>11.875</Width> <Length>13.625</Length> <Height>3.375</Height> <Girth>44.1</Girth> <Machinable>true</Machinable>   </Package></RateV4Request>'

2018-09-13 2:47:06 - ''

The default USPS extension worked prior to the upgrade.  Any advice is appreciated.

Thanks!

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2046
  • Karma: +318/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: USPS extension on but not showing up
« Reply #19 on: September 13, 2018, 02:54:01 AM »
Here's the of the XML response from the USPS:

2017-11-23 22:53:55 - '<?xml version="1.0" encoding="UTF-8"?>
<RateV4Response><Package ID="1"><ZipOrigination>19610</ZipOrigination><ZipDestination>19610</ZipDestination><Pounds>1</Pounds><Ounces>9.12</Ounces><Size>REGULAR</Size><Machinable>TRUE</Machinable><Zone>1</Zone><Postage CLASSID="3"><MailService>Priority Mail Express 2-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</MailService><Rate>23.75</Rate></Postage><Postage CLASSID="2"><MailService>Priority Mail Express 2-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Hold For Pickup</MailService><Rate>23.75</Rate></Postage><Postage CLASSID="1"><MailService>Priority Mail 2-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt;</MailService><Rate>7.20</Rate></Postage><Postage CLASSID="17"><MailService>Priority Mail 2-Day&amp;lt;sup&amp;gt;&amp;#8482;&amp;lt;/sup&amp;gt; Medium Flat Rate Box</MailService><Rate>13.60</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail Parcel</MailService><Rate>3.12</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail Parcel</MailService><Rate>2.97</Rate></Postage></Package></RateV4Response>'

The response is correct.  The item costs USD 3.12 to ship via media mail.  However, none of the prices are showing up in the drop down box in the shipping estimator.

Thanks!

You should to check customer address , usps settings (location) and store address.
Filtering of shipping methods list based on it
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #20 on: September 13, 2018, 09:13:39 PM »
Thanks.  The request sent to the USPS API is well formatted.  If I paste it into the address bar on my browser, I get a response with the correct information fro the USPS API.  However, the response being logged in AbanteCart's log is empty.  The problem isn't with customer address, usps settings (location), or store address, I don't believe.  I've verified those.

I think something is going wrong with cURL session, but I'm not terribly familiar with php.

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5774
  • Karma: +274/-2
    • View Profile
Re: USPS extension on but not showing up
« Reply #21 on: September 18, 2018, 03:03:26 AM »
Hello.

USPS is work in 1.2.13
I think you need to ask your hosting support about recent changes on server.
Take a note that anything additional like cloudflare "optimizations" (  :'( ) or server mod_security module may block some requests

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #22 on: October 03, 2018, 10:40:21 PM »
Thanks, Basara.  I modified the default_usps.php file to find out what exactly was happening with the cURL request.  It was properly formatted.  The response I was getting was a 400 bad gateway.

Per your suggestion, I followed up with the hosting provider.  They had recently moved my site to a new server.  I told them that I thought the problem was with the PHP cURL package.  They decided to move my site to another server, and sure enough, the problem went away.

So, the problem turned out to be in the host's cURL package.  It was a tough bug to track down.

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5774
  • Karma: +274/-2
    • View Profile
Re: USPS extension on but not showing up
« Reply #23 on: October 04, 2018, 01:00:51 AM »
Thanks, Heemet for the update  :)

 

Powered by SMFPacks Social Login Mod