0
http://imgur.com/a/ZnuvvOpencart 2.3.0.2子类别加载其父母的大拇指。怎么修?
每个类别和子类别都有一个图像。在下拉菜单中放置一个拇指时,子邮箱会加载父母的拇指。 目录/控制器/通用/ 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'])
);
}
这里是我的目录/视图/主题/默认/模板/通用/ 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>
任何想法可能是这个原因吗?