Magento更改产品网址 [英] Magento Change Product URL

查看:55
本文介绍了Magento更改产品网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以修改或添加商品网址?我们正在一个大型网站(500个Iproduct)上工作,我认为将它们全部放在"根目录中变得很混乱.我想组织得更好一些,在这种情况下,将 products/放在产品密钥之前的url中.

Is there a way to modify or prepend the product url? We are working on a large website (500 Iproducts), and I think it becomes quite cluttered to have them all "in" the root directory. I would like to organize things a bit better, in this case, putting products/ in the url before the product key.

作为将"products/"添加到url键中的最干净,最好的方法,您会推荐什么?我想看看这里是否有任何建议,然后再卷起袖子,着手进行一些替代.我尝试将URL密钥设置为该值,但是自然地,它会为-剥离/.我认为那会发生.

What would you recommend as the cleanest and best way to prepend "products/" into the url key? I wanted to see if there were any suggestions here before I rolled my sleeves up and got working on some overrides. I have tried setting the URL key to be that, but, naturally, it strips the / for a -. I figured that would happen.

推荐答案

要实现这一点将非常棘手.产品的URL以及按类别的产品在索引系统的深处生成.当您将产品或类别保存为场景时,重新索引会开始,其中包括生成许多 core/url_rewrite 模型的任务,这些模型存储在 core_url_rewrite 表中.这些模型构成了"SEO友好" URL.因此,您需要找到该代码,并在其中添加自定义逻辑以生成正确的重写模型

That's going to be tricky to pull off. The URLs for products, as well as products-by-categories are generated somewhere deep in the indexing system. When you save a product or category being the scenes, the re-indexing that kicks off includes tasks that generate a number of core/url_rewrite models, stored in the core_url_rewrite table. These models are what make the "SEO Friendly" urls. So you'd need to find that code, and add your custom logic there to generate the correct rewrite models

然后,您需要检查URL帮助器,以确保它们生成正确的URL.我不确定这些方法是否查询重写表(这会很好),或者它们是否预知了Magento的URL的结构).

Then you'd need to check the URL helpers to ensure they were generating the correct URLs. I'm not sure if these methods consult the rewrite table (which would be good), or if they act with foreknowledge abou how Magento's URLs would be structured).

祝你好运.

这篇关于Magento更改产品网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆