Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在magento中对货币选择事件执行操作?_Magento - Fatal编程技术网

如何在magento中对货币选择事件执行操作?

如何在magento中对货币选择事件执行操作?,magento,Magento,我在标题中有一个货币选择选项,如果用户选择美元,我想显示一条消息。我不知道如何解读这个事件。 我对magento相当陌生,任何帮助都将不胜感激 谢谢。更改文件magento\app\code\core\Mage\Directory\controllers\CurrencyController.php 功能变化 public function switchAction() { if ($curency = (string) $this->getReq

我在标题中有一个货币选择选项,如果用户选择美元,我想显示一条消息。我不知道如何解读这个事件。 我对magento相当陌生,任何帮助都将不胜感激


谢谢。

更改文件
magento\app\code\core\Mage\Directory\controllers\CurrencyController.php

功能变化

 public function switchAction()
        {
            if ($curency = (string) $this->getRequest()->getParam('currency')) {

             // add message   
             if($curency=="USD")
                Mage::getSingleton('core/session')->addSuccess("your message"); 

                Mage::app()->getStore()->setCurrentCurrencyCode($curency);
            }
            $this->_redirectReferer(Mage::getBaseUrl());
        }

谢谢。你救了我的命:-)你能帮我再问一个问题吗。我的网站根据地理位置(通过IP地址)自动以货币显示产品价格。我需要为美国客户禁用美元价格,并将英镑作为英国和美国客户的默认货币。