尝试类似默认 OpenCart 代码的操作。
Step 1
打开文件catalog/view/theme/<your theme>/template/template/category.tpl
Find:细化类别代码。
添加后 <div class="category-list">
开始div
<?php $counter = 0; foreach ($categories as $category) {?>
<div>
<?php if ($category['thumb']) { ?>
<a href="<?php echo $category['href']; ?>"><img src="<?php echo $category['thumb']; ?>" alt="<?php echo $category['name']; ?>" /></a>
<?php } else { ?>
<a href="<?php echo $category['href']; ?>"><img src="image/no_image.jpg" alt="<?php echo $category['name']; ?>" /></a>
<?php } ?>
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
</div>
<?php $counter++; } ?>
Step 2
打开文件catalog/controller/product/category.php
Find :
$product_total = $this->model_catalog_product->getTotalProducts($data);
添加后
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
Step 3
在同一个文件中catalog/controller/product/category.php
Find :
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
Replace(而不是上面的线)
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url), 'thumb' => $image
然后检查一下。