Пробую так:
в catalog/controller/common.menu.php
<?php
class ControllerCommonMenu extends Controller {
public function index() {
$this->load->language('common/menu');
// Menu
$this->load->model('catalog/category');
$this->load->model('catalog/product');
$data['categories'] = array();
$categories = $this->model_catalog_category->getCategories(0);
foreach ($categories as $category) {
if ($category['top']) {
// Level 2
$children_data = array();
$children = $this->model_catalog_category->getCategories($category['category_id']);
foreach ($children as $child) {
$filter_data = array(
'filter_category_id' => $child['category_id'],
'filter_sub_category' => true
);
if ($child['image']) {
$child_thumb = $this->model_tool_image->resize($child['image'], 50, 50);
} else {
$child_thumb = '';
}
$children_data[] = array(
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'thumb' => $child_thumb,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
// Level 1
if ($category['image']) {
$category_thumb = $this->model_tool_image->resize($category['image'], 50, 50);
} else {
$category_thumb = '';
}
$data['categories'][] = array(
'name' => $category['name'],
'children' => $children_data,
'thumb' => $category_thumb,
'column' => $category['column'] ? $category['column'] : 1,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
);
}
}
return $this->load->view('common/menu', $data);
}
}
дальше в menu.twig добавил но не вывелась картинка категории. Что делаю не так?
<img src="{{ category.thumb }}" alt="">