试图在Opencart 2.3.0.2版的第二级子类别的顶部菜单中显示图像
但无法获取代码消息到达无法处理请求服务器错误
header.tpl的代码
<li class="categories_hor dropdown"> <a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
<?php if ($category['children']) { ?>
<div class="dropdown-menu">
<?php for ($i = 0; $i < count($category['children']);) { ?>
<?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
<?php for (; $i < $j; $i++) { ?>
<?php if (isset($category['children'][$i])) { ?>
<div class="column col-lg-2 col-md-3"> <a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a>
<?php if ($category['children'][$i]['children_level2']) { ?>
<div>
<ul>
<?php for ($wi = 0; $wi < count($category['children'][$i]['children_level2']); $wi++) { ?>
<li><img src="image/<?php echo $category['children'][$i]['children_level2'][$wi]['image']; ?>"/> <a href="<?php echo $category['children'][$i]['children_level2'][$wi]['href']; ?>" ><?php echo $category['children'][$i]['children_level2'][$wi]['name']; ?> </a> </li>
<?php } ?>
</ul>
</div>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
</li>
控制器文件header.php的代码
$children_data[] = array(
'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'image' => $child['image'] ? $this->model_tool_image->resize($child['image'], 20, 20) : false,
'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
);
及以下是显示菜单的头文件的代码
header.tpl