简体   繁体   English

magento中的多种货币

[英]multi currency in magento

I have website in magento.I set multiple currency in it.One is US dollar(default) and another is Japanese Yen. 我在magento有一个网站,在其中设置了多种货币,一种是美元(默认),另一种是日元。 using these steps 使用这些步骤

setup multiple currency shop in Magento:- 在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. 请帮忙。

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);
?>

在此处输入图片说明在此处输入图片说明

You can edit your price.phtml and add another currency to show, 您可以修改price.phtml并添加另一种货币来显示,

round( Mage::helper('directory')->currencyConvert( $amount, $_fromCurr, $_toCurr ), 2 )

You would have to update for Incl and excl tax calculations as well. 您还必须更新含税和不含税的计算。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM