<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Prestashop Brisbane Web Design, Silverstripe osCommerce File Browser, Javascript, PHP, Web Development &#187; Miscellaneous</title>
	<atom:link href="http://www.jellygnite.com.au/blog/index.php/category/miscellaneous/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jellygnite.com.au/blog</link>
	<description>Web design advice on Prestashop, Silverstripe, osCommerce, javascript, PHP, web techniques</description>
	<lastBuildDate>Mon, 12 Dec 2011 04:11:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Prestashop display HTML in category description</title>
		<link>http://www.jellygnite.com.au/blog/index.php/archive/prestashop-display-html-in-category-description/</link>
		<comments>http://www.jellygnite.com.au/blog/index.php/archive/prestashop-display-html-in-category-description/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 04:42:49 +0000</pubDate>
		<dc:creator>Jim Chisholm</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.jellygnite.com.au/blog/?p=19</guid>
		<description><![CDATA[NOTE: This post has an updated version for Prestashop 1.4. 
When you enter a category into Prestashop you have the ability to enter a description. This only allows text though &#8211; no HTML.
Find out how to display HTML in Prestashop&#8217;s category description&#8230;
	
You need to make some changes to Prestashop&#8217;s core code so please be advised [...]]]></description>
			<content:encoded><![CDATA[<h3>NOTE: <a href="/blog/index.php/archive/update-display-html-in-prestashop-category-description-v-1-4/">This post has an updated version for Prestashop 1.4.</a> </h3>
<p>When you enter a category into Prestashop you have the ability to enter a description. This only allows text though &#8211; no HTML.</p>
<p>Find out how to display HTML in Prestashop&#8217;s category description&#8230;</p>
<p>	<span id="more-19"></span></p>
<p>You need to make some changes to Prestashop&#8217;s core code so please be advised any future upgrades may overwrite your changes. Backup all files before beginning!	</p>
<p>These changes have been tested with Prestashop version 1.3	</p>
<h3><strong>1. [admin folder]/tabs/AdminCategories.php</strong></h3>
<p>First we need to add <em>class=&#8221;rte&#8221;</em> to the text area as well as load the <span class="html">tinyMCE</span> script on the edit category page in the admin area. </p>
<p>Approx line 212,</p>
<p>	replace </p>
<pre class="html" name="code">&lt;textarea cols="40" rows="10" id="description_'.$language['id_lang'].'" name="description_'.$language['id_lang'].'"&gt;'.htmlentities(stripslashes($this-&gt;getFieldValue($obj, 'description', intval($language['id_lang']))), ENT_COMPAT, 'UTF-8').'&lt;/textarea&gt;</pre>
<p>with</p>
<pre class="html" name="code">&lt;textarea class="rte" cols="40" rows="10" id="description_'.$language['id_lang'].'" name="description_'.$language['id_lang'].'"&gt;'.htmlentities(stripslashes($this-&gt;getFieldValue($obj, 'description', intval($language['id_lang']))), ENT_COMPAT, 'UTF-8').'&lt;/textarea&gt;
&lt;script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/jquery.tinymce.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  function tinyMCEInit(element)
  {
   $().ready(function() {
    $(element).tinymce({
     // Location of TinyMCE script
     script_url : \''.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/tiny_mce.js\',
     // General options
     theme : "advanced",
     plugins : "safari,pagebreak,style,layer,table,advimage,advlink,inlinepopups,media,searchreplace,contextmenu,paste,directionality,fullscreen",
     // Theme options
     theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
     theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,,|,forecolor,backcolor",
     theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,|,ltr,rtl,|,fullscreen",
     theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,pagebreak",
     theme_advanced_toolbar_location : "top",
     theme_advanced_toolbar_align : "left",
     theme_advanced_statusbar_location : "bottom",
     theme_advanced_resizing : false,
     content_css : "'.__PS_BASE_URI__.'themes/'._THEME_NAME_.'/css/global.css",
     width: "582",
     height: "auto",
     font_size_style_values : "8pt, 10pt, 12pt, 14pt, 18pt, 24pt, 36pt",
     // Drop lists for link/image/media/template dialogs
     template_external_list_url : "lists/template_list.js",
     external_link_list_url : "lists/link_list.js",
     external_image_list_url : "lists/image_list.js",
     media_external_list_url : "lists/media_list.js",
     elements : "nourlconvert",
     convert_urls : false,
     language : "'.(file_exists(_PS_ROOT_DIR_.'/js/tinymce/jscripts/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en').'"
    });
   });
  }
  tinyMCEInit(\'textarea.rte\');
  &lt;/script&gt;</pre>
<h3><strong>2. classes/Category.php</strong></h3>
<p><strong>Now we change the field type of description:</strong> <em>&#8216;description&#8217; =&gt; &#8216;isCleanHtml&#8217;</em> becomes <em>&#8216;description&#8217; =&gt; &#8216;isString&#8217;</em></p>
<p>Approx. line 65, replace</p>
<pre class="html" name="code">protected 	$fieldsValidateLang = array('name' =&gt; 'isCatalogName', 'link_rewrite' =&gt; 'isLinkRewrite', 'description' =&gt; 'isCleanHtml',
'meta_title' =&gt; 'isGenericName', 'meta_description' =&gt; 'isGenericName', 'meta_keywords' =&gt; 'isGenericName');</pre>
<p>with</p>
<pre class="html" name="code">protected 	$fieldsValidateLang = array('name' =&gt; 'isCatalogName', 'link_rewrite' =&gt; 'isLinkRewrite', 'description' =&gt; 'isString',
'meta_title' =&gt; 'isGenericName', 'meta_description' =&gt; 'isGenericName', 'meta_keywords' =&gt; 'isGenericName');</pre>
<h3><strong>3. classes/ObjectModel.php </strong></h3>
<p>Approx. line 295, replace </p>
<pre class="html" name="code">if (isset($this-&gt;{$field}[$language['id_lang']]) AND !Tools::isEmpty($this-&gt;{$field}[$language['id_lang']]))
$fields[$language['id_lang']][$field] = pSQL($this-&gt;{$field}[$language['id_lang']]);
elseif (in_array($field, $this-&gt;fieldsRequiredLang))
$fields[$language['id_lang']][$field] = pSQL($this-&gt;{$field}[$defaultLanguage]);
else
$fields[$language['id_lang']][$field] = '';</pre>
<p>with</p>
<pre class="html" name="code">if (isset($this-&gt;{$field}[$language['id_lang']]) AND !Tools::isEmpty($this-&gt;{$field}[$language['id_lang']])) {
if(isset($this-&gt;fieldsValidateLang[$field]) &amp;&amp; $this-&gt;fieldsValidateLang[$field]=='isString'){
$fields[$language['id_lang']][$field] = pSQL($this-&gt;{$field}[$language['id_lang']],'true');
}else{
$fields[$language['id_lang']][$field] = pSQL($this-&gt;{$field}[$language['id_lang']]);
}
}
elseif (in_array($field, $this-&gt;fieldsRequiredLang))
$fields[$language['id_lang']][$field] = pSQL($this-&gt;{$field}[$defaultLanguage]);
else
$fields[$language['id_lang']][$field] = '';</pre>
<h3><strong>4. category.php </strong></h3>
<p>Lastly make sure we get rid of carriage returns being converted in to breaks when displaying the description. </p>
<p>Approx. line 49, replace </p>
<pre class="html" name="code">$category-&gt;description = nl2br2($category-&gt;description);</pre>
<p>with</p>
<pre class="html" name="code">$category-&gt;description = ($category-&gt;description); </pre>
<p>Thats all there is to it. If you notice any bugs or problems please drop me an email or comment. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jellygnite.com.au/blog/index.php/archive/prestashop-display-html-in-category-description/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

