2017-07-15 73 views

回答

1

有一個選項,您可以通過它從頂層菜單隱藏父類別。轉到類別>編輯類別>數據選項卡,您將看到下面的圖像。

top

但上面的選項將僅用於父類的工作,並使其兒童類別,如顯示器工作遵循以下步驟:

轉到文件/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 
     } 
} 

並做標記頂部爲每個類別而不是顯示器。