magento 中的多种货币
multi currency in magento
我在 magento.I 的网站上设置了多种货币 it.One 是美元(默认),另一个是日元。使用这些步骤
在 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.
在产品列表页面,我看到顶部左侧边栏中的货币选择下拉列表。但我想显示一个产品的多个价格,一个是日元,另一个是美元。
请帮助。
您可以编辑您的 price.phtml 并添加另一种货币来显示,
round( Mage::helper('directory')->currencyConvert( $amount, $_fromCurr, $_toCurr ), 2 )
您还必须更新含税和不含税计算。
在您要显示产品多货币产品价格的位置添加此代码。
<?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);
?>
我在 magento.I 的网站上设置了多种货币 it.One 是美元(默认),另一个是日元。使用这些步骤
在 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.
在产品列表页面,我看到顶部左侧边栏中的货币选择下拉列表。但我想显示一个产品的多个价格,一个是日元,另一个是美元。 请帮助。
您可以编辑您的 price.phtml 并添加另一种货币来显示,
round( Mage::helper('directory')->currencyConvert( $amount, $_fromCurr, $_toCurr ), 2 )
您还必须更新含税和不含税计算。
在您要显示产品多货币产品价格的位置添加此代码。
<?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);
?>