G
G
GoldSlide2020-07-13 10:51:41
opencart
GoldSlide, 2020-07-13 10:51:41

How to get category id on opencart 2 product page?

I need to get the id of the parent category on the opencart 2 product page, as soon as I tried it did not work, any advice?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2020-07-13
@GoldSlide

Nothing complicated:
catalog\controller\product\product.php
After the line

$category_info = $this->model_catalog_category->getCategory($category_id);

Add a line And output in the template
$data['category_id'] = $category_id;
<?php echo $category_id; ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question