Magento多货币缓存问题
我们正在Magento整合国际结帐。客户可以看到当地货币的产品。但问题是货币被缓存了。例如:如果有人从印度浏览,该页面将以印度卢比显示。如果有人从我们这里浏览相同的页面,它应该以美元显示。但由于缓存,它将显示在INR中。我知道这可以通过缓存孔冲孔来修复。你能告诉我们需要在哪个街区打孔吗。如果您能在这方面指导我,我将不胜感激。您将需要一个GeoIp模块 在这里可以找到一个很好的资源: 首先,您必须安装GitHub模块: 然后您必须在系统配置->常规->国家/地区选项下同步IP数据库 从那时起,您需要使用以下帮助器创建自己的模块:Magento多货币缓存问题,magento,Magento,我们正在Magento整合国际结帐。客户可以看到当地货币的产品。但问题是货币被缓存了。例如:如果有人从印度浏览,该页面将以印度卢比显示。如果有人从我们这里浏览相同的页面,它应该以美元显示。但由于缓存,它将显示在INR中。我知道这可以通过缓存孔冲孔来修复。你能告诉我们需要在哪个街区打孔吗。如果您能在这方面指导我,我将不胜感激。您将需要一个GeoIp模块 在这里可以找到一个很好的资源: 首先,您必须安装GitHub模块: 然后您必须在系统配置->常规->国家/地区选项下同步IP数据库 从那时起,您需
/* app/code/local/Atwix/Ipstoreswitcher/Helper/Data.php */
class Atwix_Ipstoreswitcher_Helper_Data extends Mage_Core_Helper_Abstract
{
const DEFAULT_STORE = 'English';
/**
* countries to store relation
* default is English
* @var array
*/
protected $_countryToStore = array(
'US' => 'sv2',
'IN' => 'sv1'
);
/**
* get store view name by country
* @param $country
* @return bool
*/
public function getStoreByCountry($country)
{
if (isset($this->_countryToStore[$country])) {
return $this->_countryToStore[$country];
}
return self::DEFAULT_STORE;
}
}
然后,您需要观察controller\u action\u postdipatch
事件以重定向您的客户:
<?xml version="1.0"?>
<!--app/code/local/Atwix/Ipstoreswitcher/etc/config.xml-->
<config>
...
<global>
...
</global>
<frontend>
<events>
<controller_action_postdispatch>
<observers>
<atwix_ipstoreswitcher>
<class>atwix_ipstoreswitcher/observer</class>
<method>controllerActionPostdispatch</method>
</atwix_ipstoreswitcher>
</observers>
</controller_action_postdispatch>
</events>
</frontend>
</config>
根据您的要求更改门店名称。您需要一个GeoIp模块 在这里可以找到一个很好的资源: 首先,您必须安装GitHub模块: 然后您必须在系统配置->常规->国家/地区选项下同步IP数据库 从那时起,您需要使用以下帮助器创建自己的模块:
/* app/code/local/Atwix/Ipstoreswitcher/Helper/Data.php */
class Atwix_Ipstoreswitcher_Helper_Data extends Mage_Core_Helper_Abstract
{
const DEFAULT_STORE = 'English';
/**
* countries to store relation
* default is English
* @var array
*/
protected $_countryToStore = array(
'US' => 'sv2',
'IN' => 'sv1'
);
/**
* get store view name by country
* @param $country
* @return bool
*/
public function getStoreByCountry($country)
{
if (isset($this->_countryToStore[$country])) {
return $this->_countryToStore[$country];
}
return self::DEFAULT_STORE;
}
}
然后,您需要观察controller\u action\u postdipatch
事件以重定向您的客户:
<?xml version="1.0"?>
<!--app/code/local/Atwix/Ipstoreswitcher/etc/config.xml-->
<config>
...
<global>
...
</global>
<frontend>
<events>
<controller_action_postdispatch>
<observers>
<atwix_ipstoreswitcher>
<class>atwix_ipstoreswitcher/observer</class>
<method>controllerActionPostdispatch</method>
</atwix_ipstoreswitcher>
</observers>
</controller_action_postdispatch>
</events>
</frontend>
</config>
根据您的要求更改店铺名称。谢谢您的详细回复。我们只有一家店铺,但提供选择客户所在国家/地区和价格的选项将以当地货币显示。如果您不想使用不同的语言,您可以为一个国家/地区创建多个店铺视图,并且可以为每个店铺视图使用不同的价格和货币。@Rajeevan您找到解决方案了吗,如果是,请接受答案。谢谢您的详细回复。我们只有一家店铺,但提供选择客户所在国家/地区和价格的选项将以当地货币显示。如果您不想使用不同的语言,您可以为一个国家/地区创建多个店铺视图,并且可以为每个店铺视图使用不同的价格和货币。@Rajeevan您找到解决方案了吗,如果是,请接受答案。您是否已修复此问题?我也有同样的问题。你把这个修好了吗?我也有同样的问题。