PHP Classes
elePHPant
Icontem

Minimum dimensions of shipping box: Identify smallest possible dimensions of a box used for shipping

Recommend this page to a friend!
  All requests RSS feed  >  Minimum dimensions of shipping box  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Minimum dimensions of shipping box

A request is featured when there is no good recommended package on the site when it is posted. Edit

by Paul Birkhead - 3 years ago (2016-04-14)

Identify smallest possible dimensions of a box used for shipping

This request is clear and relevant.
This request is not clear or is not relevant.

+2

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 Clarification request
  • 1. by Mohammad Keramatifar - 3 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 - 3 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.

Ask clarification

1 Recommendation

Bin packing: Implementation of one dimensional bin packing

This recommendation solves the problem.
This recommendation does not solve the problem.

+1

by Manuel Lemos Reputation 17740 - 3 years ago (2016-04-15) Comment

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.

  • 2 Comments
  • 1. by Paul Birkhead - 3 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 - 3 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.


Recommend package
: 
: