News:

Support the VirtueMart project and become a member

Main Menu

decimals in backend for final price

Started by miamia, April 03, 2013, 23:09:59 PM

Previous topic - Next topic

miamia

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?

TheBobFactor

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
var priceTax = Math.round(priceTaxReal * 100) / 100

Good luck
Cheers
TheBobFactor

Running Virtuemart 2.0.20b on Joomla! 2.5.9

EsSa55

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

EsSa55

Aargh!

Switched OFF:

"Round only display"

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