Magento News

 

Configurable Product – Drop down changes decimals

by TWDesign (Posted Sun, 23 May 2010 12:01:28 GMT)
On my Magento 1.3 site I have a store view which uses zero decimals for Japanese yen currency
and two decimals for USD currency.

On a Configurable Product page, if a user selects a product attribute from the drop
down selector while using Yen,
the currency format for the price changes to two decimal places
(for Yen, obviously not desirable).

I am guessing that there is some JavaScript that controls this since there
is no page refresh, just an Ajax update OR maybe some php Class I have missed.

I’ve already changed the Store.php file and Currency.php file as follows:

Code:
lib/Zend/Currency.php file on line 78 from

'precision'=>2

    to

'precision'=>0

and

Code:
/app/code/core/Mage/Core/Model/Store.php
around line 733 from

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

to

public function formatPrice($price, $includeContainer = true)
    {
          if ($this->getCurrentCurrency()) {
            if($this->getCurrentCurrency() == "USD") {
                  return $this->getCurrentCurrency()->format($price, array('precision'=>2), $includeContainer);
            }
               else {
                  return $this->getCurrentCurrency()->format($price, array('precision'=>0), $includeContainer);
            }
          }
      return $price;
    }



http://magento-forum.co.uk/viewtopic.php?f=5&t=269#p1002

Magento Forum

Possibly Related Posts:


 

Leave a Reply