我试图在子类别上添加说明(精炼搜索),但我失败了。我所做的是在" product / category.tpl"中添加以下行: 但显示的文本来自父类别。有谁能够帮我? 2.3.0.2
答案 0 :(得分:0)
打开文件:catalog / controller / product / category.php
$data['categories'][] = array(
'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
'thumb' => $image
);
在'sub_desc' => utf8_substr(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'), 0)
之后添加'thumb' => $image
不要忘记“,”
$data['categories'][] = array(
'name' => $result['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url),
'thumb' => $image,
'sub_desc' => utf8_substr(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8'), 0)
);
然后在:catalog / view / theme / default / template / product / category.tpl
<?php if (!empty($category['sub_desc'])) { ?>
<div class="description"><?php echo $category['sub_desc']; ?></div>
<?php } ?>
您将获得每个子类别的子类别描述:)