coreshop / CoreShop

CoreShop - Pimcore enhanced eCommerce
http://www.coreshop.org
Other
276 stars 157 forks source link

Gift Product with Tracked Stock: ceil(): Argument #1 ($num) must be of type int|float, null given #2589

Closed solverat closed 7 months ago

solverat commented 7 months ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

image

Setting the default unit quantity happens here in gift product action https://github.com/coreshop/CoreShop/blob/445201ae696420fdf149d297ca38a969e400e27e/src/CoreShop/Component/Core/Cart/Rule/Action/GiftProductActionProcessor.php#L78-L84

and I guess it should be similar to this: https://github.com/coreshop/CoreShop/blob/445201ae696420fdf149d297ca38a969e400e27e/src/CoreShop/Component/Core/Order/Modifier/CartItemQuantityModifier.php#L51-L55

solverat commented 7 months ago

Setting $item->setDefaultUnitQuantity(1); outside the if-clause should be enough.

It is still wrong, but in the gift product action, we don't know which unit definition to choose.

dpfaffenbauer commented 7 months ago

the unit should be choosen in the price rule action, right?

dpfaffenbauer commented 7 months ago

but for now, as a fix we can use the default unit.

solverat commented 7 months ago

@dpfaffenbauer Of course, that would be premium. :) If a product has multiple unit definitions, the action should show them in a dropdown. This would allow us to set $item->setUnitDefinition and $item->setDefaultUnitQuantity definitely correct.

Maybe second prio.