根据货币链接到Magento网站



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

我需要Google AdWords,如果我以AdWords为目标,我需要我的网站来显示欧元。如果我是针对英国的。

该网站是在Magento开发的,我在页面顶部有一个选择框,可以改变整个网站的货币。

我能做到这一点的任何想法,网站是www.funkychristmasjumpers.com

在Magento论坛上的此链接

您可以随时将以下代码添加到主题中的/template/directory/currency.phtml文件的顶部。我已经在1.7.0.2实例中对此进行了测试,并且效果很好。

您只需在URL的末尾添加CY =代码,因此对于www.funkychristmasjumpers.com,它将是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;
        }
    }
}

最新更新