Magento Tips for formattingĀ decimal point

September 17, 2010 § 4 Comments

If you ever want to display front-end store with some modification of precision point.

You could copy

app>code>core>Mage>core>modal>Store.php to

app>code>local>Mage>core>modal , create files if need.

Then openĀ app>code>local>Mage>core>modal>Store.php ,

go to function formatPrice
public function formatPrice($price, $includeContainer = true)
{
// return $price;
if ($this->getCurrentCurrency()) {
return $this->getCurrentCurrency()->format($price, array(), $includeContainer);
}
return $price;
}

You can see there is an array pass into the function format, adding following parameter will do.

array(‘precision’=>0) will make all decimal point go away. ;]

For the Admin side , there are quite a number of article to cover it.

Go to lib>Zend>Currency find
protected $_options = array(
‘position’ => self::STANDARD,
‘script’ => null,
‘format’ => null,
‘display’ => self::NO_SYMBOL,
‘precision’ => 0,
‘name’ => null,
‘currency’ => null,
‘symbol’ => null
);

modify the precision to 0 and there you go!

Where Am I?

You are currently browsing entries tagged with decimal point at Nick Wan L.K..