Если Вам требуется вывод категорий третьего уровня в горизонтальном меню системы управления OPencart 2.3 без сторонних расширений, сделайте правки в дефолтном шаблоне Opencart:
код в файле /catalog/controller/common/header.php
$children_data[] = array( 'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']) ); }
меняем на
// 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 ); //level 3 $subchildren_data = array(); $subchildren = $this->model_catalog_category->getCategories($child['category_id']); foreach ($subchildren as $subchild) { $filter_data = array( 'filter_category_id' => $subchild['category_id'], 'filter_sub_category' => true ); $subchildren_data[] = array( 'name' => $subchild['name'] . ($this->config->get('config_product_count') ? ' <span class="menu_summ">' . $this->model_catalog_product->getTotalProducts($filter_data) . '</span>' : ''), 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']. '_' . $subchild['category_id']), ); } $children_data[] = array( 'name' => $child['name'] . ($this->config->get('config_product_count') ? ' <span class="menu_summ">' . $this->model_catalog_product->getTotalProducts($filter_data) . '</span>' : ''), 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']), 'subchildren' => $subchildren_data ); } // Level 1 $data['categories'][] = array( 'name' => $category['name'], 'children' => $children_data, 'column' => $category['column'] ? $category['column'] : 1, 'href' => $this->url->link('product/category', 'path=' . $category['category_id']) ); } }
В файле /catalog/view/theme/default/template/common/header.tpl
после кода
<li><a href="/<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
добавить
<?php if($child['subchildren']) { ?> <ul class="list-unstyled"> <?php foreach ($child['subchildren'] as $subchild) { ?> <li><a class="pull-left" href="/<?php echo $subchild['href']; ?>"><?php echo $subchild['name']; ?></a></li> <?php } ?> </ul> <?php } ?>