Convert price from current currency to base currency and vice-versa

Tweet, share & co

tweet fb share g+ share

Tags


Description

Convert price from current currency to base currency and vice-versa

Code

$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
$currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
$price = 150;

// convert price from current currency to base currency
$priceOne = Mage::helper('directory')->currencyConvert($price, $currentCurrencyCode, $baseCurrencyCode); 

// convert price from base currency to current currency
$priceTwo = Mage::helper('directory')->currencyConvert($price, $baseCurrencyCode, $currentCurrencyCode);

Comments