在类别页面opencart中显示产品模型

在类别页面opencart中显示产品模型,opencart,Opencart,我试图在分类页面中显示产品型号。 我补充说 'model'=>$result['model'] 在/catalog/controller/product/category.php中 $data['products'][] = array( 'product_id' => $result['product_id'], 'thumb' => $image,

我试图在分类页面中显示产品型号。 我补充说
'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']
                );
我还在products foreach中使用以下代码编辑了category.tpl

<?php if (!empty($product['model'])) { ?>
                    <h5 class="model">&nbsp;<?php echo $product['model']; ?></h5>
                <?php } ?>

但是分类页面中没有显示任何内容


我还应该做什么?

确保sql查询包含model字段。很多时候,查询是特定的,不会返回数据库表中的所有字段。
要执行此操作,请导航到
catalog>model>catalog>product.php
并查找函数
getProducts

编辑此函数以允许使用模型。

确保sql查询包含model字段。很多时候,查询是特定的,不会返回数据库表中的所有字段。
要执行此操作,请导航到
catalog>model>catalog>product.php
并查找函数
getProducts

编辑此函数以允许使用模型。

尝试将“model”设置为静态文本,以测试.tpl文件是否至少能够正确显示它i替换的价格,在这两种情况下,我都得到了未定义的索引错误,请尝试在category.php文件中打印($results),并检查它是否给出了模型的结果?尝试将“model”设置为静态文本,以测试.tpl文件至少能够正确显示它。我替换了price、name,在这两种情况下,我得到了未定义的索引错误,请尝试打印($results)在category.php文件中,并检查它是否给出模型的结果?