2012-05-17 102 views
1

如果你看一看: http://www.gilliesaudio.co.uk/index.php?route=product/category&path=62OpenCart - 显示子类别图像 - 在父类别中。

您将看到产品“飞人”和“海报”无类别的图像。

这是因为据我可以在主题/默认/模板/产品/ 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> 

不管我怎么努力,我不能让图像显示?我究竟做错了什么?

在此先感谢! 汤姆

回答

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) 

,并在环

foreach ($categories as $category) { 
第三方物流的

使用$catgory['image']$catgory['thumb']文件view/product/category.php

相关问题