PrestaSharp icon indicating copy to clipboard operation
PrestaSharp copied to clipboard

Property ecotax is not valid (or any decimal field)

Open ak293700 opened this issue 3 years ago • 2 comments

Library Version:

1.2.9

NuGet Package Url:

https://www.nuget.org/packages/PrestaSharp/1.2.9

Prestashop version:

1.7.6.9

Describe the Bug:

When I update a product decimal field, as ecotax or price, the request fail. I discovered via postman that the problem is because the serializer as a too big precision, when I shorten the fields it works perfectly (still 4 or 5 decimal precision). Am I the only one having the problem ? And if not how do you solved this please.

To Reproduce:

  1. var product = productFactory.Get(id)
  2. var dbProduct = ... ; // whatever you get your data
  3. product.ecotax = dbProduct.Ecotax;
  4. productFactory.Update(product)

It works if I set: product.ecotax = 0m. But doesn't work when 0m is from a variable.

A clear description of what you expected to happen.

ak293700 avatar Dec 29 '22 13:12 ak293700

Using Decimal.Truncate solved my problem. However I am still interesting in a clean fix.

ak293700 avatar Dec 29 '22 13:12 ak293700

Hi @ak293700

Sorry for the big delay It this bug only present with ecotax or also with price ?

LameuleFR avatar Nov 12 '23 16:11 LameuleFR