我正在使用opencart版本2.0.2.0,現在我正試圖在製造商頁面中獲取圖像或圖像URL。如何在opencart2.0.2.0的manucarturer頁面中獲取製造商圖像?
我在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在 /data1/opencart-2.0.2.0/catalo克/視圖/主題/默認/模板/產品/ manufacturer_list.tpl線 32Array
好像您正在使用,製造商列表頁和詳細信息頁混淆, – Ramesh
我不困惑可言,我想在製造商列表頁面中顯示的圖像,謝謝! –