контроллер
перед
$this->load->model('catalog/category');
вставляем
if (isset($parts[2])) {
$data['child_lv3_id'] = $parts[2];
} else {
$data['child_lv3_id'] = 0;
}
дальше после
foreach($children as $child) {
вставляем
$children_lv3_data = array();
if ($child['category_id'] == $data['child_id']) {
$children_lv3 = $this->model_catalog_category->getCategories($child['category_id']);
foreach ($children_lv3 as $child_lv3) {
$filter_data_lv3 = array(
'filter_category_id' => $child_lv3['category_id'],
'filter_sub_category' => true
);
$children_lv3_data[] = array(
'category_id' => $child_lv3['category_id'],
'name' => $child_lv3['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data_lv3) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'] . '_' . $child_lv3['category_id'])
);
}
}
дальше после
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : '')
пишем
'children_lv3' => $children_lv3_data,
и в шаблоне вот это
<?php foreach ($children as $child) { ?>
<li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
<?php } ?>
заменяем на что-нибудь вроде
<?php foreach ($children as $child) { ?>
<?php if ($child['children_lv3']) { ?>
<li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
<ul>
<?php foreach ($child['children_lv3'] as $child_lv3) { ?>
<li><a href="<?php echo $child_lv3['href']; ?>"><?php echo $child_lv3['name']; ?></a></li>
<?php } ?>
</ul>
<?php } esle { ?>
<li><a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li>
<?php } ?>
<?php } ?>