folkifoon Posted May 19, 2014 Share Posted May 19, 2014 Default view is grid, but when i change this to list view my products show like this: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 More sharing options...
vekia Posted May 19, 2014 Share Posted May 19, 2014 remove strip tags and truncate {$product.description_short} Link to comment Share on other sites More sharing options...
folkifoon Posted May 19, 2014 Author Share Posted May 19, 2014 (edited) That is the only thing i already tried myself, after doing that its shows only white, so no text at all! Edited May 19, 2014 by folkifoon (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 19, 2014 Share Posted May 19, 2014 perhaps text is there but with white font? can you check page source for this text, please? (CTRL+U in chrome) Link to comment Share on other sites More sharing options...
folkifoon Posted May 19, 2014 Author Share Posted May 19, 2014 I checked that, but it's not there. Completely removed. Link to comment Share on other sites More sharing options...
vekia Posted May 19, 2014 Share Posted May 19, 2014 at least strange :/ can you show contents of your modified file, please? Link to comment Share on other sites More sharing options...
LiTiNuM Posted May 19, 2014 Share Posted May 19, 2014 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 More sharing options...
vekia Posted May 19, 2014 Share Posted May 19, 2014 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 More sharing options...
LiTiNuM Posted May 19, 2014 Share Posted May 19, 2014 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 More sharing options...
LiTiNuM Posted May 19, 2014 Share Posted May 19, 2014 I solved it: <p class="product-desc" itemprop="description"> {$product.description_short|substr:3:-4|truncate:360:'...'} </p> Link to comment Share on other sites More sharing options...
vekia Posted May 19, 2014 Share Posted May 19, 2014 and what about unclosed tags? with truncate tags opened somewhere in first 360 chars will be unclosed, it's dangerous, theme can be distorted Link to comment Share on other sites More sharing options...
folkifoon Posted May 19, 2014 Author Share Posted May 19, 2014 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 More sharing options...
vekia Posted May 19, 2014 Share Posted May 19, 2014 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 More sharing options...
LiTiNuM Posted May 20, 2014 Share Posted May 20, 2014 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 More sharing options...
folkifoon Posted May 20, 2014 Author Share Posted May 20, 2014 I just dont understand why this is not fixed by default. I had the same problemen in version 1.5.It just looks bad when there are no linebreaks. Link to comment Share on other sites More sharing options...
vekia Posted May 20, 2014 Share Posted May 20, 2014 in fact, "it's not a bug, it's a feature" to prevent situations like i described Link to comment Share on other sites More sharing options...
folkifoon Posted May 20, 2014 Author Share Posted May 20, 2014 But it looks messy when you look at my first post, the screenshot dont u think? Link to comment Share on other sites More sharing options...
Recommended Posts