Magento显示多货币,Magento 多货币设置

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

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

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

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

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

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

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

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

 

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

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

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

<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显示多货币选项如预期的实现了。

相关文章
相关标签/搜索