USPS shipping quotes

Posts: 60
Joined: 11/27/2007

I have spent some time trying to get USPS shipping quotes working on my website. I am authorized to use the USPS production server. I have checked multiple times my settings, watched via firebug in firefox, updated to the bazaar code late 12/31 and still can't get a quote. Firebug shows me that there is a no response. Simply showing [ ] in the responses. I have pored through the forums and seen others having similar problems, but no solutions that have worked for me.

Anyone have a solution that has worked for them?

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Try sending a request "manually" by typing the following URL into your browser:

http://production.shippingapis.com/ShippingAPI.dll?API=RateV3&XML=<RateV3Request%20USERID="xxxxxxx"><Package%20ID="0"><Service>ALL</Service><ZipOrigination>98144</ZipOrigination><ZipDestination>10010</ZipDestination><Pounds>1</Pounds><Ounces>0</Ounces><Size>REGULAR</Size><Machinable>True</Machinable></Package></RateV3Request>

Don't forget to put your own USERID in where I used xxxxxxx above.

If the USPS server doesn't send you a valid response to this string, then your problem is not with the Ubercart code.

--

<tr>.

Posts: 60
Joined: 11/27/2007

Thanks.

By entering that url, I do get a valid response from the USPS server. So the problem is not there. Next idea?

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

What version of Ubercart, uc_usps, & PHP are you using? There have been a lot of changes to the shipping modules recently. It's a bit unclear exactly what minimum version of PHP is required, but if you're using PHP 4.something there's a chance that this is the problem.

In Firebug, you're looking at the response from "POST http://example.com/cart/checkout/shipping/quote" ? If you send invalid info to the USPS server, you should at least get back an error. If you don't see any response I would venture to guess the request was never sent. Before you go any further I would switch to a default theme to ensure jQuery etc. is getting included on your pages. You can then stick in these print statements, one right before the call to drupal_http_request() and one right after (in uc_usps.module, function uc_usps_quote()):
drupal_set_message('<pre>'. htmlentities($request) .'</pre>');
drupal_set_message('<pre>'. htmlentities($result->data) .'</pre>');
These should print the request and response. At least you'll know that the quote function is being called... Just remember, drupal_set_message() will display it's output on the *next* page you load; because shipping quotes don't reload the page (since they use AJAX) you'll have to click on a link and go to another page, any other page on your site, to see the messages.

If you do see a request being sent, verify that the content of the XML your site is sending the USPS server is complete, by comparing the content to the test URL. If some info is missing or wrong (say, you haven't set the store address, so the origin ZIP isn't being sent) then you should be able to identify and fix it in the admin settings.

If everything still looks good, you might have a problem with your server setup - is there a proxy? You can test this by executing "curl URL" on your server command line, where URL is the test URL from my previous post.

Stupid questions (that's all I have left...): You did enable the USPS quote method in admin/store/settings/quotes/methods ? And enable quotes for some of the services at admin/store/settings/quotes/methods/usps ? workflow_ng module is installed?

--

<tr>.

Posts: 146
Joined: 11/10/2007
Bug Finder

I upgraded to on 12-31 and usps stopped working for me too.. I inverted back and it works again.

Anybody else?

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

What version did you revert back to?

Posts: 146
Joined: 11/10/2007
Bug Finder

The one prior to 31-Dec-2007 @ 11:01

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 146
Joined: 11/10/2007
Bug Finder

Keep in mind I have the latest running from Wed 2008-01-02 @ 7:10:39. I just reverted an older uc_usps.module file and it works. Was there any major changes in the new file?

The older file is attached

AttachmentSize
working_uc_usps.txt25.62 KB
--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 60
Joined: 11/27/2007

Thanks again TR.

I am using the ubercart code from the bazaar 12/31/07. I updated because I was getting many error messages with the alpha 8 version with USPS quotes. Flatrate was working. Now no error messages with the bazaar code, but no USPS quotes and flatrate doesn't show up in shipping charges in the cart. Just for curiosity, I went to the checkout page and then restored the old alpha 8 code for uc_usps.module and now DID not get coding errors, but did get rates that were very high ($297 for priority mail for an 8 pound package!).

My PHP version is 4.3.11. I've been dragging my feet on moving to a server with PHP 5 because my ISP wants me to do the site backup then restore to the new server. I have several very active Drupal sites. I don't have much time to do the work.

I entered the lines of code. for some reason, even though I did a cut and paste from your message any call to the uc_usps.module would drop me from the site. The only way to see the results was go to the checkout page, then upload the revised code, enter a zip code and to reload the page. The request and the response seem to be OK, although the length of both was wider than my page. As far as I could read them, they were OK.

I have been over and over my store settings. Store address is OK. I have selected the proper shipping methods. I am using workflow-ng version 1.5. It seems to update active configs correctly as I enable/disable shipping methods.

Next ideas?

Posts: 60
Joined: 11/27/2007

I dropped the code attached to alien73's post and my flat rate calculation was restored! Unfortunately, the USPS quote still is not working.

Now, there is a problem with the flat rate calculation now. The review order screen is showing the store default flat rate NOT the rate from the product--which in my test case was different. Makes unhappy customers to show different shipping costs between checkout and review order screens.

Posts: 146
Joined: 11/10/2007
Bug Finder

It's works for me

here's the code changes from the old to the new. There's only 4 changes

The first 2 are lines 46 and 102

old
$enabled = variable_get('uc_quote_enabled', array('usps' => true));

new
$enabled = variable_get('uc_quote_enabled', array());

3rd change line 165

old
$enabled = variable_get('uc_quote_enabled', array('usps' => true, 'usps_intl' => true));

new

$enabled = variable_get('uc_quote_enabled', array());

4th change line 309

if (!in_array($service, $usps_services)){

new

if ($service != 'data' || !in_array($service, $usps_services)){

So it appears that uc_quote_enabled is not fetching the array? Umm any ideas?

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

Ah, that's what's going on. Thanks for isolating the changes.

I made that change because the Workflow-ng configurations were being enabled but the shipping methods weren't. Go to the Shipping quotes methods settings and resubmit that form. It should just be a matter of enabling the ones you want. I had expected that everyone would have done that already, so I didn't think changing the default value would affect anyone.

Posts: 146
Joined: 11/10/2007
Bug Finder

These were already set. I only use realtime rates

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

So you have a 'uc_quote_enabled' row in your variable table, and it includes "usps" in it somewhere?

Posts: 146
Joined: 11/10/2007
Bug Finder

ummm not sure what you mean sorry

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

The database table "variable" has two columns: name and value. Does yours have a row with name = "uc_quote_enabled" and a value that contains "usps"?

Posts: 146
Joined: 11/10/2007
Bug Finder

Yep it's there

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 60
Joined: 11/27/2007

Mine is, too. I've resubmitted the forms for all shipping quote methods. I'm still not getting the shipping quote.

Posts: 146
Joined: 11/10/2007
Bug Finder

Try going to Workflow-ng and click on the usps. Deactivate there then click Revert to defaults. I know it sounds simple but it worked for me. It's almost like Workflow-ng and Ubercart are not flowing together yet. Still no luck with UPS though

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 60
Joined: 11/27/2007

Thanks. I did the deactivate/reactivate, revert to defaults in workflow-ng. Problem of shipping calculations is resolved. However, when I click review cart, I get a number of errors preceeding a comment that I didn't select a shipping method.

I was using the version attached by alien73 to an earlier message. When I returned to the 12-31 module file from bazaar, no shipping calculations were performed.

Posts: 146
Joined: 11/10/2007
Bug Finder

what's your site's address

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 146
Joined: 11/10/2007
Bug Finder

Try deleting your cart then enter a new product then if you get the same error refresh your browser. This worked for me also. Almost a cache thingy

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Hmm, VERY interesting. I've been having a problem recently with flatrate not working on my development server - all other shipping methods are working so I just assumed I had screwed up the flatrate module by messing with the code. I don't plan on using flatrate in my production server so I haven't spent the time trying to fix it.

But seeing the workflow_ng magic spell above, I decided to give that a shot: I deactivated the flatrate workflow_ng configurations in admin/build/workflow-ng then reverted them to default (which activates them again). Now flatrate works for me!

I know funny behavior of shipping quotes is something that's been mentioned in quite a few threads. I'll bet they're all related - I wonder if this isn't a workflow_ng issue rather than a shipping quotes module issue...

I don't think it's a straightforward caching thing, because I've used the devel module many times to flush my cache since flatrate flaked on me, and that didn't fix it.

The shipping modules I'm using are not Alpha 8, but not the latest either. They all seem to date to 11/5/07 with a datestamp of "1194301212". The rest of my Ubercart code is Alpha 8. Workflow_ng is version 5.x-1.0 dated 9/16/07 datestamp "1189973106".

--

<tr>.

Posts: 146
Joined: 11/10/2007
Bug Finder

I would bet money it's something to do with workflow_ng

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 15
Joined: 12/19/2007

Hi,

I tried resetting my USPS quotes under workflow_ng as suggested above, and that did work for USPS shipping quotes, which now work on my site. However, no amount of resetting, or playing with the shipping quote settings seems to fix the problems I'm having with USPS International, or UPS shipping quotes, which are the most important two for me. I have another thread out there talking about this at:

http://www.ubercart.org/forum/support/2384/ups_shipping_quotes_need_sele...

Anyone have any ideas? Is there an older version of Ubercart, or the shipping modules I could revert back to that do work? I love everything else about Ubercart, except that I can't seem to get all the shipping modules working. I'm also considering giving the FedEx module a try. Anyone having any luck with that one?

Thanks,
Patrick.

Posts: 60
Joined: 11/27/2007

I uploaded workflow_ng 1.6 to my site and found, after resetting the USPS quotes did get reasonable quotes! One problem I am asking for quotes for both parcel post and priority mail. The parcel post quote is always the higher of the two.

Also, once I do select the shipping method and click on the review checkout button, I am presented with a list of 22 error messages all from line 244 of ubercart/uc_store/includes/simplexml.php. This is followed by a message telling me that I didn't select the proper shipping method.

The checkout process works well with the flatrate quote method, except that the review order page always selects the default flat rate shipping even when the product has its own shipping rate.

I'd really, really like to see this fixed and am happy to do some testing with modified code.

Posts: 16
Joined: 12/19/2007

Hey guys!

It sounds like this is exactly the issue I'm having. However, I'm not sure what you mean when you say you're reseting workflow-ng... When I go to admin/build/workflow-ng I don't see anything that seems to imply that I can 'reset' or 'deactivate' it.

The only option I have under "Operations" is "Edit".

Of course, it's very possible I entirely missed something.

anyone have any ideas?

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

The "Edit" form has the setting for enabling or disabling the configuration. It's a confusing interface, because the name of the configuration links to the conditions and actions.