Forum Moderators: buckworks

Message Too Old, No Replies

Multiple Item Shipping Calculations

What logic do you use?

         

rocknbil

10:47 pm on Mar 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Currently I use UPS and USPS online tools via silent post to calculate shipping. Send them a width, height, depth, shipping method, they return a price.

The problem comes in when someone orders multiple items. What I have been doing, just to get the thing rolling, was find the longest sides of the items and add the heights. This overshot a little, but worked.

I'm sure you all see what *I* saw the potential for, but never expected the outstanding success of the site in question. We're getting some LARGE orders, multiple items, and it's blowing my "calculator" out of the water. When someone orders 70 12" X 2" X 1" items, you now have a box 12" X 2" X 70" high which throws ANY calculator into oversize.

So what logic do you follow? Calc the total volume, grab the largest length and width and make the height whatever's required to equal the volume?

I have cross-posted this in the Perl forum because I'll be programming it in perl and am also interested in a programmer's point of view, but would greatly appreciate any ideas on what logic to follow for multiple-item calculations.

sun818

5:11 am on Mar 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It sounds like you have to calculate by unit dimensions rather than by box dimensions. I know my distributor has two dimensions - one for the unit itself, and another for the master box. By default, the master box ships separately. If a master box is qty 50 and you order qty 51, two boxes would be shipped: one master box, and another box for the single item.

If you're shipping Oversized boxes, I thought UPS just charges you a higher shipping weight. So, a 10 lbs package Oversized, automatically defaults to 35 lbs. You just charge your customer the 35 lbs rate?

sharbel

6:33 am on Mar 26, 2006 (gmt 0)

10+ Year Member



I agree.. you need to have some per-unit designation. When calculating shipping, you should iterate through each item in the cart and handle each per-unit shipping value to determine what the final ship rate should be.

I know on one project, we setup a property for the Product Object.. it was almost a 'score' of sorts. The component would iterate through each cart item and tally the values to determine what kind of shipping dimensions would be required. It was fairly complex to setup, but the client reported it was very very accurate. (shipping was dimension sesitive rather than weight).

If you are just worried about weight, it should be easy enough to iterate (loop) through each cart object and tally up the weight...

sja65

11:56 am on Mar 26, 2006 (gmt 0)

10+ Year Member



Here is a quick little routine that works out pretty well. It is not perfect when you have a lot of odd sizes, but it matches pretty well to what my employess really pack.

Pack 70 at 12x2x1
Start with your first unit (12 x 2 x 1)
1) Order the dimensions from biggest to smallest (already done) call this the total dimension
2) Loop through for each unit to be added (in this case 12x2x1)
3) Take the biggest dimension from the total dim and the biggest dim from the unit (in this case both are 12 so use 12)
4) Do the same for the next biggest unit (in this case 2)
5) Now add the smallest units (1 + 1=2)
6) Now set total dims to these values (12x2x2)
7) Resort by biggest to smallest
8) Repeat steps 3-7 for the remaining units

So you would have
12x2x1
12x2x2
12x3x2
12x3x3
12x4x3
12x4x4
12x5x4
...

There are ways that will give you more accurate dimensions, but that implies your employees will always use the right box size.

rocknbil

7:14 pm on Mar 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



These are some excellent ideas, thank you!

I think what I'll try is a combination of these and what DrDoc mentions in the perl thread - first, get an overall volume, then **if** the quantity is more than 1 (or maybe up to 5, it seems pretty accurate as is up to 5,) take the two largest dimensions, assign this to length and width, then make the height whatever is required to fill the remaining volume. This is going to leave enough wiggle room so that it keeps us covered and doesn't overcharge the customer.

Another idea is to preset some box dimensions and store them in the database, then calculate what would fit in them. I'd like to keep away from fixed values if possible though.