Home » Magento20 July 2010

Magento: How to change Currency symbol by Model Override ?

In my previous article, I had written about how you can change the currency symbol by making some change in the Zend (lib/Zend/Locale/Data/en.xml) file.

It’s easy way but the main drawback of this method is that all your changes will vanish once you upgrade Magento.

A better way will be overriding Magento model classes that are responsible for fetching the currency symbol.

This article shows how to override Magento model classes to change the currency symbol.

Scenario

I need to change the currency symbol of Nepalese Rupee (from Nrs to Rs). By default, the currency symbol for Nepalese Rupee is Nrs.

Solution

Create a new module and Override two model classes.

1) Mage_Core_Model_Locale_Currency
2) Mage_Core_Model_Locale

Config file of my module
(MyNamespace/MyModule/etc/config.xml)

MyNamespace_MyModule_Model_Locale_Currency class of my module
(MyNamespace/MyModule/Model/Locale/Currency.php)

In this class I have changed currency symbol from Nrs to Rs.

MyNamespace_MyModule_Model_Locale class of my module
(MyNamespace/MyModule/Model/Locale.php)

In this way, you can override Magento Model classes to change the currency symbol.

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed