如何从下拉组件下的opencart菜单中删除/隐藏子类别。 网站网址:http://cart.kashmosoft.com/
答案 0 :(得分:1)
您可以通过该选项隐藏顶级菜单中的父类别。转到类别>修改类别>数据选项卡,您将看到下图。
但是上面的选项仅适用于父类别,并且适用于像监视器这样的子类别,请按照以下步骤操作:
转到文件/catalog/controller/common/header.php 搜索字词“top”,您会注意到1次出现以及代码写入以下。
foreach ($categories as $category) {
if ($category['top']) {
//...... some code written
}
}
您已编辑此代码块,如下所示
foreach ($categories as $category) {
if ($category['top']) {
//...... some code written
foreach ($children as $child) {
if ($child['top']) { // **YOU HAVE TO ADD IF CONDITION**
$filter_data = array(
'filter_category_id' => $child['category_id'],
'filter_sub_category' => true
);
$children_data[] = array(
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
}
}
//...some extra code written
}
}
并为每个类别标记了顶部,但没有为监视器标记。