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

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
USPS extension on but not showing up
« on: November 19, 2017, 07:46:09 PM »
Hello everyone,

New to the forum here. 

I installed the USPS extension and enabled it, but USPS is not showing up as a shipping option at check out.  I'm not including shipping in the price of the items I'm selling.  I've enabled priority mail and media mail, but I don't see these options at checkout.

I tested my user ID using the XML test request that the USPS suggests, and I got a response back.  So, my user ID isn't an issue.

I've tried uninstalling and then reinstalling the extension, but that didn't fix things.

Am I missing something?  Any suggestions are appreciated.

Thanks for your time.

ETA: I tried enabling another shipping extension, e.g., default_free_shipping, and that option appeared at checkout.
« Last Edit: November 19, 2017, 11:30:54 PM by Heemet »

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 4364
  • Karma: +204/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #1 on: November 20, 2017, 01:02:48 AM »
Hello. Make sure your product have correct weight, also check your USPS API is in live, check that customer address is valid etc.
https://abantecart.atlassian.net/wiki/spaces/AD/pages/17661953/USPS
“Chuck Norris is so amazing.”
― Mother Teresa

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #2 on: November 20, 2017, 11:58:28 AM »
Thanks.  I've got the weight set.

The API appears to be active.  Per the USPS's suggestion, I inserted the following XML code (edited because I can't post an external link) into my browser's search bar (replacing xxxxxxxxxxxx with my userID), and I got a response, which would seem to indicate that my userID is active:

.....ShippingApi.dll?API=RateV4&XML=<RateV4Request USERID="xxxxxxxxxxxx">
<Package ID="1ST">
<Service>PRIORITY</Service>
<ZipOrigination>44106</ZipOrigination>
<ZipDestination>20770</ZipDestination>
<Pounds>1</Pounds>
<Ounces>8</Ounces>
<Container>NONRECTANGULAR</Container>
<Size>LARGE</Size>
<Width>15</Width>
<Length>30</Length>
<Height>15</Height>
<Girth>55</Girth>
</Package>

</RateV4Request>

How do I see what XML code is being sent to the USPS and the XML I'm receiving in response?

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 4364
  • Karma: +204/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #3 on: November 21, 2017, 01:08:26 AM »
Hi.

What is your AbanteCart and USPS extension versions?
“Chuck Norris is so amazing.”
― Mother Teresa

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #4 on: November 21, 2017, 02:31:20 PM »
Hi,

AbanteCart v. 1.2.11

USPS extension v. 1.0.2

I did a clean install of AbanteCart last night, and installed the USPS extension.  At first, the shipping option didn't show up on the stock site, but after filling in some of the details in System->Settings->Store details, USPS started showing up as a shipping option.  I don't understand that.

I fooled around today with turning on and off various shipping options in the USPS extension, e.g., priority mail, media mail, first class mail.  At first I could see some of these options showing up in the cart estimate (although they didn't match exactly what I had just selected) but now USPS is no longer available as a shipping option.  It's very strange.

Our site uses Cloudflare.  I'm not sure if that's a problem.  I've tried turning on development mode in Cloudflare (to turn off caching there), but it didn't make a difference.

Thanks!

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 4364
  • Karma: +204/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #5 on: November 22, 2017, 12:30:45 AM »
Our site uses Cloudflare.  I'm not sure if that's a problem.  I've tried turning on development mode in Cloudflare (to turn off caching there), but it didn't make a difference.

Hello. Try to disable it completely.   ::) Cloudflare knows as bug maker. They have a lot of experimental or not well supported features. If you still want to use it I suggest to enable only images and css caching. This will speed up your site and will not broke anything.
“Chuck Norris is so amazing.”
― Mother Teresa

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #6 on: November 22, 2017, 12:27:35 PM »
Thanks for your reply and your continued help.  I disabled Cloudflare and changed the nameservers back to my original host's.  USPS shipping is still not showing up as an option.  I've confirmed that the page is being served by my host and no longer Cloudflare.

When I first view the cart, the form data sent with the POST (request URL "Request URL:.../store/index.php?rt=r/checkout/cart/change_zone_get_shipping_methods") sent by the shipping estimator is "country_id=223&zone_id=3663&postcode=", which makes sense, since no zip code was inputted yet.  The response is "{"default_usps":{"title":"United States Postal Service","quote":[],"sort_order":"0","error":"Missing value for ZipDestination."},"selectbox":""}", which also makes sense.

When I input the zip code in the shipping calculator, the URL request is the same, and the form data includes the zip code.  However, the response (in the browser's console) is blank.

How do I check the XML sent to the USPS's API and the response?

ETA: My workaround for this is to set up weight-based shipping, which I can easily do because all of my items will ship USPS media mail, which is solely a weight-based shipping method.  At this point, I'm trying to get to the bottom of this for the sake of others who might be facing a similar problem.  Thank you!
« Last Edit: November 22, 2017, 12:31:25 PM by Heemet »

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1782
  • Karma: +247/-11
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: USPS extension on but not showing up
« Reply #7 on: November 23, 2017, 03:57:02 AM »
How do I check the XML sent to the USPS's API and the response?

hi.
You can open file public_html/extensions/default_usps/storefront/model/extension/default_usps.php and put inside something like that
Code: [Select]
$this->log->write(var_export($xml,true));
before curl-request, in line 231
Then see xml in your error-log on admin side
“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 #8 on: November 24, 2017, 12:06:13 AM »
Thanks you, abolabo! 

The XML code passed to the USPS's API and visible in the error-log is correct.

I added the following to line 238 of default_usps.php and I logged a response back from the USPS:
$this->log->write(var_export($result,true));

The response is well formed, and the prices are correct, but I'm seeing no estimates for USPS shipping options in the cart estimator.  I have only first class, priority mail, and media mail enabled.

I guess the data back from the USPS isn't getting into the drop-down box?

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 4364
  • Karma: +204/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #9 on: November 24, 2017, 12:41:14 AM »
Hi. Estimate require to enter ZIP code. Without zip it will not work
“Chuck Norris is so amazing.”
― Mother Teresa

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #10 on: November 24, 2017, 11:31:50 AM »
Hi Basara,

I inputted the zip code.  Here's the log for the outgoing XML (USERID and PASSWORD redacted):

2017-11-23 22:53:54 - '<RateV4Request USERID="XXXXX" PASSWORD="XXXXX">   <Package ID="1">   <Service>ALL</Service>   <ZipOrigination>19610</ZipOrigination> <ZipDestination>19610</ZipDestination>   <Pounds>1</Pounds>   <Ounces>9.12</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>'

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!

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 4364
  • Karma: +204/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #11 on: December 12, 2017, 08:44:57 AM »
Hello.

FYI one issue were fixed in 1.2.12 you can apply fix to 1.2.11 manually see commit in https://github.com/abantecart/abantecart-src/issues/1034
“Chuck Norris is so amazing.”
― Mother Teresa

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #12 on: December 13, 2017, 11:42:30 PM »
Thank you, gentlemen, for your assistance with this.  I successfully applied the fix manually, and it works perfectly now.

 :)

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #13 on: September 07, 2018, 11:50:28 PM »
It appears that the problem has reappeared.  I have upgraded to AbanteCart v 1.2.13, and the USPS option has disappeared as a shipping option.  I do not see it when estimating shipping in my shopping cart.

I modified the usps extension to log the xml request and response (lines 231-238 of public_html/extensions/default_usps/storefront/model/extension/default_usps.php):
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 checked the log file.  The request is well formed, but the result is blank.

Any idea what happened?

Offline Heemet

  • Newbie
  • *
  • Posts: 17
  • Karma: +4/-0
    • View Profile
Re: USPS extension on but not showing up
« Reply #14 on: September 08, 2018, 12:01:53 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?

 

Powered by SMFPacks Social Login Mod