Jump to content

How to enable html tags on product listing page PS 1.6.0.13?


Recommended Posts

You would have to edit your template to do it. More than likely your template is stripping it. In the product list find this 

{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}

and replace it with this

{$product.description_short|truncate:360:'...'}
Link to comment
Share on other sites

 

You would have to edit your template to do it. More than likely your template is stripping it. In the product list find this 

{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}

and replace it with this

{$product.description_short|truncate:360:'...'}

It removes the whole text from product listing page 

 

http://lovemyseo.com/presta/3-music-ipods

 

 

I did followinf but its displays tags isntad of fisplaying number

 

<p class="product-desc itemprop="description_short">
{$product.description_short|escape:'html':'UTF-8'|truncate:360:'...'}
</p> 

 

Edited by lovemyseo (see edit history)
Link to comment
Share on other sites

Find this line in product-list.tpl in main directory of your theme:

<p class="product-desc" itemprop="description">
{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}
</p>

 

and change it to:

<div class="product-desc" itemprop="description">
{$product.description_short|truncate:360:'...'}
</div>

 

 

Then navigate to your theme's js folder and in global.js file find:

html += '<p class="product-desc">'+ $(element).find('.product-desc').html() + '</p>';

 

and change it to:

html += '<div class="product-desc">'+ $(element).find('.product-desc').html() + '</div>';

 

This first line should be there twice, change both.

 

 

You may have to do additional styling, for example add 

list-style-type: circle;

in css for ul to make bullets appear for list.

Link to comment
Share on other sites

Find this line in product-list.tpl in main directory of your theme:

and change it to:

 

Then navigate to your theme's js folder and in global.js file find:

and change it to:

This first line should be there twice, change both.

 

 

You may have to do additional styling, for example add 

list-style-type: circle;

in css for ul to make bullets appear for list.

Perfect Worked like charm , great solution, I didnt even have to touch global.css got it working with first change 

 

<div class="product-desc" itemprop="description">
{$product.description_short|truncate:360:'...'}
</div>

 

Please admin mark it as solved
Edited by lovemyseo (see edit history)
Link to comment
Share on other sites

  • 2 months later...

 

Perfect Worked like charm , great solution, I didnt even have to touch global.css got it working with first change 

 

<div class="product-desc" itemprop="description">
{$product.description_short|truncate:360:'...'}
</div>

 

Please admin mark it as solved

 

 

khejit68, lovemyseo : did you tried it on 1.6.x version? Your posts are quite recent but I did what suggested on my latest Presta installation and it did nothing, html tags are still ignored :/

DId work for me on 1.6.0.14 which theme u r using?

Link to comment
Share on other sites

Thank you for your quick answer :)

 

Indeed removing "strip_tags" as mentioned above works like a charm!

 

I did it on default bootstrap theme.

 

Solution to my problem laid elswhere, I just had too long short_description in CSV

Increasing max characters in the Back Office resolved the issue.

 

(menu Preferences>Products>in the first section there is a field to change it)

Link to comment
Share on other sites

  • 1 month later...

I encountered bug on this solution. If there are html tags involved and smarty's truncate:360 is still on place, in some cases buttons "add to cart", "quick view" etc are doubled.

These cases are when smarty tries to truncate in the middle of html code, which is counted with the rest of short description.

Solutions:

1) Remove truncate function:

<div class="product-desc" itemprop="description">
{$product.description_short}
</div>

2) If you still want to truncate, change '360' value to something else, for example:

<div class="product-desc" itemprop="description">
{$product.description_short|truncate:760:'...'}
</div>

But this will apply to all of your short descriptions, so be careful, and check the result for every product on listing ;)

Edited by khejit68 (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Find this line in product-list.tpl in main directory of your theme:

 

and change it to:

 

 

Then navigate to your theme's js folder and in global.js file find:

 

and change it to:

 

This first line should be there twice, change both.

 

 

You may have to do additional styling, for example add 

list-style-type: circle;
in css for ul to make bullets appear for list.

 

I am IN Ps 1.6.1.11 line breaks worked but bullets not appearing?  any clue can you check this code line for me it kidn of work but breaks category page too

<div id="short_description_content" class="rte align_justify"><p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|strip_tags:'UTF-8'|truncate:360:''}"></a>{$product.description_short}</p></div>

</div>

 

using the first one you provided line breaks worked but no bullets

Link to comment
Share on other sites

×
×
  • Create New...