Prestashop: isPrice validation error

Created on 29 Jul 2019  Â·  6Comments  Â·  Source: PrestaShop/PrestaShop

Describe the bug
The isPrice Validation method is unable to validate prices on exponential notation

To Reproduce
Steps to reproduce the behavior:

  1. Set a product price as 0.000010
  2. Try to save it
  3. Prestashop answer with product price is not valid

The problem is where php choose to show the number on exponential notation. I know it happens with this price, but it can happen with anyother prices showing on this notation.

1.7.5.2 1.7.6.0 BO Bug Products Taxes and Prices To Do Trivial

All 6 comments

Hi @Daniel-Informax,

Thanks for your report.
I manage to reproduce the issue with, PS1.7.6.0 & 1.7.6.x branch & PS1.7.5.2 version.
image
But when I try with another price like 1.000010, it is well saved.

I know it happens with this price, but it can happen with any other prices showing on this notation.

Could you please provide an example?

Thanks!

For example, any other pice below 0.0001

@Daniel-Informax, I think in this case, it is normal behavior.
Thanks!

I know this is the php normal behavior, but i dont think this is the normal prestashop validation rule behavior.
Are you telling me, i cannot have a product with any of this prices?
So if i have a product with a price of 0.00009€, what can i do?, except overriding the Validation class method isPrice to fix it?

@Daniel-Informax, thanks for this clarifications.
I have the same behavior as PS1.7.6.0. & PS1.7.5.2.
image

Ping @PrestaShop/prestashop-core-developers what do you think?

Thanks!

Yes, it's a problem. :sweat_smile:
Maybe don't send an int but a string, or isPrice should not check only string :thinking:

Was this page helpful?
0 / 5 - 0 ratings