Category Description In Appearance Types

Ive started this topic because the previous one at Category Descriptions for Multicolumns - Hints & Modifications - CS-Cart Forums is now locked (?).

The above link briefly explains how to make new template file for an Appearance types (categories blocks)

This template worked fine but for ONE thing.

I needed to display the Description data for each Category


Ive worked it out if anyone is interested:

  1. in your template use:

		{assign var="cat_description" value=$category.category_id|fn_get_category_desc|default:""}<br />
```<br />
To display the Category Description<br />
<br />
And make these ADDITIONS  to: /core/ fn.catalog.php just after the similar<br />
//    Get category name by its id   <br />
block of script<br />
<br />
//<br />
//    Get category description by its id   <br />
//    Mod by remoteONE to return the Category Description from the database. <br />
//    This seems to work<br />
<br />
 function fn_get_category_desc($category_id = 0, $lang_code = CART_LANGUAGE, $as_array = false)<br />
 {<br />
 	if (!empty($category_id)) {<br />
 		if (!is_array($category_id) && strpos($category_id, ',') !== false) {<br />
 			$category_id = explode(',', $category_id);<br />
 		}<br />
 		if (is_array($category_id) || $as_array == true) {<br />
 			return db_get_hash_single_array("SELECT category_id, description FROM ?:category_descriptions WHERE category_id IN (?n) AND lang_code = ?s", array('category_id', 'description'), $category_id, $lang_code);<br />
 		} else {<br />
 			return db_get_field("SELECT description FROM ?:category_descriptions WHERE category_id = ?i AND lang_code = ?s", $category_id, $lang_code);<br />
 		}<br />
 	}<br />
 <br />
 	return false;<br />
 }<br />

```<br />
<br />
No guarantees, but it seems to work for me, would love to hear if there are any errors in my mod.

Not working in CS-CART 4.0.3 :-(

[quote name=‘torbik’ timestamp=‘1387406891’ post=‘173738’]

Not working in CS-CART 4.0.3 :-(


Sorry, all ok. It’s working on 4.0.3!!! Thanx!

I used this one ,It Works

Thanq So much…

You dont really want to edit core files, instead place in app/addons/my_changes/func.php the function and will work fine.

Works also in version 4.6.2

Thanks remoteone & hostandname