in reply to Seeking advice about Shipping and Product Purchases

From a database structure point of view, it is best to have another table with the dimensions, weights, ...

However that doesn't solve your problem if you want to combine different products into one package.

What you are asking is solving a three dimensional puzzle. If you want to do it exactly it will be quite difficult, although there is probably some mathematical algorithm that will just do so.

A few quick checks however will allow you to approximate the box:

Such a quick check will probably already eliminate a number of boxes. Then add a suitable "safety margin" and take the smallest box that still remains. That will probably be OK for 90% or so of all cases.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

  • Comment on Re: Seeking advice about Shipping and Product Purchases