VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: miamia on April 03, 2013, 23:09:59 PM

Title: decimals in backend for final price
Post by: miamia on April 03, 2013, 23:09:59 PM
Hi guys,

I need to show two decimal digits for prices in admin area of VM. (for frontend I set two digits and it rounds ok but when I order huge amount of one product there are significant differences in total rounded price), e.g.:
cost price in backend is 36.21, so final price (with 7% VAT) shoud be 38,75.- but VM saves value 38,7499. I need to save rounded two digit value 38,75.- How to do this?
Title: Re: decimals in backend for final price
Post by: TheBobFactor on May 01, 2013, 05:24:38 AM
Hi Miamia
Not sure if you have found an answer yet.
I'm not sure if you can change the settings in the front end
It sounds like you need a maths function rather than display formatting

The code in this post may give you a hint of what you may need to do under the hood.
http://forum.virtuemart.net/index.php?topic=114859.msg386882#msg386882 (http://forum.virtuemart.net/index.php?topic=114859.msg386882#msg386882)
var priceTax = Math.round(priceTaxReal * 100) / 100

Good luck
Title: Re: decimals in backend for final price
Post by: EsSa55 on October 13, 2019, 12:02:52 PM
Yes, an old question but I have exactly the same requirement.

I have tried the script directed to but cannot see it working.

Price example:

Base price:        259.99

Discount:          5.0002%

Final Price:        246.98998

Override Price : 246.99


The actual discount is 5.00% but I have extended it due to roundings when the final price is converted to other currencies

Generally, the fudge works but for some exchange rates there is still a 0.01 price difference between Final & Override Prices.

Hence the requirement for Final Price to be rounded to 2 decimal places would avoid such differences.

TIA
Title: Re: decimals in backend for final price
Post by: EsSa55 on October 13, 2019, 12:37:34 PM
Aargh!

Switched OFF:

"Round only display"

in Price Configuration and Final Price is now rounded, as required