gpt4 book ai didi

php - 如何在 Shopware 中管理 SEO-Urls?

转载 作者:可可西里 更新时间:2023-11-01 01:15:33 25 4
gpt4 key购买 nike

似乎 Shopware 在生成 URL 时有一些“背后的魔力”,我正在寻找可以向我解释这一点的人。

This is the code标准模板生成带有变量的 SEO-url,这些变量可以在后端的 SEO-router-settings 中配置:

{* Product name *}
{block name='frontend_listing_box_article_name'}
<a href="{$sArticle.linkDetails|rewrite:$sArticle.articleName}"
class="product--title"
title="{$sArticle.articleName|escape}">
{$sArticle.articleName|truncate:50}
</a>
{/block}

SEO-router-settings 中的配置默认如下所示:

enter image description here

无论如何,输出有点不同:

http://www.DOMAIN.de/shop/CATEGORYNAME/18/PRODUCTTITLE?c=7

(所有大写字母都显示真正正确的域名、类别和产品名称,为了我客户的隐私,这些名称隐藏在这里)

这里的问题是不需要的 URL 参数“?c=7”,应该按照 SEO-router-options 中的定义将其省略。

第一个问题:如何在 URL 末尾省略这个 URL 参数“c=7”?

当我调试这段代码时,我遇到了一些奇怪的事情。以下代码将产生两个不同的 URL,尽管它是执行相同的术语:

enter image description here

这些是这里的问题:

  1. {$sArticle.linkDetails|rewrite:$sArticle.articleName} 的输出在 href-Attribute 和作为此链接标题的第二个输出之间是不同的。
  2. href-Attribute 中 {$sArticle.linkDetails|rewrite:$sArticle.articleName} 的输出将添加一个 URL 参数来描述类别的 ID,这是不需要的: "?c=7"

第二个问题:

同样的模板代码怎么会有如此不同?幕后有什么魔法在起作用?

最佳答案

我相信您熟悉 Shopware 后端。请看我的简短回答:

  1. 从详细信息页面 url 中删除“?c=7”:

Set 'Remove CategoryID from Url = No' at Seo/router settings. Then clear cache.

  1. 我认为存在多个商店,或者您从其他电子商务系统迁移到 shopware。

You can see the connection between those 2 links at "s_core_rewrite_urls" table. Just backup the table & empty it. Click on Configuration > Cache/performance menu item and do "Rebuild SEO URL index".

更多信息请访问 https://developers.shopware.com/blog/2015/08/11/the-shopware-seo-engine/

关于php - 如何在 Shopware 中管理 SEO-Urls?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40130083/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com