catalog/controller/module/category.php
ищем:
if (isset($parts[1]))
{$this->data['child_id'] = $parts[1];}
else { $this->data['child_id'] = 0;}
после вставляем:
if (isset($parts[2]))
{ $this->data['sisters_id'] = $parts[2]; }
else {$this->data['sisters_id'] = 0; }
заменяем
foreach ($categories as $category) {
$children_data = array();
$children = $this->model_catalog_category->getCategories($category['category_id']);
foreach ($children as $child) {
$data = array(
'filter_category_id' => $child['category_id'],
'filter_sub_category' => true
);
$product_total = $this->model_catalog_product->getTotalProducts($data);
$children_data[] = array(
'category_id' => $child['category_id'],
'name' => $child['name'] . ' (' . $product_total . ')',
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
$data = array(
'filter_category_id' => $category['category_id'],
'filter_sub_category' => true
);
$product_total = $this->model_catalog_product->getTotalProducts($data);
$this->data['categories'][] = array(
'category_id' => $category['category_id'],
'name' => $category['name'] . ' (' . $product_total . ')',
'children' => $children_data,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
);
}
на:
foreach ($categories as $category) {
$children_data = array();
$children = $this->model_catalog_category->getCategories($category['category_id']);
foreach ($children as $child) {
$sister_data = array();
$sisters = $this->model_catalog_category->getCategories($child['category_id']);
if(count($sisters) > 1) {
foreach ($sisters as $sisterMember) {
$sister_data[] = array(
'category_id' =>$sisterMember['category_id'],
'name' => $sisterMember['name'],
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']. '_' . $sisterMember['category_id'])
);
}
$children_data[] = array(
'category_id' => $child['category_id'],
'sister_id' => $sister_data,
'name' => $child['name'],
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}else{
$children_data[] = array(
'category_id' => $child['category_id'],
'sister_id' =>'',
'name' => $child['name'],
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
}
$data = array(
'filter_category_id' => $category['category_id'],
'filter_sub_category' => true
);
$product_total = $this->model_catalog_product->getTotalProducts($data);
$this->data['categories'][] = array(
'category_id' => $category['category_id'],
'name' => $category['name'],
'children' => $children_data,
'sister' => $sister_data,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
);
}
cataloge/view/theme/ ваша тема /template/module/category.tpl
после
<?php foreach ($category['children'] as $child) { ?>
<li>
<?php if ($child['category_id'] == $child_id) { ?>
<a href="/<?php echo $child['href']; ?>"> - <?php echo $child['name']; ?></a>
<?php } else { ?>
<a href="/<?php echo $child['href']; ?>"> - <?php echo $child['name']; ?></a>
<?php } ?>
добавляем:
<?php if($child['sister_id']){ ?>
<ul>
<?php foreach($child['sister_id'] as $sisters) { ?>
<li>
<?php if ($sisters['category_id'] == $sisters_id) { ?>
<a href="/<?php echo $sisters['href']; ?>" class="active"> - <?php echo $sisters['name']; ?></a>
<?php } else { ?>
<a href="/<?php echo $sisters['href']; ?>"> - <?php echo $sisters['name']; ?></a>
<?php } ?>
</li>
<?php } ?>
</ul>
<?php } ?>
catalog/view/theme/ваша тема /stylesheet/stylesheet.css
после
.box-category > ul > li ul > li > a.active + ul {
добавить:
.box-category > ul > li ul > li ul > li a.active {
font-weight: bold;
color: #06bcc3;
}
.box-category > ul > li ul > li ul > li a.active + ul {
display: block;
}