Php OpenCart是否在主页上显示类别图像?

Php OpenCart是否在主页上显示类别图像?,php,image,thumbnails,opencart,Php,Image,Thumbnails,Opencart,我正在使用最新版本的开放式购物车 我想做的是在每个页面上显示商店分类页面中的图像,因为我想在菜单中实现它。你可以明白我在这里的意思: 在cetegory.tpl文件中,我发现: <?php if ($thumb) { ?> <div class="image"><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ? >" /></div&g

我正在使用最新版本的开放式购物车

我想做的是在每个页面上显示商店分类页面中的图像,因为我想在菜单中实现它。你可以明白我在这里的意思:

在cetegory.tpl文件中,我发现:

<?php if ($thumb) { ?>
    <div class="image"><img src="<?php echo $thumb; ?>" alt="<?php echo $heading_title; ?    >" /></div>
<?php } ?>


“alt=“OK,打开
/catalog/controller/common/header.php

查找此代码

            // Level 1
            $this->data['categories'][] = array(
                'name'     => $category['name'],
                'children' => $children_data,
                'column'   => $category['column'] ? $category['column'] : 1,
                'href'     => $this->url->link('product/category', 'path=' . $category['category_id'])
            );
换成

            // Level 1
            $this->load->model('tool/image');
            $image = empty($category['image']) ? 'no_image.jpg' : $category['image'];
            $thumb = $this->model_tool_image->resize($image, 100, 100);

            $this->data['categories'][] = array(
                'name'     => $category['name'],
                'children' => $children_data,
                'column'   => $category['column'] ? $category['column'] : 1,
                'thumb'    => $thumb,
                'href'     => $this->url->link('product/category', 'path=' . $category['category_id'])
            );
然后在
/catalog/view/theme/[your theme name]/template/common/header.tpl
中,只要在需要的地方使用
$category['thumb']


请注意,在上面的代码中,我已将宽度和高度设置为100px,您应该根据需要对其进行更改

我试图尽我所能解释,但没有完全理解。我想要的是在菜单中显示类别图像以及类别名称。我只想要父类别图像,而不是子类别。这更好吗?看看上面,这应该能回答你所需要的你绝对的传奇!谢谢,没问题。请用投票旁边的勾号标出答案:)谢谢你这么多人,我为Opencart 3.x编辑了它,我使用了。