douhao8456 2015-02-05 12:09
浏览 17
已采纳

magento的多种货币

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.

  • 写回答

2条回答 默认 最新

  • dshu1235 2015-02-06 08:57
    关注

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

    enter image description hereenter image description here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图