我正在编辑 2.0.x 打开购物车的模板,发现顶部的菜单 - 仅显示第二个子类别.. 我一直在查找控制器文件、模板文件,以便根据需要进行编辑 - 显示左侧导航中的子类别再多一级(或所有级别..只要我能获得更深层次的子子猫..)---几个星期..找不到路。
头文件.tpl
<ul>
<?php foreach ($categories as $category_1) { ?>
<li class="sub-menu"><a href="<?php echo $category_1['href']; ?>"><div><?php echo $category_1['name']; ?></div></a>
<?php if ($category_1['children']) { ?>
<div class="mega-menu-content style-2 col-4 clearfix">
<?php foreach($category_1['children'] as $category_2) { ?>
<ul id="m2">
<li class="mega-menu-title"><a href="<?php echo $category_2['href']; ?>"><div><?php echo $category_2['name']; ?></div></a>
<?php if ($category_2['children']) { ?>
<ul id="m3">
<?php foreach($category_2['children'] as $category_3) { ?>
<li><a href="<?php echo $category_3['href']; ?>"><div><?php echo $category_3['name']; ?></div></a></li>
<?php } ?>
</ul>
<?php } ?>
</li>
</ul>
<?php } ?>
</div>
<?php } ?>
</li><!-- .mega-menu end -->
<?php } ?>
</ul>
控制器 - header.php //下面是为了启用第 3 级子类别而编写的
$categories_1 = $this->model_catalog_category->getCategories(0);
foreach ($categories_1 as $category_1) {
$level_2_data = array();
$categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']);
foreach ($categories_2 as $category_2) {
$level_3_data = array();
$categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']);
foreach ($categories_3 as $category_3) {
$level_3_data[] = array(
'name' => $category_3['name'],
'column' => $category_3['column'] ? $category_3['column'] : 1,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'])
);
}
$level_2_data[] = array(
'name' => $category_2['name'],
'children' => $level_3_data,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'])
);
}
$this->data['categories'][] = array(
'name' => $category_1['name'],
'children' => $level_2_data,
'column' => $category_1['column'] ? $category_1['column'] : 1,
'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'])
);
}
// End of the written addition
有人可以帮忙吗?