在 category.php 控制器的第 189 行,这段代码
$category_total = $this->model_catalog_category->getTotalCategories();
$results = $this->model_catalog_category->getCategories($filter_data);
foreach ($results as $result) {
$data['categories'][] = array(
'category_id' => $result['category_id'],
'name' => $result['name'],
'sort_order' => $result['sort_order'],
'edit' => $this->url->link('catalog/category/edit', 'token=' . $this->session->data['token'] . '&category_id=' . $result['category_id'] . $url, 'SSL'),
'delete' => $this->url->link('catalog/category/delete', 'token=' . $this->session->data['token'] . '&category_id=' . $result['category_id'] . $url, 'SSL')
);
}
如果添加到数组
'image' => $result['image'],
它显示空虚,尽管在其他模板中,主要模板的图像是以相同的方式获得的。如何在管理面板中获取 category_list.tpl 模板的图像?
除了编辑输出模板和类别控制器之外,您还需要在模型中编辑对数据库的查询:
/admin/model/catalog/category.php
我们稍微编辑一下getCategories()函数中的sql查询
从oc_category表中为c1.image图像添加一个选择:
因此,在$result['image']中,我们将存储一个指向图像的链接。