calculatordimensionlogistics

Is there an easy way to calculate the required carton for an order with products?


For my order-system I need to determe which carton I need based on the order.

For example:

Order A has 3 items:

Order B has 2 items:

Available cartons have inner-dimensions:

Also calculate 0,5cm margin for each product/size So ProductA will be 15,5x10,5x5,5cm and ProductB will be 20,5x10,5x5,5cm

Everybody will see now that we need CartonC for OrderA and CartonB will be enough for OrderB.

But how should we calculate this the fastest? I know I can calculate the volume (LxWxH), but that will not always work. $volumeA = $widthA*$heightA*lengthA;

Also just sum up all the sizes will not work:

$width = $widthA+$widthB; // return 36cm

while we can put them next to each other instead of behind each other.

Anybody an idea? Google showed only online calculators. But I need a solution that gives me instant the right carton-type.

Thanks in advance!

$availableCarton = array("cartonA"=>array("length"=>20,"height"=>10,"width"=>10),"cartonB"=>array("length"=>20,"height"=>20,"width"=>10),"cartonC"=>array("length"=>30,"height"=>20,"width"=>15));
foreach($products as $product){
    //do some maths here
}
echo $neededCarton;

Solution

  • I already found a solution: boxpacker.io

    Boxpacker even shows us how item are positioned in the box.