tommy48tommy48 MemberComments: 1 Received thanks: 0 Member since: February 28

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?

Answers

  • simklisimkli MemberComments: 1264 Received thanks: 461 Member since: February 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 MemberComments: 1 Received thanks: 0 edited March 1 Member since: February 28

    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.

  • M_HeilmeierM_Heilmeier MemberComments: 13 Received thanks: 0 Member since: December 2018

    Got the same Problem here. Is there any solution to this?

Sign In or Register to comment.