System - Configuration - Currency Setup 在右边Currency Options里的Allowed currencies勾选,

然后 System - Manage Currency Rates 点击Import自动设置汇率或者自己手动输入,然后保存。

(像Magento安装IPS支付通道就需要先设置人民币CNY的汇率)

如此Magento后台设置多货币的处理就OK了。

<?php if($this->getCurrencyCount()>1): ?>
        <div id="currency_html" style="display:none">
        <?php foreach ($this->getCurrencies() as $_code => $_name): ?>
            <input type="radio" name="currency_radio" id="currency_radio" onclick="changeCurrency('<?php echo $_code ?>')" value="<?php echo $_code ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> checked <?php endif; ?>>
                <?php echo $_code ?>
        <?php endforeach; ?>
       </div>
<script type="text/javascript">
//<![CDATA[
function changeCurrency(sObject){
    if(sObject){
        setLocation('<?php echo $this->helper('directory/url')->getSwitchCurrencyUrl() ?>currency/'+sObject);
    }
}
//]]>
document.getElementById('currency_display').innerHTML=document.getElementById('currency_html').innerHTML;
</script>
<?php endif; ?>

Magento前台自定义显示多货币选项 :

假定用的主题是:app/design/frontend/base/default/ 这个,

修改模板文件template/directory/currency.phtml 这个改为以上内容:


然后在头部位置:template/page/html/header.phtml 挑个位置加入以下内容:

<div id="currency_display" ></div>

接着修改布局文件,要加的内容(代号A)都是:

<block type="directory/currency" name="right_currency" before="-" template="directory/currency.phtml"/>

首页显示多货币选项 更改default/layout/cms.xml ,在<cms_page translate="label">这个位置里的<reference name="content">里面加上代号A。

目录页和商品详细页面显示多货币选项 ,default/layout/catalog.xml 这个文件里的<default><reference name="left">里加入代号A。

后台清空Cache。

重新刷新访问,Magento显示多货币选项如预期的实现了。

posted on 2015-09-04 16:48  闪电王国  阅读(1066)  评论(0编辑  收藏  举报