2012-10-31 74 views
1

基本上我需要链接到我的网站,但我需要货币根据使用的链接进行更改。根据货币链接到magento网站

我需要谷歌adwords这个,如果我在adwords瞄准爱尔兰,我需要我的网站来显示欧元。如果我的目标是英国,我需要它以磅为单位显示等等。

该网站是在magento开发的,我在页面顶部有一个选择框,用于更改整个网站的货币。

任何想法如何,我可以做到这一点,该网站是每此链接www.funkychristmasjumpers.com

回答

1

信用的Magento forums

你总是可以将下面的代码位添加到您的/模板/目录的顶部/在您的主题currency.phtml文件。我已经在1.7.0.2实例中测试了它,它很好地工作。

您只需将cy = code添加到URL的末尾,因此对于www.funkychristmasjumpers.com,默认为USD将为http://www.funkychristmasjumpers.com?cy=USD。代码应用货币,然后重定向回目标页面

$currentCurrency = $this->getCurrentCurrencyCode(); 

if(!isset($currentCurrency)) $currentCurrency = 'NA'; 

$currencies = array("GBP","USD","EUR"); 

if(isset($_GET['cy'])) 
{ 
    if (in_array(strtoupper($_GET['cy']),$currencies)) { 
     if(strtoupper($_GET['cy']) != $currentCurrency) 
     { 
      header("Location: ".$this->helper('directory/url')->getSwitchCurrencyUrl()."currency/".$_GET['cy']); 
      exit; 
     } 
    } 
}