zoukankan      html  css  js  c++  java
  • Magento显示多货币,Magento 多货币设置

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

  • 相关阅读:
    专注技术热爱生活
    js效果我的蒙板效果实现
    KMP算法
    九月份发现的好东东记录
    ATL SERVER
    不要把项目开发当做自己个人的展示舞台
    看ProMesh.NET项目领悟到的
    谈谈编译原理和其在WEB开发中的应用3
    开发更深层次的交流产品
    Hibernate3.3.2 手动配置annotation环境
  • 原文地址:https://www.cnblogs.com/focai/p/4781950.html
Copyright © 2011-2022 走看看