tommy48tommy48 MitgliedKommentare: 1 Danke erhalten: 0 Mitglied seit: 28. Februar

I have overridden the frontend/listing/product-box/box-basic.tpl template, and chaged the following variable output:

{$sArticle.description_long|strip_tags|truncate:380}

to...

{$sArticle.description_long}

One would expect that the output would not be truncated and would include HTML tags, but the text has HTML stripped. It seems that HTML is stripped before being added as a page variable. Is there a way I can output the description including HTML tags?

Antworten

  • simklisimkli MitgliedKommentare: 1261 Danke erhalten: 459 Mitglied seit: Februar 2014

    Which product box layout do you use for the category? For example if you're using the list-layout Shopware is using the box-list.tpl.

    However: One must not edit the template files directly because they might be overridden after an update. Always use the template inheritance system and create your own theme for modifications! https://developers.shopware.com/theme-guide/

    Regards

     

  • tommy48tommy48 MitgliedKommentare: 1 Danke erhalten: 0 bearbeitet 1. März Mitglied seit: 28. Februar

    Thanks for your response. I don't think I'm using the wrong template though. I can successfully remove the description, and removing the truncate method has the desired effect. However, removing strip_tags does nothing.

    I have of course overridden the block as specified in the guide, in themes/Frontend/MyProject/frontend/listing/product-box/box-basic.tpl:

    {extends file='parent:frontend/listing/product-box/box-basic.tpl'}
    
    {* Product description override *}
    {block name='frontend_listing_box_article_description'}
        <div class="product--description test-class">
            {$sArticle.description_long}
        </div>
    {/block}
    

    Using the above code, the test-class appears on the description element, inferring that it is overridden successfully. The description is no longer trucated. However, tags are still stripped from the content.

Anmelden oder Registrieren, um zu kommentieren.