信用的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;
}
}
}