Post by Alaque123 » Fri Jun 26, 2020 4:25 pm

I want to show the category field in the products listed in the admin panel, I checked the controller and model files but unfortunately I couldn't

Image

Newbie

Posts

Joined
Tue Feb 04, 2020 8:33 am

Post by netruxa » Sat Jun 27, 2020 1:48 pm

hi
1. in /admin/controller/catalog/product.php insert after
protected function getList() {
this code
$this->load->model('catalog/category');
$filter_data = array(
'sort' => 'name',
'order' => 'ASC'
);
$data['categories'] = $this->model_catalog_category->getCategories($filter_data);


and replace line
$data['products'][] = array(
to
$category = $this->model_catalog_product->getProductCategories($result['product_id']);
$data['products'][] = array('category' => $category,


2. in /admin/view/template/catalog/product_list.tpl insert after
<td class="text-left"><?php echo $product['model']; ?></td>
this code
<td class="text-left">
<?php foreach ($categories as $category) { ?>
<?php if (in_array($category['category_id'], $product['category'])) { ?>
<?php echo $category['name'];?><br>
<?php } ?>
<?php } ?></td>

User avatar
New member

Posts

Joined
Fri Dec 16, 2016 1:34 pm

Who is online

Users browsing this forum: No registered users and 33 guests