Category name on featured product line
Posted: Fri Dec 02, 2016 12:27 am
Hello. I have line of four featured products. how to display, what are the categories on this products?
Thanks for help.
Thanks for help.
OpenCart Community Forum - Discuss shopping cart and e-commerce solutions.
https://forum.opencart.com/
Code: Select all
$category_list= $this->model_catalog_product->getCategories($product_id);
Code: Select all
$this->load->model('catalog/category');
Code: Select all
$category_info = [];
foreach ($category_list as $single) {
$category_info[] = $this->model_catalog_category->getCategory($single['cateogry_id']);
}
Code: Select all
$data['products'][] = array(
'product_id' => $product_info['product_id'],
'thumb' => $image,
'name' => $product_info['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'rating' => $rating,
'category' => $category_info,
'href' => $this->url->link('product/product', 'product_id=' . $product_info['product_id'])
);