Showing posts with label opencart - How to get the category title by product id. Show all posts
Showing posts with label opencart - How to get the category title by product id. Show all posts

Tuesday, 29 July 2014

Get category name by product id opencart


Get category name by product id opencart

Put below code in your product.tpl file

<?php
$category = $this->model_catalog_product->getCategories($product_id);
if ($category){
  $category_array = $this->model_catalog_category->getCategory($category[0]['category_id']);
  echo $category_array['name'];
}
?>