dousuohe5882
2016-10-19 11:24
浏览 75
已采纳

如何在Shopware中管理SEO-Urls?

It seems that Shopware has some "magic behind" when generating URLs and i am looking for someone, who can explain this to me.

This is the code of standard-template to generate SEO-urls with variables which can be configured in SEO-router-settings in the backend:

{* 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}

The configuration in SEO-router-settings looks like this per default:

enter image description here

Anyway, the output is little different:

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

(All capital letters demonstrates real correct domain-, category- and product-names, that are hidden here for the sake of privacy of my client)

The issue here is the URL-Parameter "?c=7" which isn't wanted and should be omitted as defined in SEO-router-options.

First question: how to omitt this URL-parameter "c=7" at the end of URL?

When i debug this code, i run into strange things. The following code will result in two different URLs although it is the same term executed:

enter image description here

These are the issues here:

  1. The output of {$sArticle.linkDetails|rewrite:$sArticle.articleName} is different between the href-Attribute and the second output as the caption of this link.
  2. The output of {$sArticle.linkDetails|rewrite:$sArticle.articleName} within href-Attribute will add an URL-Parameter to describe the id of the category, which isn't wanted: "?c=7"

Second question:

How can the same template-code be so different? What magic is there working behind the scenes?

图片转代码服务由CSDN问答提供 功能建议

似乎 Shopware 在生成网址时有一些“魔力背后”,我正在寻找 对于那些可以向我解释的人。

这是标准模板的代码,用于生成带有变量的SEO-urls,可以在SEO-router-settings中配置 后端:

  {* Product name *} 
 {block name ='frontend_listing_box_article_name'} 
&lt; a href =“{$ sArticle.linkDetails | rewrite:$  sArticle.articleName}“
 class =”product  -  title“
 title =”{$ sArticle.articleName | escape}“&gt; 
 {$ sArticle.articleName | truncate:50} 
&lt; / a&gt;  
 {/ block} 
   
 
 

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

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

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

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

这里的问题是URL参数“?c = 7”,这是 不应该如SEO-router-options中所定义的那样省略。

第一个问题:如何在这个网址参数“c = 7”中省略 URL的结尾?

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

这些是这里的问题:

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

    第二个问题:

    相同的模板代码如何如此不同? 在幕后工作有什么魔力?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douyin4561 2016-10-20 05:19
    已采纳

    I'm sure you are familiar with Shopware backend. See my answers in short:

    1. To remove "?c=7" from detail page urls:

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

    1. I think there is multiple shops exists or you migrated to shopware from other ecommerce systems.

    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".

    More info available at https://developers.shopware.com/blog/2015/08/11/the-shopware-seo-engine/

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题