How do I change the currency symbol in Magento 1.5

2019-04-16 06:22发布

问题:

I'm trying to change the price format in Magento ver. 1.5.1.0 from €8.49 to EUR 8.49

I have been looking through lots of posts and forums but it didn't work out. I tried to follow the instructions but it didn't work out so far. Cache is deactivated.

/lib/Zend/Locale/Data/en.xml
<currency type="EUR">
 <displayName>Euro</displayName>
 <displayName count="one">euro</displayName>
 <displayName count="other">euros</displayName>
 //added <symbol>EUR</symbol> here
</currency>

/lib/Zend/Locale/Data/root.xml
<currency type="EUR">
  <symbol>€</symbol> => changed to <symbol>EUR</symbol> didn't work
</currency>

And no, i don't want to change the core /Zend files or use str_replace.

Thanks for your help!

回答1:

Try to grep in your version root and you'll see that it is locale based so you just might need to change t in multiple files.

grep 'type="EUR"' . -rsn

don't forget to clear cache afterwards before observing the changes in front-end

rm -rf var/cache/* 


回答2:

  1. You can use free extension Currency Manager

  2. Or you can write your own simple module and override function format() in Mage_Directory_Model_Currency model.

    public function formatTxt($price, $options=array())
    {
        $options['display'] = Zend_Currency::USE_SHORTNAME;
        return parent::formatTxt($price, $options);
    }
    

P.S. You can loose your changes in /lib/Zend/Locale/Data/*.xml files after Magento upgrade.