How Convert USD to INR ( base currency) in magento?. I tried to below code , but not working.

Mage::helper('directory')->currencyConvert($amt, 'USD', 'INR'); 

But its work on Mage::helper('directory')->currencyConvert($amt, 'INR', 'USD');

  • this price in inr
    – Amit Bera
    Commented Sep 3, 2014 at 10:32
  • No, Price in USD. i need to current currency (USD) to Base currency ( INR )
    – Rat
    Commented Sep 3, 2014 at 10:34
  • clear cache.....
    – Amit Bera
    Commented Sep 3, 2014 at 10:39
  • is this price 1000 in USD?
    – Amit Bera
    Commented Sep 3, 2014 at 10:40
  • yes , USD Price
    – Rat
    Commented Sep 3, 2014 at 10:42

2 Answers 2


You cannot convert one price currency price to base currency.

because magento did not calculate base currency rate from other current rate.

Magento define a price in BASE currency which will convert using rate for other currency

Magento is calculate other price from base Currency

Please got see Mage_Directory_Model_Currency class on function

 public function convert($price, $toCurrency=null)
        if (is_null($toCurrency)) {
            return $price;
        elseif ($rate = $this->getRate($toCurrency)) {
            return $price*$rate;

        throw new Exception(Mage::helper('directory')->__('Undefined rate from "%s-%s".', $this->getCode(), $toCurrency->getCode()));

Here show that you can not get base currency from other currency

That means that you code format is

Mage::helper('directory')->currencyConvert($amt, 'baseCurrecy', 'your currency');

revise it not possible using this function

Mage::helper('directory')->currencyConvert($amt, 'your currency', 'baseCurrecy');

  • Is it possible any other way to convert?
    – Rat
    Commented Sep 3, 2014 at 10:58

It is not possible to convert a price from current currency to base currency using Mage::helper('directory')->currencyConvert($amt, 'USD', 'INR') method because Magento doesn't find the row with "currentCurrency"=>"baseCurrency" relation in the directory_currency_rate table.

To solve this issue you can simply do a division of the price by "baseCurrency"=>"currentCurrency" rate.

How could you get "baseCurrency"=>"currentCurrency" rate and solve your issue? In this way:

// the price
// Base Currency ('INR')
$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
// Current Currency ('USD')
$currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();

// Allowed currencies
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
$rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));
// the price converted
$amt= $amt/$rates[$currentCurrencyCode];
  • 1
    Thanks Wapone for the solution! Commented Apr 26, 2022 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.