If in some case you want to convert the price to base corrency in Magento then there is a very simple function available ‘currencyConvert()’ but this function is NOT WORKING in magento community 1.7 version.
<?php $from = 'USD'; $to = 'NPR'; $price = 10; $newPrice = Mage::helper('directory')->currencyConvert($price, $from, $to); ?>
I tried another way to solve this. You can use the below working code to get the price in base currency.
<?php // Convert price to base currency from current currency $totals = Mage::getSingleton('checkout/cart')->getQuote()->getTotals(); $subtotal = $totals["subtotal"]->getValue(); // Base Currency $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode(); // Current Currency $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode(); if( $baseCurrencyCode != $currentCurrencyCode ){ // Allowed currencies $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies(); $rates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies)); $convertedSubtotal = $subtotal / $rates[$currentCurrencyCode]; }else{ $convertedSubtotal = $subtotal; } ?>