Smarty: How to fix "unknown modifier 'rewrite'" exception?

Viewed 1484

After upgrading Shopware from 5.2 to 5.3 the following exception occured:

Smarty: unknown modifier "rewrite"

The error happens in a template-file. Obviously the "rewrite" modifier was removed. How can i substitute it in the template files?

{* Product image - uses the picture element for responsive retina images. *}
<a href="{$sArticle.linkDetails|rewrite:$sArticle.articleName}"
   title="{$sArticle.articleName|escape}"
   class="product--image" style="background-image: url('{if $sArticle.image.thumbnails[1].source}{$sArticle.image.thumbnails[1].source}{else}{link file='frontend/_public/src/img/no-picture.png'}{/if}')">
{*    <div class="product-hover">
        <span>Auge</span>
        <span>Details</span>
    </div>*}
2 Answers

Just use {$sArticle.linkDetails} instead of {$sArticle.linkDetails|rewrite:$sArticle.articleName}.
You have to do the same on Listing & Detail page templates.

When upgrading Shopware to a new version, you should always read the UPGRADE.md file and watch for @deprecated comments in the code.

You can find the UPGRADE.md for Shopware 5.3 here: https://github.com/shopware/shopware/blob/5.3/UPGRADE-5.3.md

If you search for removed, you will see there are a lot of things removed. You have to care about that when upgrading to a new version.

Related