如果你看看: http://www.gilliesaudio.co.uk/index.php?route=product/category&path=62
您会看到产品“传单”和“海报”没有类别图片。
这是我在theme / default / template / product / category.tpl中可以得到的:
<div>
<?php if ($product['thumb']) { ?>
<div class="image">
<a href="<?php echo $category['href']; ?>">
<img src="<?php echo $category['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" />
</a>
</div>
<?php } ?>
<a href="<?php echo $category['href']; ?>">
<?php echo $category['name']; ?>
</a>
</div>
无论我怎么努力,都无法让图像显示出来?我究竟做错了什么?
提前致谢! 汤姆
答案 0 :(得分:1)
在controller/product/category.php
档案中找到这一行:
$this->data['categories'][] = array(
'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
并将其替换为:
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
$thumb = $this->model_tool_image->resize($result['image'], 100, 100); // you can use your own size
$this->data['categories'][] = array(
'image' => $image,
'thumb' => $thumb,
'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
并在循环中使用$catgory['image']
或$catgory['thumb']
foreach ($categories as $category) {
tpl文件的{p> view/product/category.php