-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request for Information on Streamlining Product Packing #558
Comments
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 |
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 |
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. |
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 |
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 |
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. |
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;
} |
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. |
Yes, in the scenario where all items fit into a 1 box, |
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 |
|
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. |
That will be automatic, see https://github.com/dvdoug/BoxPacker/blob/3.x/src/DefaultBoxSorter.php for the precise implementation |
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. |
See #189 |
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 |
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 |
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
The text was updated successfully, but these errors were encountered: