2017-02-19 1 views
0

http://imgur.com/a/ZnuvvOpencart 2.3.0.2 sous-catégories charger les pouces de leurs parents. Comment réparer?

Chaque catégorie et sous-catégorie a une image. En mettant un pouce dans le menu déroulant, les sous-groupes chargent leurs parents. Le catalogue/contrôleur/common/header.php:

if ($category['top']) { 
      // Level 2 
      $children_data = array(); 
      $children = $this->model_catalog_category->getCategories($category['category_id']); 
      foreach ($children as $child) { 
       $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']) 
       ); 
      } 
      // Level 1 
      $this->load->model('tool/image'); 
      $image = empty($category['image']) ? 'no_image.png' : $category['image']; 
      $thumb = $this->model_tool_image->resize($image, 100, 100); 

      $data['categories'][] = array(
      'name'  => $category['name'], 
      'children' => $children_data, 
      'column' => $category['column'] ? $category['column'] : 1, 
      'thumb' => $thumb, 
      'href'  => $this->url->link('product/category', 'path=' . $category['category_id']) 
     ); 
     } 

Et voici mon catalogue/view/thème/default/template/common/header.tpl:

<ul class="list-unstyled"> 
      <?php foreach ($children as $child) { ?> 
      <li><a href="<?php echo $child['href']; ?>"><img src="<?php echo $category['thumb']?>" alt="<?php echo $child['name']; ?>"/> 
      <a src="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a></li> 
      <?php } ?> 
      </ul> 

Toute idée pourrait être la cause de cela?

Répondre

0

appelé

$category['thumb'] 

indstead de

$child['thumb'] 

Alors oui, voilà.