Magento 上基于国家/地区名称的主题系统
任何人都知道为不同国家的人民展示不同主题的技巧。
例如,如果我的商店在美国加载,我想显示 us_mystore 主题和在印度查看的同一商店,那么我想显示 myindia 主题。我怎样才能做到这一点。
请给我一个想法
Anybody knows the trick to show different themeing for different country peoples.
For example if my store is loaded in US i want to show the us_mystore theme and the same store viewed in India then i would like to show myindia theme. How can i achieve this.
Please suggest me a idea
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将为每个国家/语言提供一个“商店视图”,然后根据 IP 地址或“Accept-Language”HTTP 标头选择要使用的视图。这可以通过模块编程或从 .htaccess 设置存储代码来实现。
示例:从 .htaccess 检测语言
根据 apache 手册,你可以这样做。它的优点是可以使用客户在浏览器中设置的首选项,即使他们身在国外。
通过 IP 地址确定国家/地区不太准确,并且需要更多维护,因为 IP 地址范围会随着时间的推移而变化。
I would have a "Store View" for each country/language then chose which view to use based on IP address or "Accept-Language" HTTP header. This is possible both programmatically with a module or by setting a store code from .htaccess.
Example: Detecting language from .htaccess
Based on the apache manual you could do something like this. It has the benefit of using the customer's preference set in their browser even when they're physically outside their country.
Determining country by IP address is less accurate and needs more maintenance as IP address ranges change over time.