VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: borro on May 30, 2014, 10:40:13 AM

Title: How to remove nonsignificant zeroes in product prices in Virtuemart frontend?
Post by: borro on May 30, 2014, 10:40:13 AM
Hello

I need to remove nonsignificant zeroes(decimal places, the figures after decimal point) in currency displaying at frontend.
I made the hack in \administrator\components\com_virtuemart\helpers\currencydisplay.php
I removed this code:
$res = number_format((float)$nb,(int)$nbDecimal,$this->_decimal,$this->_thousands);
with this one:
$res = (string)$nb;

Is my decision correct?
Tested in VM 2.6.1
Title: Re: How to remove nonsignificant zeroes in product prices in Virtuemart frontend?
Post by: Maxim Pishnyak on June 15, 2014, 22:25:11 PM
You could use preg_replace in your template overrides and your fix will be able to resist next VM update. No hack, please.