USPS Shipping quote Bugs

Posts: 60
Joined: 11/27/2007

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.

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

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>.

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

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>.

Posts: 1314
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

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.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

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

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.

--

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

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.

--

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

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

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>.

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

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.

--

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

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

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>.

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

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

--

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

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>

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

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.

--

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

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

--

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

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?

--

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

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.

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

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.png52.28 KB
--

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

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

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>.

Posts: 60
Joined: 11/27/2007

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.

Posts: 60
Joined: 11/27/2007

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

I DO appreciate the offer.

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

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.

--

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

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.

--

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

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

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

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>.

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

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>.

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

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 :>)

--

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

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?

--

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

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

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>.

Posts: 60
Joined: 11/27/2007

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.

Posts: 60
Joined: 11/27/2007

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!!

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

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.

--

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

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

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.

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

Thanks Lyle

--

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