Magento 1.9 – How to Remove .00 Decimal from Shopping Cart & Invoice

currencymagento-1.9shopping-cart

I am building an ecommerce website named bookslab.in.

I want to remove the .00 decimals from the all products prices that i am adding in the shopping cart & in Invoice generated.

I am using the ET currency manager, it removes the prices decimals of all the products except the shopping cat products & Invoice

Is there any way to remove the decimals from the shopping cart products & from Invoices & to convert the main price without decimals. I want my grand total without the decimals.

My store currency in **Indian Rupees.

I am attaching the screenshot. Do i require any changes.

enter image description here

Best Answer

In order to change price precision in magento you would need to overwrite some core files.

In the example below we are changing precision to 0.

1) Overwrite lib/Zend/Currency.php and change precision around line:

 protected $_options = array(
     'position'  => self::STANDARD,
     'script'    => null,
     'format'    => null,
     'display'   => self::NO_SYMBOL,
     'precision' => 0,    /*CHANGE*/
     'name'      => null,
     'currency'  => null,
     'symbol'    => null,
     'locale'    => null,
     'value'     => 0,
     'service'   => null,
     'tag'       => 'Zend_Locale'
 );

2) overwrite app/code/core/Mage/Core/Model/Store.php and change roundPrice function:

public function roundPrice($price)
{    
    return round($price, 0);
}

3) overwrite app/code/core/Mage/Directory/Model/Currency.php and change format function:

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

4)\app\code\local\Mage\Sales\Model\Order.php line 1358:

public function formatPrice($price, $addBrackets = false)
{
    return $this->formatPricePrecision($price, 0, $addBrackets);
}