Reputation: 121
I have website in magento.I set multiple currency in it.One is US dollar(default) and another is Japanese Yen. using these steps
setup multiple currency shop in Magento:-
– Go to System –> Configuration –> Currency Setup
– Under ‘Currency Options‘, select Allowed currencies.
The selected currencies will be displayed in currency dropdown in category and product listing page. Remember that your Base currency and Default display currency selection should also be selected in Allowed currencies.
– Click ‘Save Config‘ button.
– Go to System –> Manage Currency Rates
– Select Import Service. By default it is ‘Webservicex’.
– Click ‘Import‘ button. This will update the currency rates values.
– Click ‘Save Currency Rates‘ button.
At product listing page i see currency selection dropdown list in left sidebar at top. But i want to display multiple price for a product one in Japanese Yen and another in US dollar. Please Help.
Upvotes: 0
Views: 1353
Reputation: 5211
Add this code where u want to display product multicurrencies product price.
<?php
//remember the current currency
$currentCurrency = Mage::app()->getStore()->getCurrentCurrencyCode();
//remember the current currency object
$currentCurrencyObject = Mage::app()->getStore()->getCurrentCurrency();
//get allowed currencies
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
foreach ($allowedCurrencies as $currency) {
//skip the current currency
if ($currency != $currentCurrency) {
//load the currency object
$currObject = Mage::getModel('directory/currency')->load($currency);
//change the store currency
Mage::app()->getStore()->setCurrentCurrencyCode($currency);
Mage::app()->getStore()->setCurrentCurrency($currObject);
//show the price in the new currency
echo $this->getPriceHtml($_product, true, '-clone-'.$currency);
}
}
//reset the store currency
Mage::app()->getStore()->setCurrentCurrencyCode($currentCurrency);
Mage::app()->getStore()->setCurrentCurrency($currentCurrencyObject);
?>
Upvotes: 2
Reputation: 1191
You can edit your price.phtml and add another currency to show,
round( Mage::helper('directory')->currencyConvert( $amount, $_fromCurr, $_toCurr ), 2 )
You would have to update for Incl and excl tax calculations as well.
Upvotes: 1