Category in featured module
Posted: Sun Jul 07, 2019 6:02 am
How to get the categories list in the featured module in OC 2.3.0.2?
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
Code: Select all
$this->load->model('catalog/product');
Code: Select all
$this->load->model('catalog/category');
Code: Select all
$product_info = $this->model_catalog_product->getProduct($product_id);
Code: Select all
$category = $this->model_catalog_product->getCategories($product_id);
if ($category) {
$category_array = $this->model_catalog_category->getCategory(end($category)['category_id']);
}
Code: Select all
'name' => $product_info['name'],
Code: Select all
'category' => $category_array['name'],
Code: Select all
<div class="caption">
Code: Select all
<p><?php echo $product['category']; ?></p>