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