You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For my use case I want to know which box is the best for shipping of a certain amount of business-cards, and also what the total weight is.
I create a box with the following: $packer->addBox(new TestBox('Verzenddoos bruin+klep 180x115x28mm golf', 196, 120, 31, 31, 180, 115, 28, 400));
Then I add a item of an business cards in a quantity of 1000. $packer->addItem(new TestItem('Visitekaart 85x51mm sulfaatkarton', 85, 51, 0.345, 1.3, true), 1000); // item, quantity
And then I notice these errors:
Deprecated: Implicit conversion from float 0.345 to int loses precision in D:\laragon3\www\..\vendor\dvdoug\boxpacker\tests\Test\TestItem.php on line 65
Deprecated: Implicit conversion from float 1.3 to int loses precision in D:\laragon3\www\..\vendor\dvdoug\boxpacker\tests\Test\TestItem.php on line 65
In the constructor of TestItem the properties width, $length, $depth, and $weight are integers. So that should be the cause.
Is their a plan for BoxPacker to allow floats? Or is their a other way to handle this?
Edit: I think maybe instead of using mm, maybe just use micron or microgram. A quantity of 1000 is rather slow, maybe bigger numbers makes it slower.
The text was updated successfully, but these errors were encountered:
Using ints rather than floats is on purpose, see #215 for an example of why. Having said that, I have to admit that shipping something literally as thin as a business card was not something I'd considered.
For your use case, I think multiplying the fractional mm by e.g. 10 or 100 as you already have is probably the easiest option, although (and this might not be suitable), if you only sell cards in e.g. quantities of 100, then maybe your "item" for the purposes of BoxPacker could be a stack of 100 cards, 34 or 35mm deep?
For my use case I want to know which box is the best for shipping of a certain amount of business-cards, and also what the total weight is.
I create a box with the following:
$packer->addBox(new TestBox('Verzenddoos bruin+klep 180x115x28mm golf', 196, 120, 31, 31, 180, 115, 28, 400));
Then I add a item of an business cards in a quantity of 1000.
$packer->addItem(new TestItem('Visitekaart 85x51mm sulfaatkarton', 85, 51, 0.345, 1.3, true), 1000); // item, quantity
And then I notice these errors:
In the constructor of TestItem the properties width, $length, $depth, and $weight are integers. So that should be the cause.
Is their a plan for BoxPacker to allow floats? Or is their a other way to handle this?
Edit: I think maybe instead of using mm, maybe just use micron or microgram. A quantity of 1000 is rather slow, maybe bigger numbers makes it slower.
The text was updated successfully, but these errors were encountered: