Search code examples
phpsymfonyurl-routingshopware

How to use custom field in Shopware 5 item url?


I am trying to use a custom field's value in seo url template in shopware but it does not seem to work.

The guide here does the exact same thing what I do:

https://docs.shopware.com/en/shopware-5-en/settings/seo

SEO URLs item template:

deal/{if $sArticle.custom_url}{$sArticle.custom_url}{else}{$sArticle.supplier|replace:'.':'' }-{$sArticle.name|replace:'.':'' }{/if}

Is there something wrong with this part?

{if $sArticle.custom_url}{$sArticle.custom_url}{/if}

Solution

  • Here is what happened: I created a new custom field, added it as a variable in seo router settings, put a value in item's overview, then cleaned all the caches, but it was not going there.

    As I understood the reason is that only attr1-attr19 are available to the router. When I tried with the attr1 it worked.