Showing posts with label Get Category Info from Product ID Opencart. Show all posts
Showing posts with label Get Category Info from 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'];
}
?>