且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Magento:从外部获取类别的相对URL

更新时间:2023-11-30 13:59:22

我认为您可以通过使用系统>配置>网络

I think you can achieve all of your requirements by playing with the settings in system > configuration > web

我要尝试的第一件事是将基本url(如果需要的话,安全和不安全)设置为/(正斜杠),然后进行系统>缓存管理>重建目录url重写

First thing I'd try is setting base url (secure and unsecure if needed) to / (forward slash), and then going system > cache management > rebuild catalog url rewrites.

如果这不起作用,请尝试进行设置,然后打赌您可以开始使用它。请注意,它将使magento在google base feed中放置相对URL等=不好!因此,请不要在生产环境中使用它。

If that doesn't work, play around with the settings, bet you can get it to work. Be warned though, it will make magento put relative urls in google base feeds etc = bad! So don't do it in production.

我的开发副本正在使用中,从这里开始是不可能的,所以不能为您尝试。

My dev copy is at work, inacessible from here, so can't try for you.

另外,对于上述脚本,您可以尝试:

Also, for your script above, you could try:

$url = "/shop/" . $_category->getUrlKey() . '.html';

(您可能不需要最后的html位,具体取决于您的配置)

(you may not need the html bit at the end, depends on your config)