Tuesday, 30 April 2013

How to remove decimal from price in magento


Hello Magento Developer,

To change the price from $100.00 to $100 for example.
For this, you need to edit code/core/Mage/Directory/Model/Currency.php
  • Open code/core/Mage/Directory/Model/Currency.php
  • Find the following :-
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
{
return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
}
on line no 195

change this code to:-
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
{
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);
}

0 – Denotes the digit after decimal point in price..
Now Clear the cache properly.
For Clear the Cache.
- Go to System –> Cache Management
- Refreh Cache.

No comments:

Post a Comment