如何在magento中添加制造商在产品的URL中?
我如何更改 magento 以便:
{site}/category-name/sub-category/product-name
变成
{site}/category-name/sub-category/manufacturer/product-name
标准 Magento 制造商属性在哪里?
谢谢 :)
How can I change magento so that:
{site}/category-name/sub-category/product-name
becomes
{site}/category-name/sub-category/manufacturer/product-name
Where is the standard Magento manufacturer attribute?
Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要覆盖系统的 url 重写才能做到这一点。您可以扩展首先创建产品重写的类(它可能发生在管理站点的产品控制器中的某个位置),或者创建一个事件观察器,在保存产品后更新重写。
You would need to overwrite the system's url rewrites to do that. You could either extend the class that creates the product rewrites in the first place (it probably happens somewhere in the product controller in the admin site) or create an event observer which updates the rewrites after the product is saved.
如果您想使用它们,您将需要在管理面板中为制造商等创建任何必要的属性,但这并不能真正解决这个问题。我明白你想要做什么,但是搞乱产品 URL 的解析似乎不是一个好主意(你可能会遇到问题)。您可以将数据库中的产品网址(通常保存为“some-product-name.html”)更改为“manufacturer-name/some-product-name.html”。我看不出有什么直接原因说明这行不通,尽管允许客户自己改变可能并不是一件小事。
希望有帮助!
谢谢,
乔
You will need to create any necessary attributes for manufacturer, etc, in the admin panel if you want to use them, but that won't really solve this problem. I understand what you're looking to do, but messing with the parsing of product URLs doesn't seem like a great idea (you're likely to run into problems). You could probably change the product url in the database (usually saved as 'some-product-name.html') to something along the lines of 'manufacturer-name/some-product-name.html'. I don't see any immediate reason why that wouldn't work, though allowing the customer to change that themselves may not be trivial.
Hope that helps!
Thanks,
Joe
这是一种解决方法,但您可以创建一个制造商子类别并将产品放在其中吗?
所以:
root ->子类别->制造商子类别 ->产品
?
因为根据约瑟夫的回答,我认为你试图做的事情会有点混乱。
It is a workaround, but you could create a manufacturer subcategory and place the products in there?
So:
root -> subcategory -> manufacturer-subcategory -> product
?
Because as per Joseph's answer, I think what you're attempting to do would be a little messy.