我正在尝试在子类别上添加描述(优化搜索),但失败了。我要做的是在“ product / category.tpl”中添加以下行但是显示的文本来自父类别。有谁能够帮助我? 2.3.0.2
打开文件: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(strip_tags(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' => $result['description']
);
然后进入:catalog / view / theme / default / template / product / category.tpl
<?if (!empty($category['sub_desc'])) : ?>
<div class="description"><?php echo $category['sub_desc']; ?></div>
<?endif;?>
您将获得每个子类别的子类别描述:)