BoxPacker icon indicating copy to clipboard operation
BoxPacker copied to clipboard

Request for Information on Streamlining Product Packing

Open mumairdeveloper opened this issue 2 years ago • 17 comments

Hello,

Thank you for providing this source class. I am using it for packing large pallets and small boxes. Please let me know if there is a way to pack all the products into a single box. I understand that I may have multiple products and multiple boxes, but I would like to select a single box type and, if necessary, repeat the quantity for this box due to having multiple products.

Thank you

mumairdeveloper avatar Sep 09 '23 06:09 mumairdeveloper

If you wish to only use a single type of box even if multiple of that box are required, then you'll need to make multiple invocations to the library with a single box type each time

dvdoug avatar Sep 17 '23 17:09 dvdoug

Hi,

I comprehend the method of making multiple calls to the library, each time using a single box type. I have one final question: Are there any options or flags available to pack items in multiple small boxes, or to efficiently pack small items into the fewest large boxes possible?

Thank you

mumairdeveloper avatar Nov 04 '23 05:11 mumairdeveloper

Hi,

I'd like to pack the products in the smallest box possible. It's not an issue if the packing is done in one large suitable box.

Thank you.

mumairdeveloper avatar Nov 04 '23 06:11 mumairdeveloper

By default, BoxPacker will use the smallest number of boxes. You can change this however if you want

https://boxpacker.io/en/stable/sortation.html#choosing-between-permutations

dvdoug avatar Nov 05 '23 18:11 dvdoug

Hi,

Apologies for reiterating, but I need to clarify my request. I'm looking for a method to consolidate all items into a single box, even if multiple items or boxes are involved. I prefer that all items be packed into a best-fit single box. If this isn't feasible and there's no option for a best-fit single box, please provide an error or an empty response.

Thank You

mumairdeveloper avatar Nov 06 '23 17:11 mumairdeveloper

Hi dvdoug,

I appreciate your assistance with my previous inquiries. I'm seeking guidance on a method to pack all items into a single box, even if there are multiple items or boxes involved. Your help on this matter is highly valuable.

Thank you.

mumairdeveloper avatar Nov 11 '23 03:11 mumairdeveloper

Something like this (untested)

$packedBoxes = $packer->pack();

if ($packedBoxes->count() === 1) {
  return $packedBoxes; // only 1 box, is best fit
} else {
  $possibleSingleBoxSolutions = [];
  foreach ($packedBoxes as $packedBox) {
    $singleBoxPacker = new Packer();
    $singleBoxPacker->addBox($packedBox->getBox());
    $singleBoxPacker->setItems($itemList);
    $possibleSingleBoxSolutions[] = $packer->pack();
  }

  // your logic here to decide which one to use
  $chosenSingleBoxSolution = $possibleSingleBoxSolutions[0];

  return $chosenSingleBoxSolution;
}

dvdoug avatar Nov 12 '23 18:11 dvdoug

Hi,

Thank you so much for your response. I already have this code. I was wondering if you have set any flag for this type of functionality in the API. Okay, if I am going to use the same code, do you agree that it will pack the smallest best-fit single box, even if there are larger boxes also listed? That is the last thing.

Thank you.

mumairdeveloper avatar Nov 12 '23 18:11 mumairdeveloper

Yes, in the scenario where all items fit into a 1 box, ->pack() will return the smallest possible such box

dvdoug avatar Nov 12 '23 19:11 dvdoug

Hi,

You are correct; perhaps that solution won't work. I have another solution: if I sort the list of boxes in ascending order and then check each box one by one from smallest to largest. Could you provide me with an example of this?

Thank you

mumairdeveloper avatar Nov 13 '23 07:11 mumairdeveloper

You are correct; perhaps that solution won't work I'm not sure what you mean, I agreed with you

dvdoug avatar Nov 19 '23 15:11 dvdoug

Hello,

Sorry for the confusion. I have multiple types of boxes in my array, including medium, random, large, etc. However, they are arranged randomly in the array. I want to sort them all from small to medium and then large. I want to sort them in ascending order based on their size. Thank you.

mumairdeveloper avatar Nov 19 '23 17:11 mumairdeveloper

That will be automatic, see https://github.com/dvdoug/BoxPacker/blob/3.x/src/DefaultBoxSorter.php for the precise implementation

dvdoug avatar Nov 20 '23 21:11 dvdoug

Hi Doug,

I hope this message finds you well. I have been actively exploring solutions to address my current challenges. Unfortunately, the previously suggested solutions have not proven effective in resolving the issue.

I'd like to propose a new idea: the implementation of a virtual box feature. The concept involves passing multiple items, each with its respective quantity, weight, and dimensions. Unlike the previous approach, I would not include a list of boxes in the request. Instead, I'm wondering if your library could generate a single virtual box. This virtual box would consolidate all the specified items, allowing me to obtain shipping rates more efficiently. The ultimate goal is to identify the most cost-effective rates by consolidating all items into a single box.

I'm eager to hear your thoughts on this proposed virtual box solution and would greatly appreciate any insights or solutions you can provide.

Thank you for your continued assistance.

mumairdeveloper avatar Dec 02 '23 05:12 mumairdeveloper

See https://github.com/dvdoug/BoxPacker/issues/189

dvdoug avatar Dec 02 '23 11:12 dvdoug

Doug,

So, there is no solution yet in your library related to this? Perhaps you have added a solution similar to lojadev5 in issue #211 in your library. Please confirm.

I am using those things for shipping rates.

Thank you

mumairdeveloper avatar Dec 02 '23 16:12 mumairdeveloper

No, virtual boxes is complicated for all of the reasons listed in that ticket, there is no built-in support for that at this time

dvdoug avatar Dec 04 '23 19:12 dvdoug