Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property ecotax is not valid (or any decimal field) #456

Open
ak293700 opened this issue Dec 29, 2022 · 2 comments
Open

Property ecotax is not valid (or any decimal field) #456

ak293700 opened this issue Dec 29, 2022 · 2 comments

Comments

@ak293700
Copy link

ak293700 commented Dec 29, 2022

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
Copy link
Author

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

@LameuleFR
Copy link
Collaborator

Hi @ak293700

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants