У меня есть веб-сайт в magento.I установить несколько валют в нем. Один доллар США (по умолчанию), а другой - японская иена. используя эти шаги
настроить несколько магазинов валюты в 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.
На странице со списком товаров я вижу раскрывающийся список выбора валюты в левой боковой панели наверху. Но я хочу отобразить несколько цен для продукта в японской йене, а другой - в долларах США. Пожалуйста помоги.
Добавьте этот код, где вы хотите отображать цену продукта с несколькими продуктами.
<?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);
?>
Вы можете отредактировать свой price.phtml и добавить другую валюту для показа,
round( Mage::helper('directory')->currencyConvert( $amount, $_fromCurr, $_toCurr ), 2 )
Вам также нужно будет обновить калькуляцию Incl и excl tax.