OpenCart 2.3.0.2子类别加载父母的拇指.怎么修



https://i.stack.imgur.com/ld150.jpg

每个类别和子类别都有一个图像。将其拇指放在下拉菜单中时,Subcats加载了父母的拇指。目录/控制器/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'])
        );
        }

这是我的目录/view/theme/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>

任何想法是什么原因?

呼叫

$category['thumb']

的油墨
$child['thumb']

是的,就是这样。

最新更新