Hello,

Seems that there is an error with USPS international shipping quotes in case there is one heavy and one light product in the cart (for example 20lb and 0.5lb).
Separately both products have proper shipping quotes.

It is the same for test products as well.

Any suggestions on this?

Thanks

Comments

longwave’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

What do you mean by "there is an error"? An error message, or the calculation is incorrect? Can you give a better example of the problem?

Ivanhoe123’s picture

Sorry, just now saw the post

I will explain this in details:
1. One light product - correct shipping method appears (let's say $10)
2. One heavy product - correct shipping method as well (let's say $40)
3. One light + one heavy - I get all correct heavy quotes but first is always the quote for light product only ($10)

The error is that the module (or USPS?) returns shipping cost for light product, even though there is heavy + light product inside.

Let me know if this helps

Thanks!

longwave’s picture

Assigned: Unassigned » tr
Status: Postponed (maintainer needs more info) » Active

Assigning to TR, as he knows far more about USPS than I do.

tr’s picture

Yes, what you describe is a fundamental flaw in the quoting and packaging algorithm used by the USPS and UPS modules. That code is structured wrong and is so messy already that patching it to fix this issue makes it unreadable and unmaintainable, to the point that I wouldn't be able to say whether it was even doing the right thing. I have a patch that I wrote to fix this a while back that I will try to find and post here, but I don't want to put that into the module because I believe that just takes us farther away from the right thing and because I don't want to support the resulting mess. I am in the process of re-architecting the whole packaging process in Ubercart, but it's been slow going because I don't have a lot of time to devote to it.

Summary of why this happens:

  • Code loops over all packages.
  • Code gets all available shipping methods for each package and stores them in an array, keyed by the shipping method.
  • Arrays for each package are merged to create one array with selections for the entire order. This works if all packages share every key.
  • However, not all packages can ship by every method - some can be sent as envelopes, some must be large packages, etc, so not every array has the same set of keys.
  • Result is that some of the selections presented to the customer may show a cost based on only 1 or some of the packages, rather than all the packages in the order.

A fix would be, instead of the straight merge, merge only when all the packages in the order contribute to the cost. That requires extra bookkeeping in the code, and does not always work because it assumes that there *is* a common method that can be used by all packages. Another fix is to present combinations to the customer when the packages have to ship by different methods. That will always work, unlike the previous fix, but is a lot more complicated - how do you present "1 package by First Class Mail, 1 package by Priority Mail, 1 package by Express Mail" and *all* the other possible permutations to the customer so that he/she can make a choice? You would probably have to only present general categories based on time: 3-5 day, 2-day, overnight, and show each category choice only if all the packages can be delivered in that time frame or faster. This would be a fundamental change in how things are done, and would require a bit of work.

WesleyTx’s picture

Any progress on this? I know this has to be a difficult system to update, but even a temporary solution would be fantastic.

Thanks!

tr’s picture

Version: 6.x-2.6 » 8.x-4.x-dev
Issue summary: View changes