Jump to content

HTML stripped from product description


Recommended Posts

Default view is grid, but when i change this to list view my products show like this:

zoawdk.jpg


I know it has something do to with product-list.tpl
 

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

I would like this part to be shown in html, how can i change this code? It looks so messy right now.

 

Link to comment
Share on other sites

Hello, have the same problem.

 

If I remove |strip_tags:'UTF-8' from this {$product.description_short|strip_tags:'UTF-8'|truncate:460:'...'} - my description_short disappears.

In DB description_short save like TEXT.

For example, if use |escape:'html':'UTF-8' I have all TEXT with html-tags how text.

 

But I need have description using tags, to take account of line breaks <br /> and etc.

Link to comment
Share on other sites

so you use some other variable with modifiers than variable that i suggested to use?
 

{$product.description_short}

if you remove strip_tags you have to remove also truncate modifier (some tags will be unlosed! it can crash totally structure of website)

Link to comment
Share on other sites

Yes, I'm understanding, I tried remove strip_tags and trunc, but In this case the description of the blank (empty).

 

I use Presta 1.6.0.6, all code of description_short save in DataBase how TEXT. Maybe need use some function to recognize and apply html-tags?

Link to comment
Share on other sites

That code solved the problem for me LiTiNuM!

Vekia i checked my site, no problems after chaning this code. Can you confirm that this solution is good? It works, its now formatted in html just the same as on the product page itself.

Link to comment
Share on other sites

check this, for example your desription contans table

 

<table>

<tr>

<td>

Lorem ipsum dolor sit amet, pro ei aliquid volumus. Tota regione vis ex, ex cum veritus interpretaris, molestie tincidunt vix at. Ex nisl neglegentur concludaturque mei, an vel sint accusam salutatus. Has ea ullum everti fabulas.Detracto consetetur an nam, ex congue tantas corrumpit vim. Mel euripidis dissentiet cu, sed choro percipit cu, id sit deleniti voluptua facilisis. In sed case praesent, his stet ancillae constituto ut. Eripuit eruditi praesent no est. Mea veritus tacimates eloquentiam eu, nam ne diceret explicari, utinam incorrupte ea quo. Te eam nostro causae laboramus, tollit assueverit cu eum. Brute fugit augue est at Vim quem euismod cu, in quod viris civibus mei, atqui mediocritatem ne mei. Pri ut eirmod iriure. Sit erat aliquam consetetur an, ea debet laoreet repudiandae ius. Iusto possim vel et, mei utinam oportere disputando cu, vocibus eligendi aliquando an eos. Noluisse apeirian efficiantur mei ei, eu paulo meliore accumsan qui.
<td>
</td>
</table>
 
 
now you use variable:
{$product.description_short|substr:3:-4|truncate:360:'...'}

everything after 360 char will be cutted off:

 

 

<table>

<tr>

<td>

Lorem ipsum dolor sit amet, pro ei aliquid volumus. Tota regione vis ex, ex cum veritus interpretaris, molestie tincidunt vix at. Ex nisl neglegentur concludaturque mei, an vel sint accusam salutatus. Has ea ullum everti fabulas.Detracto consetetur an nam, ex congue tantas corrumpit vim. Mel euripidis dissentiet cu, sed choro percipit cu, id sit deleniti voluptua facilisis. In sed case praesent, his stet ancillae constituto ut. Eripuit eruditi praesent no est. Mea veritus tacimates eloquentiam eu, nam ne diceret explicari, utinam incorrupte ea quo. Te eam nostro causae laboramus, tollit assueverit cu eum. Brute fugit augue est at Vim quem euismod cu, in quod viris civibus mei, atqui mediocritatem ne mei. Pri ut eirmod iriure. Sit erat aliquam consetetur an, ea debet laoreet repudiandae ius. Iusto possim vel et, mei utinam oportere disputando cu, vocibus eligendi aliquando an eos. Noluisse apeirian efficiantur mei ei, eu paulo meliore accumsan qui.
<td>
</td>
</table>

 

 

 

tags:

<table>
<tr>
<td>

will be unclosed!!! it can generate a lof of theme problems (for example this can affect add to cart button and whole theme structure on product page)

if you want to use this method make sure that you will not leave any unclosed html tag

Link to comment
Share on other sites

Hi, yes, if text will be so BIG, better to remove TRUNC.

But it's short, not FULL or LARGE description )))

 

I just write rule, and tell you, Presta 1.6.0.6 very peculiar processes short description.

For example, if I use 2 or more tags <p>, system shows just the first.

So I have to use 1 <p> and inside of them are used <span>, <br /> and etc.

Link to comment
Share on other sites

×
×
  • Create New...