Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Category Description In Appearance Types Rate Topic   - - - - -

 
  • remoteone
  • Member
  • Members
  • Join Date: 06-Oct 09
  • 749 posts

Posted 21 June 2011 - 12:54 AM #1

Ive started this topic because the previous one at http://forum.cs-cart...__1#entry115208 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
EDIT:
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:""}
		{$cat_description}
To display the Category Description

And make these ADDITIONS to: /core/ fn.catalog.php just after the similar
// Get category name by its id
block of script

//
//    Get category description by its id   
//    Mod by remoteONE to return the Category Description from the database. 
//    This seems to work

 function fn_get_category_desc($category_id = 0, $lang_code = CART_LANGUAGE, $as_array = false)
 {
 	if (!empty($category_id)) {
 		if (!is_array($category_id) && strpos($category_id, ',') !== false) {
 			$category_id = explode(',', $category_id);
 		}
 		if (is_array($category_id) || $as_array == true) {
 			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);
 		} else {
 			return db_get_field("SELECT description FROM ?:category_descriptions WHERE category_id = ?i AND lang_code = ?s", $category_id, $lang_code);
 		}
 	}
 
 	return false;
 }

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

 
  • torbik
  • Newbie
  • Members
  • Join Date: 17-Oct 13
  • 1 posts

Posted 18 December 2013 - 10:48 PM #2

Not working in CS-CART 4.0.3 :-(

 
  • torbikua
  • Newbie
  • Members
  • Join Date: 12-Nov 13
  • 2 posts

Posted 08 January 2014 - 11:56 AM #3

Not working in CS-CART 4.0.3 :-(


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

 
  • Nitya
  • Newbie
  • Trial users
  • Join Date: 03-Jan 13
  • 4 posts

Posted 13 September 2014 - 09:47 AM #4

I used this one ,It Works


Thanq So much...

 
  • hostandname
  • Senior Member
  • Members
  • Join Date: 05-Jan 06
  • 196 posts

Posted 31 July 2015 - 12:06 PM #5

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

Host & Name Ltd - your reliable & trustworthy media provider (www.hostandname.co.uk)
Approved CS-Cart Developers and Official CS-Cart Licensing Supplier
Web Hosting | Cloud Hosting | Dedicated Servers | VPS | Domains | Emails | Design | Development | Marketing | Management


 
  • altechnics
  • Newbie
  • Members
  • Join Date: 21-May 12
  • 8 posts

Posted 11 September 2017 - 07:37 PM #6

Works also in version 4.6.2

 

Thanks remoteone & hostandname