Jump to content

?impossible? dimensions of multiple boxes packed into as tight a box as possible


Eman

Recommended Posts

I am building my own shopping-cart/ecommerce website from the ground up.

But I'm really stuck with the problem of calculating postage.

It is easy enough to do it if I only have one product to calculate postage for, but what about If I have 10 products of all different shapes and sizes and quantities, and I need to calculate the postage?

This is my logic: I'm trying to write a php function that will take the first product's dimensions  and set that as the parcel width/height/length. And Then loop to the second product, and php will check if the second product is higher or shorter than the first product and then somehow add the dimensions to the parcel, and also calculate excess dimensions.... and rotate the product dimensions to fit in a parcel size...

I think I'm confusing myself :confused: . but in reality some php script that, given multiple boxes with varying dimensions, it will pack them into as small a parcel as possible, so that I can then calculate the postage costs. Oh, and if there are lots of products and the parcel is too large, it will need to split the parcel into one or more parcels.

I love math, but this one has me stuck!! I've been pulling my hair out over this for a while!

 

Thanks for any help

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.