php - opencart - get parent category name/id on a sub-category page? New -
okay, i've been asked repost moderator deemed 'new' question thread: opencart - parent category name/id on sub-category page
i believe valid question related title have posted here in compliance. appreciated:
being newbie concept i'm struggling interpret logic within original thread [above] when applying particular scenario; i'm trying display displayed category's parent category name. in category.php i've included line $categories = explode('_', $this->request->get['path']);
having difficulty in displaying parent category name. i'm unclear correct variable name use in category.tpl display this. please advise? thanks.
find (catalog/controller/product/category.php) around line 95
if ($category_info) {
add inside
if($category_info['parent_id'] != 0){ $this->data['parent_cat_info'] = $this->model_catalog_category->getcategory($category_info['parent_id']); }
now in template file (/catalog/view/theme/default/template/product/category.tpl) can access properties of array $parent_cat_info
e.g category name echo $parent_cat_info['name']
Comments
Post a Comment