Tuesday, July 19, 2011

How do I use more than two decimal places for prices?

To get 4 decimals accurancy for all prices in magento.
In /lib/Zend/Currency.php line 74
'precision' => 4,
Override in app/code/locale the Mage core files and make some changes :
Mage/Core/Model/Store.php line 790
public function roundPrice($price)
    {
        return round($price, 4);
    }
Mage/Directory/Model/Currency.php line 197
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
    {
        return $this->formatPrecision($price, 4, $options, $includeContainer, $addBrackets);
    }
Hope that helps !

No comments:

Post a Comment