Jump to content

[SOLVED] Extra <p> Tags when Removing Strip Tags in Short Description


Recommended Posts

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 it possible to stop it from doing that?

(see post #3 here: http://www.prestasho...post__p__300663)

I tried the fix from Post #7, but that didn't work.

 

Many thanks.

Link to comment
Share on other sites

take a look here: ADMIN_DIR/themes/default/template/controllers/products/helpers/form/form.tpl

you have there tinymce objec SETUP definition:

 

tinySetup({
  editor_selector :"autoload_rte",

 

change it to:

 

tinySetup({
  editor_selector :"autoload_rte",
	    force_p_newlines : false,
	    force_br_newlines : true,

 

voila ;)

  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Hello Vekia,

 

I tried this in my 1.5.4.1 site, but it didnt work (I emptied cache and forced compile). Is it perhaps because i use another external theme?

 

I need to remove <p> to avoid validation errors since i force the short description as an H2 tag

 

Thank you.

 

[solved:I replaced '{$product->description_short}' with '{$product->description_short|substr:4:-5}'

So fat it works ok and removes the 3 characters '<p>'. Info found on -http://www.prestashop.com/forums/topic/43107-solved-product-short-description-field-not-displaying-html/-

]

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

  • 4 weeks later...

take a look here: ADMIN_DIR/themes/default/template/controllers/products/helpers/form/form.tpl

you have there tinymce objec SETUP definition:

 

tinySetup({
   editor_selector :"autoload_rte",
change it to:

 

tinySetup({
   editor_selector :"autoload_rte",
		    force_p_newlines : false,
		    force_br_newlines : true,
voila ;)

 

Hi, i'm searching exactly the same thing in Prestashop 1.6.0.6, but i'm unable to find it there is no more template and controllers folders in default theme, please help.

 

thanks in advance !

Link to comment
Share on other sites

  • 1 year later...

Sorry for dragging up an old thread, but i had the same problem, wanting to use the short description as the H1 tag on the product page. The problem is that the tinyMCE adds the P tag to the short description, which isn't w3c compatible.

 

To stop this happening, I simply went to the following file:

admin_folder\themes\default\template\controllers\products\informations.tpl

 

At around line 335, there is the code:

{include
file="controllers/products/textarea_lang.tpl"
languages=$languages
input_name='description_short'
class="autoload_rte"
input_value=$product->description_short
max=$PS_PRODUCT_SHORT_DESC_LIMIT}
 
Simply remove the line class="autoload_rte", and it changes the field to a simple text box.
 
I thought this might be useful for anyone having similar issues!
  • Haha 1
Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...