2026 Executive BenchmarkMid-Market Enterprise Modernization: How leaders across unify Commerce, Odoo ERP & AI in 90 days.
MAGENTO COMMERCE

Get currency rates for a multiple currencies in magento

you can get currency rate by using below code : Mage::getModel(directory/currency); I have try for get currency rates for a multiple currencies in magento a site. First: get allowe...

Akshar Group Technologies
Dec 25, 2020
1 min read
Verified Source

you can get currency rate by using below code :

Mage::getModel(directory/currency); I have try for get currency rates for a multiple currencies in magento a site. First: get allowed currency for a store

php
$currencyModel = Mage::getModel(directory/currency);
$currencies = $currencyModel->getConfigAllowCurrencies();
get base currency for a store
php
$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
$defaultCurrencies = $currencyModel->getConfigBaseCurrencies();
Then fetch currency code rate and complete code is
php
$currencyModel = Mage::getModel('directory/currency');
$currencies = $currencyModel->getConfigAllowCurrencies();
$baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
$defaultCurrencies = $currencyModel->getConfigBaseCurrencies();

$rates=$currencyModel->getCurrencyRates($defaultCurrencies, $currencies);
foreach($rates[$baseCurrencyCode] as $key=>$value ) {
echo $key."-";
echo $value;
echo "";
}
Displaying different currencies for a single product If get different currencies for a product and want of product price difference rate then just multiply rate
php
$rate*$proPrice;
Magento currency rates is managed from admin, so to admin > system >Manage Currency >Rates and managed currency symbol from admin > system >Manage Currency >Symbols If want to add multiple currency then goto admin > system > GENERAL > Currency setup> Allowed Currencies
Share this playbook
LET'S BUILD WHAT'S NEXT

What's Holding Your Business Back?

Tell us where you want to go, what's getting in the way, and we'll help you figure out the technology to get there.

No sales pitch. Confidential strategic advisory.