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

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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