Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

prox3000

Newbie
  
  • Posts

    2
  • Joined

  • Last visited

Everything posted by prox3000

  1. $data['categories'] = array(); $categories = $this->model_catalog_category->getCategories(0); foreach ($categories as $category) { $children_data = array(); $children = $this->model_catalog_category->getCategories($category['category_id']); foreach($children as $child) { //new $children_data2 = array(); $children2 = $this->model_catalog_category->getCategories($child['category_id']); foreach($children2 as $child2) { $filter_data2 = array('filter_category_id' => $child2['category_id'], 'filter_sub_category' => true); $children_data2[] = array( 'category_id' => $child2['category_id'], 'name' => $child2['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data2) . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'] . '_' . $child2['category_id']) ); } //new $filter_data = array('filter_category_id' => $child['category_id'], 'filter_sub_category' => true); $children_data[] = array( 'category_id' => $child['category_id'], 'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'children' => $children_data2, //new 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']) ); } $filter_data = array( 'filter_category_id' => $category['category_id'], 'filter_sub_category' => true ); $data['categories'][] = array( 'category_id' => $category['category_id'], 'name' => $category['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''), 'children' => $children_data, 'href' => $this->url->link('product/category', 'path=' . $category['category_id']) ); } Ну и вывод тоже пересмотрите
  2. Навішо ти робиш if ($category['category_id'] == $data['category_id']) { А також if ($child['category_id'] == $data['category_id']) { це перша помилка. також краще скласти у підкатегорії
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.