homepage Welcome to WebmasterWorld Guest from 54.147.196.159
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
UPS rating api and accuracy.?
Need to know about package sizes
digitsix

10+ Year Member



 
Msg#: 4254412 posted 10:45 pm on Jan 17, 2011 (gmt 0)

I have integrated an automated shipping calculator for a client using the rating api UPS provides. An issue is coming up where as some items are much larger is size than other items and its not necessarily relative to the weight of the items. These large package sizes are causing major differences is the rate returned for my query vs. the actual shipping cost of the package because I am not providing dimensions for the packages, only weights.

I cannot seem to find an answer on how to do this exactly so I guess I'm wondering how others are handling this issue.


Is there an oversize package indicator I can set like the residential address indicator?

Do I have to set the exact dimensions of the package I'm asking the rating for? I dont really have this information so if so:

Do I just use a generic size thats in the relative ballpark for all the "over sized" items?

Do you catalog the actual dimensions of every single item in the database that can then be formulated to get the final package dimensions of each shipment?

I'm kind of at a loss on how to really handle the exactness of what I'm calculating for the rating api vs how the items will actually be packaged and shipped.

Does anyone know of any tutorials / wiki's on this stuff?

 

rainborick

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4254412 posted 1:47 am on Jan 18, 2011 (gmt 0)

You might try my quick and dirty fix until you get a proper solution installed. I only use USPS for shipping, and I do my own shipping cost calculations. When USPS started to add a "dimensional rate", I simply added a pound to the tare weight of oversized products and absorbed any unrecovered costs. If you don't use tare weights, you could set the weight on oversized products to a negative value as a flag indicating the situation.

My impression is that both UPS and the USPS are looking at the dimensions of a package both in terms of the maximum measurement and the total volume, with absolute limits and a threshold that determines when an additional charge is required. My little home business sells toys, trinkets, paper ephemera, and artwork - framed and unframed. I've always felt that the biggest headache in this regard isn't so much in tracking the sizes of the individual products as it is in calculating the size of the box required to ship multiple items. My instinct is that the best solution is to select the appropriately-sized box from a list of boxes that you use regularly, and pass its dimensions to the API involved. Someday I'm going to write that code, I'm sure. I'm just not looking forward to it; hence the kludge noted above.

digitsix

10+ Year Member



 
Msg#: 4254412 posted 2:14 am on Jan 18, 2011 (gmt 0)

Yeah... its just that my problem is basically exponential on yours because my software runs commerce sites for a bunch of different businesses that have thousands of products ranging from super tiny and light items to really large items that are both light and heavy.

I like to believe that if I had the dimensions of all the items in the store, in their "retail packaging" there is some formula that exists out there that would be able to calculate the best way to package the order with X number of available shipping box sizes...

The only problem is that my math skills are no where near what they need to be in order to come up with something like that. Its probably already been done though - Which is what I would like to find.

I do know that such a formula would have to not work solely by volume because as we all know from playing tetris, different things fit better it certain places facing certain directions which allow you to get "full rows" (TETRIS!). The function would literally have to play a virtual game of tetris to get the right answer...

rainborick

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4254412 posted 8:32 pm on Jan 18, 2011 (gmt 0)

I'm with you on programming the box selection code. I have some vague ideas, but they're mostly brute force methods of allocating space from a matrix of cubic inches over and over in different combinations and psuedo-rotating the dimensions of the items and....

Yeah, I'm gonna have to hope there's a code example out there somewhere. I take enough aspirin as it is.

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4254412 posted 6:20 pm on Jan 19, 2011 (gmt 0)

Yeah you're going to get lots of oversize estimates if you don't pass over dimensions.

The simplest way: quantify your shipping, that is, assign specific package sizes to all your shipments and select from them prior to posting to the API. For a limited number of products all fitting into a limited number of packages, this works for many sites.

A trick from NewEgg: they just send out multiple packages, period. I don't think I've ever gotten multiple items in a single package from them. This, of course, is not practical if the typical order is more than 3 or 4 items.

Another complication,

thousands of products ranging from super tiny and light items to really large items

Isn't the least expensive UPS a $7.50 envelope? First class mail is what, 50 cents? Consider what the consumer is thinking. You need both API's in this case.

I do know that such a formula would have to not work solely by volume because as we all know from playing tetris, different things fit better it certain places facing certain directions which allow you to get "full rows" (TETRIS!).


You have it exactly correct and that's an awesome way to put it, but in Tetris, the third dimension, height, and the fourth, weight, are not factors and they are here. :-)

I've done this, and it's not a formula and highly specialized, took me three months to sort it out (and still requires tweaking every time the ^%&%^&% API's make some change.) Somewhere you have to store maximum dimensions so you don't go into oversize boxes, a method of "laying in" items into boxes, then creating multiple box shipments when the max weight OR max dimensions are reached, allowance for box weight and package padding, then assemble it all to pass over to the API and return a list of the possible selections to the user. What a mouthful, huh?

More details here [webmasterworld.com] that may be useful on this one.

digitsix

10+ Year Member



 
Msg#: 4254412 posted 6:10 pm on Jan 20, 2011 (gmt 0)

@ The .50c first class mail envelope, do they do any type of delivery confirmation with that? I believe that would be a requirement for shipping purchased goods.

...

If the total weight of all items is < max_weight_of_bx and total volume of all times < max_volume_of_box, then is it a safe assumption that all items will fit and be able tho ship in said box provide that no H, W, or L of any item packaging is greater than the H, W, or L of the box in question?

digitsix

10+ Year Member



 
Msg#: 4254412 posted 6:17 pm on Jan 20, 2011 (gmt 0)

Wow my typing went out the window on that one! lol... here is the English version:

If the total weight of all the items to be shipped is less than maximum weight allowed for the shipment box, and the total volume of all the items in the order is less than the maximum volume allowed for the shipment box, AND none of the items in the order's length is greater than the boxes L/W OR H, AND none of the items in the orders width is greater than the boxes L/W OR H, AND none of the items in the orders height is greater than the boxes L/W OR H.

Notice the use of AND & OR where applicable.

Can I get a confirmation on this formula? Any math majors out there? Because if this will be 90% accurate, I think I have a winner.

rainborick

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4254412 posted 1:17 am on Jan 21, 2011 (gmt 0)

Yesterday, while procrastinating about some work that I should be doing even now, I started to research this topic and even started a fragment of code. There's actually a good deal of information out there, but the stuff I found seemed to be mostly theoretical.

I think you're on the right track with your approach. It's the sort of thing that you'll know you're getting close as soon as you run a few tests.

I have a new idea of my own that I might play with tonight since it seems my cable box has gone into a funk.

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4254412 posted 5:39 pm on Jan 21, 2011 (gmt 0)

[duplicate post, delete]

[edited by: rocknbil at 5:41 pm (utc) on Jan 21, 2011]

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4254412 posted 5:40 pm on Jan 21, 2011 (gmt 0)

The .50c first class mail envelope, do they do any type of delivery confirmation with that? I believe that would be a requirement for shipping purchased goods.


It's not a requirement, it's an option. We let the users decide by displaying all available options for the parcel (see previous link.)

If the total weight of all the items to be shipped is less than maximum weight allowed for the shipment box, and the total volume of all the items in the order is less than the maximum volume allowed for the shipment box, AND none of the items in the order's length is greater than the boxes L/W OR H, AND none of the items in the orders width is greater than the boxes L/W OR H, AND none of the items in the orders height is greater than the boxes L/W OR H.


Some things fall apart with this. There will be conditions where all of those are true, but see your tetris comparison - these items many not "fit together" as you expect. That's why I went with the "laying in" approach.

You start by arranging the boxes from longest to shortest, allowing the w and h to apply as variables. This determines the longest box you will need.

Then you begin adding widths, keeping track of the tallest height. If the next box length is short enough to fit behind the previous one, you don't add to the box width, like

---- first item -------
- second item - - third item -

When the box width is reached/exceeded, you go to the next layer.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved