我有Magento多语言商店,我需要将商店代码添加到网址。在此路径中System > Configuration > Web > Url Option > Add Store Code to Urls
我转向ON
,然后我在url中看到site.com/en(默认),site.com/br(brazillian)。
如何删除默认site.com/en中的EN并获取默认商店site.com而不使用EN路径?
答案 0 :(得分:4)
我在GitHub上提供了一个新扩展,允许您从URL隐藏默认商店代码。
此处提供更多信息:https://github.com/jreinke/magento-hide-default-store-code
答案 1 :(得分:1)
默认情况下,magento只允许您为整个设置更改此配置选项,您无法逐个更改它。
您可以更新magento,以允许您为每个网站指定此选项的不同设置,以便您执行所需操作:
应用/代码/核心/法师/核心的/ etc /的system.xml 强>
<use_store translate="label">
<label>Add Store Code to Urls</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<backend_model>adminhtml/system_config_backend_store</backend_model>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>0</show_in_website>
<show_in_store>0</show_in_store>
</use_store>
注意,您不应该直接更改此文件,而是在您自己的模块中覆盖它。你可以找到很多教程来帮助覆盖核心magento配置和文件。
如果您更新了范围设置:
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
这样您就可以在管理部分为每个网站/商店前台更改“将商店代码添加到网址”。
现在,您可以尝试为默认商店设置“将商店代码添加到网址”=“否” 和“将商店代码添加到网址”=其他人的是。
请注意我没有测试过这个,所以我不会在实体店里这样做:)
答案 2 :(得分:1)
我有另一种解决方案也很有效。
将app/code/core/Mage/Catalog/Block/Widget/Link.php
复制到app/code/local/Mage/Catalog/Block/Widget/Link.php
搜索(Magento 1.7.x中的第91行/ Magento 1.9.x中的第100行)
$ this-&gt; _href = $ this-&gt; _href。 $符号。 “___ store =”。 $ store-&GT;引用代码();
并修改为
$ this-&gt; _href = $ this-&gt; _href;
上传并保存您的更改,您现在不会为您的小部件(动态)插入链接添加?___ store = default。
信用:DesignHaven