Click Fraud Protection
PHP related blog, freelancer to hire!

Converting price from one to another in magento

I found snippet here, but it seems it is broken as second parameter (target currency) is expected to be object

So correct would be

$targetCurrency = Mage::getModel('directory/currency')->load('EUR');
$price = round(Mage::helper('directory')->currencyConvert($priceToConvert, 'GBP', $targetCurrency), 2);
1 Comment
  1. Hi….

    I am getting the following error,when i am going to convert the currency price from one to another….

    Fatal error: Call to a member function getCode() on a non-object in /opt/lampp/htdocs/magento/app/code/core/Mage/Directory/Model/Currency.php on line 171

Leave a Reply