我试图根据IP查找设置货币。
到目前为止,我只找到了这个php代码片段来设置货币http://ravikumar85.blogspot.ie/2010/02/magento-set-base-currency-through-code.html
但是如果我把这段代码放在index.php中Mage::run()
if($geolookup == 'UK') {
Mage::app()->getStore()->setCurrentCurrencyCode('GBP');
}
我得到这个错误
There has been an error processing your request
Mage registry key "controller" already exists
任何想法?
由于
我不确定您希望进行自定义修改的原因。无论如何,通过添加以下代码修改app/code/core/Mage/core/Model/Store.php将为您提供解决方案。
public function getCurrentCurrencyCode()
{
if($geolookup == 'UK') {
$this->_getSession()->setCurrencyCode('GBP');
}
......
}