3
votes

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?

1
hi itinance, I recently ran into the same problem without a proper solution. I wanted to remove the parameter to improve SEO rankings. As far as I know the parameter is needed to create the breadcrumbs on the product detail page because some products can be accessed via different categories (category tree). This parameter seems to help the breadcrumb find the right "tree"Ben Spi
Thx for your remarks. I maintain another shopware (same version) where this additional parameter "?c=$categorId" not occuritinance

1 Answers

3
votes

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/