34 replies [Last post]
seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
Was this information Helpful?

There are several threads about--some I've started--about problems with USPS shipping quotes. I am using bazaar revision 738. For example,

http://www.ubercart.org/forum/bug_reports/2515/uc_quotes_dead_uc7e_and

and several other threads.

In short, USPS shipping charges are collected--albeit I think incorrectly as parcel post is usually quoted as higher than priority mail. When I select one option on the checkout page, and click on the review order button, I usually receive a number of xml parse errors errors and a message telling me that I need to select a valid shipping option. Sometimes no parse errors, but still the request to select a valid shipping option.

There are also flat rate issues, but I am more worried about getting valid, usable USPS quotes.

If anyone would like to see what is happening and make suggestions to help out, I've set up a demo account at:

www.aprilnicole.com
login: demo
pass: demo

Any help would be appreciated.

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: USPS Shipping quote Bugs

Let me address just one of the issues and clear that up first before tackling the others.

I made a test transaction on your site (picture attached) and I see USPS Parcel has a lower rate than USPS Priority, not the other way around.

Disable all quote methods other than USPS and turn on the quote debug display at admin/store/settings/quotes/edit. Then you will be able to see the response from the USPS rate server, which contains all the services and rates that the USPS server is returning to Ubercart.

You can determine the exact USPS rates to expect by going to http://ircalc.usps.gov/ and entering the appropriate information. I can't tell what the store ZIP is so I can't compare the quote I get from your site to the one the USPS tell me. From your test site, I get quoted rates that are much higher in all respects than I would expect, so I assume you're applying a rate markup. I would turn all adjustments off so you can compare the quote determined by Ubercart with the quote from the USPS web calculator.

If you can give some specifics about a particular quote you think is wrong (source and destination ZIP, package weight, complete output of the debug messages you turned on above) it should be easy to verify whether the USPS server is returning the wrong information or whether the shipping module is processing that information wrong.

I have run many test on the USPS quotes as I've set up my store. I have a set of actual orders from my old site which I've entered into my new Ubercart site - I use these as tests to compare the USPS shipping cost charged to the shipping cost I actually paid for that order. (This tests not only the rate quotes but also my product weights and assumed packaging weights, and lets me fine tune my markup to cover my shiping costs.)

I have not found any difference between what the USPS server returns and what I actually paid for a specific package.

<tr>.
TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Re: USPS Shipping quote Bugs

I should also mention that in the image I attached above, there is no time-in-transit information next to the USPS shipping methods. That implies to me that either you don't have the latest USPS module installed or maybe there is a bug in the transit time request to the USPS server - if the transit time stuff is failing it might also account for the xml errors you're reporting. FWIW, transit time works for me on the Beta 1 build 728.

<tr>.
torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: Re: USPS Shipping quote Bugs

FYI, I'm using the latest Bazaar code (741) and am not having any issues with USPS, which is the only shipping method we use ATM.

--
Help directly fund development: Donate via PayPal!

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: Re: Re: Re: USPS Shipping quote Bugs

How about transit times.. I'm seeing Express Mail is 2 days when it always 1 Day or overnight. I believe there is a bug with Parcel and Express getting mixed up.

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: Re: Re: Re: Re: USPS Shipping quote Bugs

If anyone doesn't want to show transit times

Comment out lines: (343,347) in uc_usps.module.

I'm looking through code to see why it's getting messed up.

seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
Re: Re: Re: Re: Re: Re: USPS Shipping quote Bugs

I am using beta1 build 738 and PHP 4.3.11. I will move this site to a server with PHP5, to see if the errors on the review checkout page go away.

To check on the UPSP server info, I selected the debug option in the shipping options page. Then made a test purchase. Here is the XML that was displayed on the checkout page. Looks reasonable to me. I don't see the shipping charges embedded here. However, did display the shipping costs for the proper three USPS quotes. With markup, the charges are correct for Express Mail ($73.80) and Priority Mail ($17.70). Parcel post is quoted at $19.62 where it should be $13.88. The only quote that had a transit time was the Express Mail--and 2 days was reasonable there because both the origin and destinations are small towns. The XML below did have transit times included for the other two methods.

<?xml version="1.0"?>
<ExpressMailCommitmentResponse><OriginZIP>98272</OriginZIP>
<OriginCity>MONROE</OriginCity>
<OriginState>WA</OriginState>
<DestinationZIP>97862</DestinationZIP>
<DestinationCity>MILTON FREEWATER</DestinationCity>
<DestinationState>OR</DestinationState>
<Date>16-Jan-2008</Date>
<Time>6:59PM</Time>
<Commitment><CommitmentName>2 Days</CommitmentName>
<CommitmentTime>
</CommitmentTime>
<CommitmentSequence>A0201</CommitmentSequence>
</Commitment>
</ExpressMailCommitmentResponse>

<?xml version="1.0"?>
<PriorityMailResponse><OriginZip>982</OriginZip><DestinationZip>978</DestinationZip><Days>2</Days></PriorityMailResponse>

<?xml version="1.0"?>
<StandardBResponse><OriginZip>982</OriginZip><DestinationZip>978</DestinationZip><Days>2</Days></StandardBResponse>

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: Re: Re: Re: Re: Re: Re: USPS Shipping quote Bugs

The Quotes are right for me just the delivery times are not. If I put in a address down the street from me it still says 2 day express or 2 day express to 90210 in CA. The Post office is 2 miles from my house.

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: Re: Re: Re: Re: Re: Re: Re: USPS Shipping quote Bugs

seedseller: Looks like your getting 2 days transit time for Express, Priority and Parcel. Oops

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: Re: Re: Re: Re: Re: Re: Re: Re: USPS Shipping quote Bugs

One more thing I noticed: Sorry

<Commitment>
<CommitmentName>2 Days</CommitmentName>
<CommitmentTime>
</CommitmentTime>
<CommitmentSequence>A0201</CommitmentSequence>
</Commitment>

Tell me if I'm wrong but shouldn't there be an option for the Express commitment time

<CommitmentTime>
<---data missing here---->
</CommitmentTime>

There's nothing there for USPS to know the commitment time right?

seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
alien73, The origin and

alien73,

The origin and destination are close enough that any service takes about 2 days. I have not quoted for a longer distance. I was wondering about the missing data as well.

I hope to get to the bottom of this SOON.

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: alien73,

Match what your seeing in Ubercart to what USPS website is saying. See attachment. I used the same zip code for ship from and ship to. TR: It's 10:55 and says overnight to most areas not 2 days

I still stand by my bug theory :>)

AttachmentSize
usps_website_rates.png 52.28 KB
seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
Re: Re: alien73,

I just went to the USPS server and asked for the quotes again for the same zip codes. All shipping methods except Express mail are 2 days except for express mail where there is a link saying overnight to most areas. So I clicked on the link for and went through the commitment section and was told two day delivery if I took it to the PO tomorrow.

As I type, I am uploading beta 1 rev 748. Some work was done in these areas. I'll report back later on my testing.

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: Re: alien73,

Another small bug I'm noticing in IE 7 is when you fetch a shipping quote it doesn't show in the Order total preview until you left click the pane. It works fine in FireFox.

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: Re: Re: alien73,

The point is I don't want to insult my clients customers with shipping transit times saying 2 days with Express,Priority and Parcel Post.. This is why the costs goes up from Parcel so you get it quicker.

seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
Re: Re: Re: alien73,

Beta 1 rev 748 doesn't change anything on this problem.

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Re: Re: Re: alien73,

seedseller: Try it with one of the standard Drupal themes. Since shipping quotes use AJAX, it's maybe possible that your theme might not have the markup that jQuery expects, so it doesn't know where to insert the shipping quote on the page?

With build 748 you should now be able to see the request sent to the USPS server as well as the response. Since you're getting a valid response (as shown by your debug), you must have sent a valid request, but it will confirm that you're using the version of the module that you think you're using...

I guess there's nothing left to do but start inserting print statement to see where things break down. In uc_usps.module, find the function uc_usps_quote and insert "drupal_set_message(var_export($services, true));" right before the "return" statement. You should see a raw dump of an array containing elements for the USPS shipping methods you have enabled and the prices etc. for each of these methods. If you see that, the problem isn't in uc_usps.module. Then we will have to delve into uc_quote and the JavaScript that does the AJAX call...

What brand and version of browser are you using? Can you post a URL so I can see the results of requesting a quote on your site?

<tr>.
Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: Re: Re: alien73,

The quote builds its own markup outside of the theme system, so there shouldn't be any conflicts from the site's theme.

I think I'll make it optional to include the turnaround time. I can see why you might not want to tell people, because customers always expect the slightest suggestions to be contracts etched in stone.

That error message is straight from the USPS server. I've always been kind of worried that error messages from web services will be too cryptic or unhelpful to the customer. Maybe at some point I'll make a decent error handling system for these kinds of quote methods. Until then (which will probably be in 2.0), a workflow-ng condition sounds like a good idea.

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: Re: Re: Re: Re: Re: alien73,

Thanks Lyle

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
alien73 wrote:Another small
alien73 wrote:

Another small bug I'm noticing in IE 7 is when you fetch a shipping quote it doesn't show in the Order total preview until you left click the pane. It works fine in FireFox.

TR:
Have you seen this possible bug above?

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Re: alien73,

It's only a bug if Ubercart displays something other than what is in the reply from the USPS server. If the USPS says 2 days, then that's the answer.

From the perspective of customer relations, I agree it might be better to not present the transit times. For several reasons. First, if your customer gets guaranteed 1-day or 2-day, that obligates you to get the package out the door before the cutoff time. That might not be possible, especially if you've already had your pickup for the day! Second, as you've noted, different methods might have the same transit time, so the quoted time can be a little deceptive. (There are other reasons to choose Express though, like the tracking number and signature confirmation). It's easy enough to comment the transit times out and hardwire in an estimated transit time for each service. It probably would be better if the module had a checkbox which you could use to turn off the transit time quote.

I'm approaching this from the perspective of someone who had no hand in writing the uc_usps module. I've personally shipped almost 10,000 packages via USPS over the past 6 years - mostly Priority Mail but a large number of First Class, Parcel Post, and Express as well. From my point of view, seedseller's quote times of 2 days for Express, Priority, and Parcel between Monroe, WA and Milton Freewater, OR, seem perfectly reasonable. (I'm in WA too, and do a lot of business in OR, so I'm familiar with the transit times.) I often advise my customers in Oregon not to bother paying the extra for Priority or Express because it's not going to get there any faster. So from that perspective, it HELPS the customer , and they really APPRECIATE it, if they can avoid spending the money for Express and still get it in 2 days!

Perhaps the behavior of the shipping quotes is easier to understand when you read the USPS web services documentation: Express Mail is the *only* service USPS offers that has any sort of guaranteed delivery time. All other services are just *estimates*. To quote the web services docs, what they return in an XML request is:

Priority Mail®
"You get an average delivery standard for two- or three-day service."

Package Services
"Provides estimates on delivery between 3-digit ZIP Codes for Parcel Post, Bound Printed Matter, Library Mail and Media Mail."

Express Mail Service Commitments
"Receive our guaranteed commitment between any two 5-digit ZIP Code™ for Express Mail®."

<CommitmentTime> is returned empty from the USPS server - nothing Ubercart can do about that. I assume that's because USPS doesn't guarantee it by any specific hour.

Also, it appears that the USPS web site doesn't use the same quotes as the XML interface (I've known this for a while.) The only information on the USPS web site that is completely accurate is the Express Mail commitments you find by clicking through on the "overnight to most areas" link - clicking through gets you to a page where you enter more information and get the actual time which should agree with what Ubercart gets from an XML request. The times for Priority Mail and Parcel Post are average transit times, and don't take into account the hour of the day that you're getting the quote - they will return the same transit time whether you quote at 8am or 8pm. USPS only spends the extra CPU cycles to give you an accurate number for Express because they have a money back guarantee for that service.

What would you change about Ubercart, given that Ubercart is just reporting back what the USPS server says?

<tr>.
alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
TR: Priority mail is "1" day

TR:

Priority mail is "1" day and Express is "2"...Funny.. This is the kind of transit time bugs that I'm getting...

It's not a biggy really...

I will rework it for my clients taste. Everything must work 100% as it's a full time gig :>)

seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
tr, I agree with the things

tr,

I agree with the things you are saying. I haven't had the experience with as many USPS transactions as you, but it is over 2000 in the last 3 years.

If Ubercart is simply telling us what the response from the USPS server, I can't ask more. What I do expect from Ubercart is the correct shipping charges as it comes from the USPS server plus the appropriate markup. For my site, the Parcel Post quote is obviously wrong. I think this is a bug.

The idea of a checkbox to turn off transit times is a good one. It would also be nice to be able to enter my own comments beside each shipping type selected. This could include suggested transit times, to discourage nearby customers from spending too much on shipping, or whatever else I might wish.

Another idea is the option to have a bit higher markup to ship via express mail. If I have to bust my butt to get something out to a customer outside my regular shipping cycle, it would be nice to have them pay for a bit of butt repair.

I'm working to go to a server with PHP5. I hope that cares for the simplexml errors. I don't imagine it will fix the incorrect parcel post quotes.

seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
Re: tr,

I first tried the garland theme and then the pushbutton them. Nothing different.

I also did see the request going to the USPS server. It looked OK.

I am using firefox 2.0.0.11 as my primary browser. However, I also test with IE 7. But I haven't tried that in a week or so. Will try it early tomorrow.

I hope to be able to do some serious testing tomorrow.

Thanks!!

alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: tr, I agree with the things

Here's another simple thing that could be confusing for customers. If a order is over 70 LBS with USPS a warning message will show.

Warning - The package weight cannot exceed 70 pounds.

You should have at least 2 shipping methods so this doesn't happen. I added the weight rate and UPS. If a customer buys 2 drum sets for example that almost 100LBS. I added check total weight in workflow_ng.

The warning probably show say:

Sorry the max package weight for USPS is 70 LBS, please select another shipping method... etc..
a usps image would also help.

So by saying:

Warning - The package weight cannot exceed 70 pounds might make the customer think that there order can't be shipped.

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Re: Re: Re: Re: Re: Re: USPS Shipping quote Bugs

You're in Monroe? How about I just drive out tomorrow and help you with it? Seriously. That would be a lot faster and easier than going back and forth over e-mail. Monroe is only 30 minutes from me and I'm out there all the time! Contact me by private message if you want to arrange something. That output looks reasonable, and helps a lot in narrowing down the problem. You're sending a properly formed request and getting the right quote back from the server, it's just not displaying for some reason. I think we can deal with that...

<tr>.
seedseller's picture
Offline
Joined: 11/27/2007
Juice: 141
Re: Re: Re: Re: Re: Re: Re: Re: USPS Shipping quote Bugs

Thanks TR, I'm not in Monroe--my client is there.

I DO appreciate the offer.

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
seedseller wrote:Thanks TR,
seedseller wrote:

Thanks TR, I'm not in Monroe--my client is there.
I DO appreciate the offer.

Oh well, it was worth a shot. Lots of great places to hike out that way - I'll take any excuse I can to head out there Smiling

<tr>.
TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
alien73 wrote:How about
alien73 wrote:

How about transit times.. I'm seeing Express Mail is 2 days when it always 1 Day or overnight. I believe there is a bug with Parcel and Express getting mixed up.

Given the timestamp of your post, that's almost certainly due to the fact that the quote was requested after the last pickup - so the Express Mail can't go out until tomorrow, and won't arrive until the day after that. Hence 2 days. The response from the USPS server shows the timestamp and takes the time (adjusted for the timezone of the mailing ZIP code even!) into account.

If you turn on the debug, you will see the result coming back from the USPS server says 2 days - there is no mix up on the Ubercart end.

BTW, you will need to upgrade to Beta 2 to do this because the debug info was messed up in Beta 1.

<tr>.
alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: alien73 wrote:How about

Express Mail service commitments are based on drop-off times. Normally 12:00 afternoon or I think the lastest is 3:00 p.m. I made the post a little before 9:00 tonight.

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: Re: alien73 wrote:How about

Yes, that's my point! Ubercart sends a quote request to the USPS server - the USPS server returns a transit time commitment based on the time the QUOTE is made. So USPS assumes you will drop off the package at the time you make the quote. So, if you get a quote at 9pm on 16 Jan, the USPS server will tell you it can't be delivered until 18 Jan. That is 2 days!

If you made the quote at 11am on 16 Jan, then the USPS server would tell you 1 day. Try this tomorrow morning!

<tr>.
alien73's picture
Offline
Bug Finder
Joined: 11/10/2007
Juice: 450
Re: Re: Re: alien73 wrote:How about

Understood, but it also says Priority is 2 days the same as Express "Not right". I'm in DE "ship from address" and and I put a CA delivery address. No way it takes 2 days Priority when it's 3000 miles away.

2 days Priority - $10.55
Express 2 Days - $24.50

Coleslaw's picture
Offline
Joined: 06/30/2009
Juice: 2
Re: USPS Shipping quote Bugs

I'm re-opening this thread since it appears to be the same issue I have on one of my client's sites. However I have some new information to add.

Details:
PHP 4.3.9
Drupal 5.12
Ubercart 5.x-1.7

I get incorrect rates only part of the time and it's erratic. There appears to be no pattern that I can find for some to be wrong and others to be right.

I updated Ubercart to the latest version. No change - still random incorrect rates.

The XML parse errors occur all the time.

When I configure UPS, the UPS shipping rates do not show up on the checkout page.

I duplicated the website on a PHP5 server and the above problems seem to have been solved. The problem is I don't have the option of moving the client to a new server, so this needs to work on the original PHP4 server it currently resides on.

Does anyone have a fix or a workaround for this problem with shipping quotes on PHP4?

Let me know if there's any more details required.

Thanks.

torgosPizza's picture
Offline
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.
Joined: 08/14/2007
Juice: 4110
Re: Re: USPS Shipping quote Bugs

Can you explain what you mean by you "don't have the option" to move them to PHP5? PHP4 is really old, and even the minor version you are using is old by PHP4 standards (4.4.2 I think, was the last version of PHP4). If your host is unwilling to upgrade your site, they're not a very good host and you should switch regardless. Migrating a Drupal site is pretty easy, and you can do it in a few hours.

That being said, I'm not aware of any workarounds, potentially using the simplexml backport that's in the module? At least, I thought it was there. I believe Lyle can shed some light on this solution...

--
Help directly fund development: Donate via PayPal!

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: USPS Shipping quote Bugs

I guess the first thing to figure out is why you have XML parse errors. I can think of a few ways that could happen, but they involve not filling out correct or enough information. Turn on the debugging info in the shipping quote settings, and maybe also Firebug. Look through the results of the shipping quote to see what the specific errors are.