2016-08-11 14:08
浏览 61


I’ve used OpenCart v2.2.0.0 for a client’s website as it was their eCommerce system of choice. We have gotten a lot of the preliminary design added onto the website - that's not a problem.

The issue we are having is with the category pages.

Currently, the subcategories are displaying as normal text links: http://i.imgur.com/1LORcrg.jpg

What we would like to accomplish is to feed through unique images underneath these links.

What I had in mind was whether it was possible to feed the category image below the text, so that it looks similar to this: http://i.imgur.com/zTv2hHN.jpg

Is this possible within this version of OpenCart?

Any help would be much appreciated.

Cheers, Euan

图片转代码服务由CSDN问答提供 功能建议

我已经将OpenCart v2.2.0.0用于客户的网站,因为它是他们选择的电子商务系统。 我们已经在网站上添加了很多初步设计 - 这不是问题。

我们遇到的问题是类别页面。 < p>目前,子类别显示为普通文本链接: http://i.imgur.com/1LORcrg。 jpg


我的想法是 可以在文本下方提供类别图像,使其看起来与此类似: http:// i .imgur.com / zTv2hHN.jpg



干杯, Euan

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongxie3681 2016-08-11 22:17

    Step 1: Go to catalog\view\theme\THEMEACTIVE\template\product\category.tpl Find following line of code (in default theme there are in two places)

    <?php foreach ($categories as $category) { ?><li>

    Then add following lines of code (if in default then add on both places)

    <a href="<?php echo $category['href']; ?>">
                <img src="<?php echo $category['category_image']; ?>" />

    Step 2: Go to catalog\controller\product\category.php Find following lines of code:

    $data['categories'][] = array(
                    'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),

    Add following lines of code just below it:

    'category_image' =>$this->model_tool_image->resize($result['image'], 200,200),

    Here 200 is the size of image, first is width and second is height. Save and it will show images

    Better to make OCMOD for it. Instead of directly writing code in core file.

    解决 无用
    打赏 举报

相关推荐 更多相似问题