rss
twitter
    Find out what I'm doing, Follow Me :)

Monday, March 23, 2009

Pin It

Widgets

How to Change Decimal Point for Price Format

Sometime you need to play with the price format. magento default add 2 precision format for the price. now if you want to remove precision or want to keep 3 decimal point for price then you need to do following

1) Open /lib/zend/Currency.php file

2) Find 'precision' => 2 near line no. 78

here is the place, you need to change precision decimal

Change 'precision' => 0 if you want to keep 0 decimal

8 comments:

  1. Do you know how this is done in 1.4? The suggested solution doesn't seem to work there.

    ReplyDelete
  2. Same with me. Change that and tried lib/Zend/Locale/Data/es_CL.xml, but nothing. It only changes it on the backend, not on the front.

    ReplyDelete
    Replies
    1. Have you clean the Zend cache in /var directory.
      That a look at http://xme.im/format-magento-currency-or-number-base-on-locale

      Delete
  3. is there any solution in 1.4?

    ReplyDelete
  4. Found out a different simple way in magento 1.5.1

    Got to code/core/Mage/Directory/Model/Currency.php

    change line number 194.

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

    0 - Denotes the precision point for price.

    ReplyDelete
  5. Rahi Jain, great solution! This is the only one I found that has worked in my case.

    ReplyDelete
  6. Hello you looking some file .xml in src/data to edit.

    Flush cache, F5--> worked as well as for me

    ManhVT

    ReplyDelete