Get category name from category id for any category

Can somebody let me know, how to get category name from category_id, for any category ?



Thanks in advance

Hi,

http://yourstoresite.com/admin.php?dispatch=categories.update&category_id=306



You can locate your website url like this to see what is the name of your category for given id.



If you do this with coding you must connect your db and select-join some tables.

with phpmyadmin or writing php codes, you can use this.



SELECT *

FROM cscart_categories AS a

RIGHT JOIN cscart_category_descriptions AS b ON a.category_id = b.category_id

WHERE a.category_id =306 limit 1;



you can use select b.category from … for selecting only category name.



I hope this helps.

Regards.

apps/functions/fn.catalog.php



=> fn_get_category_name



in smarty tpl file you can use like: {ID|fn_get_category_name}

Can somebody let me know, how to get category url from id ?



Isn't there any function for this, just like “fn_get_category_name” ?



Vivek

{“category.view&category_id=123”|fn_url}

{"category.view&category_id=123"|fn_url}

if i used this {"category.view?category_id=`$product.main_category`"|fn_url}, i got /index.php?dispatch=category.view&category_id=1163 and page not found =/ can u help me with this?

if i used this {"category.view?category_id=`$product.main_category`"|fn_url}, i got /index.php?dispatch=category.view&category_id=1163 and page not found =/ can u help me with this?

Hello!

Please try categories instead of category.

Please use

{"categories.view?category_id=`$product.main_category`"|fn_url}

if i used this {"category.view?category_id=`$product.main_category`"|fn_url}, i got /index.php?dispatch=category.view&category_id=1163 and page not found =/ can u help me with this?

My error, should have been 'categories'.

Thanks u all!

My bad, i should notice this =\

You are welcome! :)