Showing posts with label How to get category name with product id Opencart. Show all posts
Showing posts with label How to get category name with product id Opencart. 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'];
}
?>