1
爲2.0.x打開購物車編輯模板,並發現菜單一個頂端 - 只顯示第二個子類別.. 和我一直在查找控制器文件,模板文件,按照我的意願進行編輯 - 只顯示左側導航的子類別的另一個級別(或所有級別..只要我可以獲得更深層次的子級子目錄..)幾個星期......並找不到方法。在opencart 2中獲得第三級類別
header.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 //下面寫啓用第三級子類別
$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
誰能幫助這一點嗎?