Yes, you can. I checked my code in OpenCart 1.5.1.x
First you must modify the /catalog/controller/product/product.php file to add after line 94: $ product_info = $ this-> model_catalog_product-> getProduct ($ product_id);
ADD this:
$categories = $this->model_catalog_product->getCategories($product_info['product_id']); if ($categories){ $categories_info = $this->model_catalog_category->getCategory($categories[0]['category_id']); $this->data['category_id'] = $categories_info['category_id']; }
Then you can use the variable <?php echo $category_id ?> In your template file (product.tpl).
Hope this help helps you.
jomachi
source share