【发布时间】:2016-01-08 13:22:00
【问题描述】:
我正在使用 opencart 版本 2.0.2.0,现在我正在尝试在制造商页面中获取图像或图像 url。
我已经在catalog/controller/product/manufacturer.php添加了代码
$manufacturer_image = $this->model_catalog_manufacturer->getManufacturer($manufacturer_id);
if($manufacturer_image){
$this->data['manufacturers_img'] = $this->model_tool_image->resize($manufacturer_image['image'], 120, 120);
}else{
$this->data['manufacturers_img'] = false;
}
并在catalog/view/theme/default/template/product/manufacturer_list.tpl调用它
<div class="row">
<?php foreach ($manufacturers as $manufacturer) { ?>
<div class="col-sm-3"><a href="<?php echo $manufacturer['href']; ?>"><?php echo $manufacturer['name']; ?></a>
<?php echo ($manufacturers_img) ? '<img src="'.$manufacturers_img.'" alt="'.$manufacturers.'" />' : $manufacturers ;?><br />
</div>
<?php } ?>
</div>
但我的/index.php?route=product/manufacturer 页面出现错误
注意:未定义变量:manufacturers_img in /data1/opencart-2.0.2.0/catalog/view/theme/default/template/product/manufacturer_list.tpl 在第 32 行数组
【问题讨论】:
-
您似乎对制造商列表页面和详细信息页面感到困惑,
-
我一点都不迷茫,我想在制造商列表页面显示图像,谢谢!
标签: image syntax-error opencart2.x