Matteo Posted December 11, 2023 Share Posted December 11, 2023 (edited) Hello to all, i'm stuck with this situation: Product price: 114,99 Discount reduction: 50% Currency precision: 2 Total amount: 57.49 Prestashop Version: 1.7.8 Now everything is "right", but we have an erp that fetch prestashop orders to create&manage our needs. Where is the problem? The problem is related to the method of round because that's our situation on erp: Product price: 114,99 Discount reduction: 50% Total amount: 114,99 / 2 = 57.495 --> rounded up to 57.5 How we can work on Prestashop to allow a situation like the erp one? I have tried with round configuration but nothing happens cause for sure the precision is the key, but i don't know how to touch it. 2° try Try to figured out with override on variable $precision in Classes/Tools.php to work with 3 decimals but nothing happens. Many thanks, Matteo Edited December 11, 2023 by Matteo (see edit history) Link to comment Share on other sites More sharing options...
Knowband Plugins Posted January 11 Share Posted January 11 Hi, If you need to round values to one decimal place, you can use the round function in PHP. This round function will round the $totalAmount to one decimal place. Feel free to use this in your code at required places. round($totalAmount, 1); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now