Magenerds / BasePrice

37 stars 38 forks source link

Fix productAmount calculation #32

Closed niclashoyer closed 6 years ago

niclashoyer commented 6 years ago

Added check for $productAmount > 0. We had an issue with the $productAmount variable being a floating point number and the check at line 151 evaluated to true and we got a warning for a division by zero.

sydekumf commented 6 years ago

Hi there, I can not reproduce it to be honest. I did this small PHP example:

<?php
$a = 0.0;
if ($a) echo 'true';

The check is correct? How can it affect your code?

niclashoyer commented 6 years ago

I just had a quick look. It seems that it actually wasn't a floating point number but a string like '0.000' which was imported via the Magento 2 CSV import. I don't know why we got a string value at that point. Maybe the import does not correctly check the value types regarding EAV.

sydekumf commented 6 years ago

https://github.com/Magenerds/BasePrice/releases/tag/1.2.3

niclashoyer commented 6 years ago

thank you :confetti_ball: