Hello. I have line of four featured products. how to display, what are the categories on this products?
Thanks for help.
It won't be easy if you don't know programming. I am just giving summery what to do. You need to modify two files.
1. Controller: catalog/controller/extension/featured.php
Since a product belongs to more than one categories, it will give an array of categories list. Now you can find categories details by using category model. For using category mode, first load it by placing following code where product model is loaded.
Now following code will give your category details list from above category ID list
Assign this array into featured product list like:
Now in template file: catalog/view/theme/YOUR_THEME/templates/extensions/module/featured.tpl, you will have to iterate category array for each product whatever you to place.
Better you can take professional support. Good luck!
1. Controller: catalog/controller/extension/featured.php
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'])
);
Now in template file: catalog/view/theme/YOUR_THEME/templates/extensions/module/featured.tpl, you will have to iterate category array for each product whatever you to place.
Better you can take professional support. Good luck!
XForm - Opencart Form Builder
Xshippingpro - An advanced Shipping Module
Need Professional support? Skype: opencartmart
Who is online
Users browsing this forum: No registered users and 59 guests