我怎样才能在opencart2.0.2.0的manucarturer页面中获取制造商图像?
How can i get manufacturer image in manucarturer page in opencart2.0.2.0?
我正在使用 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
页面出现错误
Notice: Undefined variable: manufacturers_img in
/data1/opencart-2.0.2.0/catalog/view/theme/default/template/product/manufacturer_list.tpl
on line 32Array
明确一点 ControllerProductManufacturer
index()
显示列表,info()
显示制造商的详细信息,
//catalog/controller/product/manufacturer.php:46
替换
$data['categories'][$key]['manufacturer'][] = array(
和
$manufacturer_image = $this->model_catalog_manufacturer->getManufacturer($result['manufacturer_id']);
if($manufacturer_image){
$mfg_img = $this->model_tool_image->resize($manufacturer_image['image'], 120, 120);
}else{
$mfg_img = false;
}
$data['categories'][$key]['manufacturer'][] = array(
'image'=>$mfg_img,
并在 catalog/view/theme/default/template/product/manufacturer_list.tpl:30
内循环
<?php if($manufacturer['image']):?>
<img src="<?php echo $manufacturer['image']; ?>" alt="<?php echo $manufacturer['name'];?>">
<?php endif;?>
我正在使用 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
页面出现错误
Notice: Undefined variable: manufacturers_img in /data1/opencart-2.0.2.0/catalog/view/theme/default/template/product/manufacturer_list.tpl on line 32Array
明确一点 ControllerProductManufacturer
index()
显示列表,info()
显示制造商的详细信息,
//catalog/controller/product/manufacturer.php:46
替换
$data['categories'][$key]['manufacturer'][] = array(
和
$manufacturer_image = $this->model_catalog_manufacturer->getManufacturer($result['manufacturer_id']);
if($manufacturer_image){
$mfg_img = $this->model_tool_image->resize($manufacturer_image['image'], 120, 120);
}else{
$mfg_img = false;
}
$data['categories'][$key]['manufacturer'][] = array(
'image'=>$mfg_img,
并在 catalog/view/theme/default/template/product/manufacturer_list.tpl:30
内循环
<?php if($manufacturer['image']):?>
<img src="<?php echo $manufacturer['image']; ?>" alt="<?php echo $manufacturer['name'];?>">
<?php endif;?>