drumslist Posted February 4, 2010 Share Posted February 4, 2010 I am trying to insert a hyperlink in the short description field and it appears that the and other tags are not being processed in the browser. The text for the link is there, but not as a hyperlink. Thank you for any ideas --Andy Link to comment Share on other sites More sharing options...
rocky Posted February 5, 2010 Share Posted February 5, 2010 Do you mean on the product listings or on the product page? The link should appear on the product page, but it won't appear on the product listings because Prestashop strips all HTML code from the short description. To stop Prestashop stripping the HTML code, change line 10 of product-list.tpl in your theme's directory from: <a href="{$product.link|escape:'htmlall':'UTF-8'}">{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'} to: <a href="{$product.link|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:360:'...'|escape:'htmlall':'UTF-8'} 1 Link to comment Share on other sites More sharing options...
drumslist Posted February 5, 2010 Author Share Posted February 5, 2010 Yes, I was referring to the product list page where the short_description box can display a brief description. Thanks for the code change, I'll give that a shot.Just wondering why the paragraph tag " " is added in the admin product short_description html code. Is that something built into the TinyMCE plugin? Or is there a way to force the out of there?Thanks very much for the quick reply!Andy Link to comment Share on other sites More sharing options...
rocky Posted February 5, 2010 Share Posted February 5, 2010 I think it is TinyMCE that automatically adds those tags. I'm not sure how to stop it doing that. Link to comment Share on other sites More sharing options...
drumslist Posted February 5, 2010 Author Share Posted February 5, 2010 Thanks -- it looks like if you remove the strip_tags:'UTF-8' you can force your html in the box . . . at least for now!thanks again for your help,Andy Link to comment Share on other sites More sharing options...
Sanis Posted February 5, 2010 Share Posted February 5, 2010 If you remove strip_tags, page is no longer W3C compliant. Any idea how to remove the 'p' tag? Link to comment Share on other sites More sharing options...
rocky Posted February 6, 2010 Share Posted February 6, 2010 Try changing line 10 of product-list.tpl in your theme's directory to: <a href="{$product.link|escape:'htmlall':'UTF-8'}">{if $product.description_short|substr:0:3 == ' '}{$product.description_short|substr:3:-4|truncate:360:'...'}{else}{$product.description_short|truncate:360:'...'}{/if} This code will check whether the first 3 characters of the description are <p>. If they are, it cuts off the first 3 and last 4 characters to remove the tags. If the description starts with another tag (like ), it doesn't cut off any letters. Link to comment Share on other sites More sharing options...
Sanis Posted February 6, 2010 Share Posted February 6, 2010 Try changing line 10 of product-list.tpl in your theme's directory to: <a href="{$product.link|escape:'htmlall':'UTF-8'}">{if $product.description_short|substr:0:3 == ' '}{$product.description_short|substr:3:-4|truncate:360:'...'}{else}{$product.description_short|truncate:360:'...'}{/if} This did the trick, thanks!I may however need to use html editor instead of wysiwyg to insert 'br' tags (to avoid double paragraphs), but it works. Link to comment Share on other sites More sharing options...
rocky Posted February 6, 2010 Share Posted February 6, 2010 You may be interested in knowing that you can press Shift+Enter to insert a <br /> using the WYSIWYG editor. Link to comment Share on other sites More sharing options...
netman Posted April 19, 2010 Share Posted April 19, 2010 Rocky,Any idea how to keep the html tags in product page, version 1.2.5.?1.3 keeps all the tags.Thanks Link to comment Share on other sites More sharing options...
rocky Posted April 20, 2010 Share Posted April 20, 2010 I don't understand. No html tags are stripped in the product descriptions on the product page in Prestashop v1.2.5 and v1.3. Only the accessory description has tags stripped. Link to comment Share on other sites More sharing options...
cessargor Posted March 29, 2011 Share Posted March 29, 2011 to add flash to short description field just remove the following line to the product.tplthis {$product->description_short|strip_tags} replace for {$product->description_short} and done.good look. Link to comment Share on other sites More sharing options...
nwcic Posted May 13, 2011 Share Posted May 13, 2011 Just an FYI: This does not seem to work in v.1.4.1.0.Tried each of the solutions but HTML formatting is still thrown out in the product descriptions (when you first click on a category.) In the prouct detail page, HTML formatting is ok of course) Link to comment Share on other sites More sharing options...
cessargor Posted May 13, 2011 Share Posted May 13, 2011 haven't install 1.4 yet, new releases are always full of bugs, will wait til next few version to update my sites. Link to comment Share on other sites More sharing options...
simberak Posted January 2, 2012 Share Posted January 2, 2012 Hi rocky, I tried to remove strip_tags:'UTF-8' from the product list.tpl and it is quit working, but instead of "showing" the brake in FO, it will shows the code for it... For example: Chirurgická ocel, cz sklo<br />Naušnice, přívěsek So I have html tag in short description now, but it is as normal text... so without wanted effect )))) Can you help with this please? Link to comment Share on other sites More sharing options...
simberak Posted January 4, 2012 Share Posted January 4, 2012 Oh I got it, now it works, it was because my short description was in <A> tag... Link to comment Share on other sites More sharing options...
aftermarket Posted February 21, 2012 Share Posted February 21, 2012 Hi Simberak or anyone else, Can you expand on this. I am unable to get the short description to display on the product list page. I want to use the <br> tags from my short description is a small list of features that look jumbled if they are all on the same line. This is what my product list description looks like: <div class="red_box"><strong>Name:</strong> Product name <strong></strong></div> <div class="red_box"><strong>Synonyms:</strong> Synonym 1, Synonym 2, Synonym 3</div> <div class="red_box"><strong>Number:</strong> <span class="st">47554640</span><strong></strong></div> <div... I would like it to look like: Name: Product Name Synonyms: Synonym 1, Synonym 2, Synonym 3 Number: 47554640 This is what is currently displaying that in my theme's product-list.tpl: <p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:360:'...'|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:360:'...'|escape:'htmlall':'UTF-8'}</a></p> Link to comment Share on other sites More sharing options...
aftermarket Posted February 21, 2012 Share Posted February 21, 2012 The code is not displaying right. Here it is: Hi Simberak or anyone else, Can you expand on this. I am unable to get the short description to display on the product list page. I want to use the <br> tags from my short description is a small list of features that look jumbled if they are all on the same line. This is what my product list description looks like: <div class="red_box"><strong>Name:</strong> Product name <strong></strong></div> <div class="red_box"><strong>Synonyms:</strong> Synonym 1, Synonym 2, Synonym 3</div> <div class="red_box"><strong>Number:</strong> <span class="st">47554640</span><strong></strong></div> <div... I would like it to look like: Name: Product Name Synonyms: Synonym 1, Synonym 2, Synonym 3 Number: 47554640 This is what is currently displaying that in my theme's product-list.tpl: <p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:360:'...'|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:360:'...'|escape:'htmlall':'UTF-8'}</a></p> Link to comment Share on other sites More sharing options...
aftermarket Posted February 21, 2012 Share Posted February 21, 2012 The code is not displaying right. Here it is: <p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:360:'...'|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:360:'...'|escape:'htmlall':'UTF-8'}</a></p> Link to comment Share on other sites More sharing options...
aftermarket Posted February 21, 2012 Share Posted February 21, 2012 Nevermind. Figured it Out. To show the short description on category pages as it appears on your product page. Use this: <p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:360:'...'|strip_tags:'UTF-8'|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:360:'...'}</a></p> Link to comment Share on other sites More sharing options...
cjrent Posted August 21, 2013 Share Posted August 21, 2013 In order to allow html formatting in my short description, I've changed my product-list.tpl from <p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}" >{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}</a></p> to <p class="product_desc"> <a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}" >{$product.description_short|truncate:360:'...'}</a> </p> However, it seems that extra <p> tags get inserted when I do this. Is it possible to avoid this, as it makes the visual formatting of the product list page to be off. Rumor has it that TinyMCE is adding these extra <p> tags. Is ti possible to stop it from doing that? Many thanks. Link to comment Share on other sites More sharing options...
stevent Posted October 4, 2014 Share Posted October 4, 2014 I have the same probleme with 1.6 but all the solutions in this post are not what i need to solve my problem How can I display the "page setting" of the short desc en the product list?? http://www.arthostechnics.com/catalogue/fr/12-nos-produits thank you verry much Link to comment Share on other sites More sharing options...
khejit68 Posted March 9, 2015 Share Posted March 9, 2015 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. Link to comment Share on other sites More sharing options...
Recommended Posts