【发布时间】:2016-04-11 21:31:23
【问题描述】:
我正在尝试在类别页面中显示产品型号。
我已经添加了
'model'=> $result['model']
在 /catalog/controller/product/category.php
$data['products'][] = array(
'product_id' => $result['product_id'],
'thumb' => $image,
'name' => $result['name'],
'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('config_product_description_length')) . '..',
'price' => $price,
'special' => $special,
'tax' => $tax,
'minimum' => $result['minimum'] > 0 ? $result['minimum'] : 1,
'rating' => $result['rating'],
'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url),
'model' => $result['model']
);
我还在产品 foreach 中使用以下代码编辑了 category.tpl
<?php if (!empty($product['model'])) { ?>
<h5 class="model"> <?php echo $product['model']; ?></h5>
<?php } ?>
但类别页面中没有显示任何内容。
我还能做什么?
【问题讨论】:
-
尝试将 'model' 设置为静态文本,以测试 .tpl 文件是否至少能够正确显示
-
我替换了价格,名称,在这两种情况下我都得到了未定义的索引错误
-
Agis Soleas,尝试在 category.php 文件中 print_r($results) 并检查它是否给出模型的结果?
标签: opencart