jcaprio Posted June 24, 2011 Share Posted June 24, 2011 Please do not link me to the french explanation of this that exists on the forum...Can anyone assist in English? Using PS 1.4Thanks,Joe Link to comment Share on other sites More sharing options...
shokinro Posted June 24, 2011 Share Posted June 24, 2011 I don't think you can use HTML in category description.it will be stripped off when you click save button.you have try to change it in database directly, but this has risk of lost when you update it on back office next time. Please do not link me to the french explanation of this that exists on the forum you can try to use Google translation, it is pretty good enough. ;-) Link to comment Share on other sites More sharing options...
bellini13 Posted June 24, 2011 Share Posted June 24, 2011 create a file called Category.php and put it in the /override/classes folder, and add this content to it. This works for v1.4.0.17, and may need to be revised slightly for future versions, i have not tried it yet on v1.4.1 or greater. <?php class Category extends CategoryCore { public function getTranslationsFieldsChild() { self::validateFieldsLang(); $fieldsArray = array('name', 'link_rewrite', 'meta_title', 'meta_keywords', 'meta_description'); $fields = array(); $languages = Language::getLanguages(); $defaultLanguage = Configuration::get('PS_LANG_DEFAULT'); foreach ($languages as $language) { $fields[$language['id_lang']]['id_lang'] = $language['id_lang']; $fields[$language['id_lang']][$this->identifier] = intval($this->id); $fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']])) ? Tools::htmlentitiesDecodeUTF8(pSQL($this->description[$language['id_lang']], true)) : ''; foreach ($fieldsArray as $field) { if (!Validate::isTableOrIdentifier($field)) die(Tools::displayError()); /* Check fields validity */ if (isset($this->{$field}[$language['id_lang']]) AND !empty($this->{$field}[$language['id_lang']])) $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]); elseif (in_array($field, $this->fieldsRequiredLang)) $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]); else $fields[$language['id_lang']][$field] = ''; } } return $fields; } } 3 Link to comment Share on other sites More sharing options...
jcaprio Posted June 24, 2011 Author Share Posted June 24, 2011 Thanks for the info... however I am using version PrestaShop™ 1.4.3.My apologies for not being more specific...I tried creating the file and putting it in place and it did not work...Any other ideas?Thanks,Joe Cap Link to comment Share on other sites More sharing options...
bellini13 Posted June 24, 2011 Share Posted June 24, 2011 did you re-edit the category description with the html you want to display? if not, try to do that. 1 Link to comment Share on other sites More sharing options...
jcaprio Posted June 24, 2011 Author Share Posted June 24, 2011 WOOOOHOOO! Pretty damn Awesome!Thanks for the help!Joe Cap Link to comment Share on other sites More sharing options...
shokinro Posted June 24, 2011 Share Posted June 24, 2011 override exiting Category class, that is pretty professional way to to that.thanks bellini13 for sharring. Link to comment Share on other sites More sharing options...
jellygnite Posted June 29, 2011 Share Posted June 29, 2011 bellini13 thanks so much for this. I have it working in v 1.4.3.Further to this if you want to convert tags in the category list in the admin area edit classes/AdminTab.php and add in Tools::htmlentitiesUTF8 to the value being printed.~ line 1492change $echo = ($key == 'price' ? round($tr[$key], 2) : isset($params['maxlength']) ? Tools::substr($tr[$key], 0, $params['maxlength']).'...' : $tr[$key]);to $echo = ($key == 'price' ? round($tr[$key], 2) : isset($params['maxlength']) ? Tools::substr(Tools::htmlentitiesUTF8($tr[$key]), 0, $params['maxlength']).'...' : Tools::htmlentitiesUTF8($tr[$key]));Note the whole function should actually go in the override folder.I will update my blog post to reflect all this asap. Also to show the html editor. Link to comment Share on other sites More sharing options...
philee Posted July 1, 2011 Share Posted July 1, 2011 Thank you bellini13 for sharing this! Link to comment Share on other sites More sharing options...
SSNet Inc Posted August 30, 2011 Share Posted August 30, 2011 Thanks Jellygnite - the info you posted in your blog works like a charm on version 1.4. Took all of 5 minutes to put into place! Only thing better would be to pull in the ckeditor for category descriptions - like what is used for the Short and Long product descriptions. Why doesn't prestashop use that feature for all descriptions? Link to comment Share on other sites More sharing options...
jellygnite Posted August 30, 2011 Share Posted August 30, 2011 Thanks SSNet. CKeditor? I thought prestashop uses tinymce. I will update blog post as soon as can to show how to implement the wysiwyg editor. Link to comment Share on other sites More sharing options...
jellygnite Posted September 23, 2011 Share Posted September 23, 2011 I have updated the post (23 September 2011) to show how to include the WYSYWIG editor in the category description. View complete details at http://www.jellygnite.com.au/blog/index.php/archive/update-display-html-in-prestashop-category-description-v-1-4/ 1 Link to comment Share on other sites More sharing options...
philee Posted September 23, 2011 Share Posted September 23, 2011 Great work Jellygnite. Link to comment Share on other sites More sharing options...
DaggaTora Posted October 4, 2011 Share Posted October 4, 2011 Thanks for the info! but when i copy the AdminTab.php to override/classes BO become almost blank. any clue? Link to comment Share on other sites More sharing options...
DaggaTora Posted October 5, 2011 Share Posted October 5, 2011 Ok, i don't know why but today i restart "the experiment" and now i don't get the same problem as yesterday but no html editor on description neither. It is like if nothing was changed. Link to comment Share on other sites More sharing options...
polaije Posted October 12, 2011 Share Posted October 12, 2011 Hi, Same problem with me with local installation. When I put the overriden class I cannot open the catalogue tab in admin and my site display a blank screen. Any idea ? Jean-Marie Link to comment Share on other sites More sharing options...
DaggaTora Posted October 12, 2011 Share Posted October 12, 2011 Hi polaije, i found that BO problem was because i copy the code from the "copy code" button. Open it as "view simple" and try again. I finally get it working! i was overwritting category-branch-tree.tpl intead of putting the modified file on theme folder. Link to comment Share on other sites More sharing options...
multimehdi Posted October 16, 2011 Share Posted October 16, 2011 Thank you a lot for this code ! It helped me to get through this problem that was becoming awful to me ! Great Job ! Link to comment Share on other sites More sharing options...
DaggaTora Posted October 24, 2011 Share Posted October 24, 2011 Hi I get now category descriptions with html but qhen i save the category now a "<p>" appears at the beginning of the description in tooltips and backend. any idea dea? Link to comment Share on other sites More sharing options...
jellygnite Posted March 4, 2012 Share Posted March 4, 2012 DaggaTora, showing a <p> is correct as this is the html that you were after. It shouldn't affect the useability of the backend. Link to comment Share on other sites More sharing options...
Guest Posted March 5, 2012 Share Posted March 5, 2012 Thank you very much for this. I'm having only one problem. Added in TinyMCE, I'm using Prestashop V4.7. When I adjust a font size of a word, all words in my paragraph adjust to the same size. When I apply bold to a word all words go bold. Is this just me? Link to comment Share on other sites More sharing options...
Rayan Posted April 13, 2012 Share Posted April 13, 2012 create a file called Category.php and put it in the /override/classes folder, and add this content to it. This works for v1.4.0.17, and may need to be revised slightly for future versions, i have not tried it yet on v1.4.1 or greater. <?php class Category extends CategoryCore { public function getTranslationsFieldsChild() { self::validateFieldsLang(); $fieldsArray = array('name', 'link_rewrite', 'meta_title', 'meta_keywords', 'meta_description'); $fields = array(); $languages = Language::getLanguages(); $defaultLanguage = Configuration::get('PS_LANG_DEFAULT'); foreach ($languages as $language) { $fields[$language['id_lang']]['id_lang'] = $language['id_lang']; $fields[$language['id_lang']][$this->identifier] = intval($this->id); $fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']])) ? Tools::htmlentitiesDecodeUTF8(pSQL($this->description[$language['id_lang']], true)) : ''; foreach ($fieldsArray as $field) { if (!Validate::isTableOrIdentifier($field)) die(Tools::displayError()); /* Check fields validity */ if (isset($this->{$field}[$language['id_lang']]) AND !empty($this->{$field}[$language['id_lang']])) $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]); elseif (in_array($field, $this->fieldsRequiredLang)) $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]); else $fields[$language['id_lang']][$field] = ''; } } return $fields; } } Very nice and helpful. Link to comment Share on other sites More sharing options...
dr7tbien Posted May 11, 2012 Share Posted May 11, 2012 hi, I've PRESTASHOP 1.4.7.0 and when I've inserted HTML tags PS convert the html tags in HTML Special chars in the frontend. For example If I insert the tag <p> it is converted to <p> Something is wrong in my code.... Anybody can help me? Link to comment Share on other sites More sharing options...
eugenata Posted August 7, 2012 Share Posted August 7, 2012 create a file called Category.php and put it in the /override/classes folder, and add this content to it. This works for v1.4.0.17, and may need to be revised slightly for future versions, i have not tried it yet on v1.4.1 or greater. <?php class Category extends CategoryCore { public function getTranslationsFieldsChild() { self::validateFieldsLang(); $fieldsArray = array('name', 'link_rewrite', 'meta_title', 'meta_keywords', 'meta_description'); $fields = array(); $languages = Language::getLanguages(); $defaultLanguage = Configuration::get('PS_LANG_DEFAULT'); foreach ($languages as $language) { $fields[$language['id_lang']]['id_lang'] = $language['id_lang']; $fields[$language['id_lang']][$this->identifier] = intval($this->id); $fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']])) ? Tools::htmlentitiesDecodeUTF8(pSQL($this->description[$language['id_lang']], true)) : ''; foreach ($fieldsArray as $field) { if (!Validate::isTableOrIdentifier($field)) die(Tools::displayError()); /* Check fields validity */ if (isset($this->{$field}[$language['id_lang']]) AND !empty($this->{$field}[$language['id_lang']])) $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]); elseif (in_array($field, $this->fieldsRequiredLang)) $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]); else $fields[$language['id_lang']][$field] = ''; } } return $fields; } } With this code, I get an error when I save the description: An error occurred while updating object. category () Ps 1.4.8.2. Some help? Link to comment Share on other sites More sharing options...
benjamin utterback Posted August 7, 2012 Share Posted August 7, 2012 I really am not sure if the solution is going to work the exact same way as the older cold.That version is over a year old. I suggest creating a new thread if you could. That way you will receive relevant information. Link to comment Share on other sites More sharing options...
eugenata Posted August 7, 2012 Share Posted August 7, 2012 @Benjamin Utterback, thanks for your post. However, my problem appears only with the standard categories of Ps. With new categories created by me works well. This is due to encoding .. I think. Link to comment Share on other sites More sharing options...
diggerd Posted September 3, 2012 Share Posted September 3, 2012 Hi all, I have been using this mod for several weeks on my local host and all was working fine. Since I have uploaded my site to the web, it no longer works. The editor and everything seems to wok fine and I can format the description, but when I save the formatted description, all the HTML formatting appears to get stripped during that process. Tried going through the whole process to set it up again but cannot seem to get it working on the live site. I have been using version 1.4.8.2 Link to comment Share on other sites More sharing options...
quimetal Posted December 13, 2012 Share Posted December 13, 2012 I tried the code Bellini13 in Prestashop version 1.5.2 and it works perfectly. Now the category descriptions may contain html tags and I can format the text. thank you very much for the contribution bellini13! Link to comment Share on other sites More sharing options...
CamillaVA Posted January 23, 2013 Share Posted January 23, 2013 I tried the code Bellini13 in Prestashop version 1.5.2 and it works perfectly. Now the category descriptions may contain html tags and I can format the text. thank you very much for the contribution bellini13! Do you have problem with "Read more" button in your category description? If my description is too long a "read more"-button will be displayed... Really annoying. Do you know have to modify this? Link to comment Share on other sites More sharing options...
CamillaVA Posted January 23, 2013 Share Posted January 23, 2013 I found a solution for my problem with the "read more"-buttons. If any would like to see http://www.prestashop.com/forums/topic/193218-how-to-remove-the-more-to-see-more-text-for-the-categories-description/ Have a nice day! Link to comment Share on other sites More sharing options...
bajcicak Posted February 24, 2013 Share Posted February 24, 2013 Thanks to all. I have PS 1.4.3. and 1.4.7 and I have no problem after changes. Link to comment Share on other sites More sharing options...
Recommended Posts