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'];
}
?>
1 comment:
This code is not working.It says " Undefined property: Loader::$model_catalog_product"
Post a Comment