Jump to content

How to add javascript to "category description"


Recommended Posts

Thanks to below topic I can add HTML to te "Category Description"

 

http://www.prestashop.com/forums/topic/91370-category-description-with-html-tags/

 

However I also, want to add some javascript to it as well. If I add it now I get an error. Somehow there there is a validation that does not allow javascript. Who knows how to turn it of?

 

Purpose of javascript. Add fancybox of a "read more" link that works.

 

Thanks

Link to comment
Share on other sites

Instead of embedding Javascript in the category description itself, embed a div (or similar element) with a custom class and then add a Javascript function via $(document).ready(); that cycles through this class and sets up the fancybox elements for each category as needed.

 

Cheers

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

thanks for the suggestion, however I've found another sulotion that works as well. What I did.

In ../classes/category.php I changed this line

 

protected $fieldsValidateLang = array('name' => 'isCatalogName', 'link_rewrite' => 'isLinkRewrite', 'description' => 'isCleanHtml',

 

into

 

protected $fieldsValidateLang = array('name' => 'isCatalogName', 'link_rewrite' => 'isLinkRewrite', 'description' => 'isString',

 

This way the category description allows to ad javascript.

 

Regards

Link to comment
Share on other sites

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...