|All requests||>||Minimum dimensions of shipping box||>||Request new recommendation||>||Featured requests||>||No recommendations|
by Paul Birkhead - 6 years ago (2016-04-14)
eCommerce shopping carts contain items that are being purchased. These items have weights and dimensions.
Parcel shipping charges are often determined by the dimensions of the box used to ship the purchased products. The smaller the box, the less the charges.
I would like to be able to feed the dimensions of each item in the cart to a PHP class, and have returned to me the length, width and height of the smallest box I could use to ship the order.
The dimensions input should allow for fractional values. For example, 6.25 inches.
1. by Mohammad Keramatifar - 6 years ago (2016-05-18) Reply
you mean that: 1- we have a data table or any other collection contains all packages dimensions> 2- and we have a product dimensions data table too? 3- now we need a class that suggest which product in which package?
2. by Paul Birkhead - 5 years ago (2016-05-19) in reply to comment 1 by Mohammad Keramatifar Comment
Not quite. You do not have a data table containing package dimensions. You do have a collection of product dimensions which are those of the products that are in the shopping cart. All of the products will ship in one box. What would the dimensions of the box be if it is the smallest possible box that can be used to ship the product? If the products were pliable it would be a simple function of calculating the cubic volume and determining the dimensions of the cube. But products typically aren't pliable, so the dimensions of the box must large enough to accommodate the "real" (non-pliable) product dimensions.
There is this class that solves that problem but just for one dimension. For items with three dimensions I guess you need to adapt this solution considering that you can arrange the items in different ways. It is not a trivial problem but you may want to ask the author it ins support forum if he can help solving the problem for 3 dimensions.
There is also this class that can solve the problem but assuming all items have the same sizes and you are fitting in containers of standard sizes. Maybe you can adapt this solution for your case if your items all have the same sizes.
1. by Paul Birkhead - 6 years ago (2016-04-15) Reply
The Bin packing class was not a viable solution. The other class you provided a link to more in the right direction, but still not useable for this problem. Short comings of it were: 1) It assumes the container size in advance (we are trying to arrive at the optimal box size); 2) It assumes that none of the items can be rotated. Thank you for taking the time to make the suggestions though.
2. by Manuel Lemos - 6 years ago (2016-04-24) in reply to comment 1 by Paul Birkhead Reply
Yes, as I said your problem is more complex because packages may have arbitrary dimensions.