类别的opencart子类别描述

问题描述 投票:0回答:1

我正在尝试在子类别上添加描述(优化搜索),但失败了。我要做的是在“ product / category.tpl”中添加以下行但是显示的文本来自父类别。有谁能够帮助我? 2.3.0.2

opencart
1个回答
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(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;?>

您将获得每个子类别的子类别描述:)

© www.soinside.com 2019 - 2024. All rights reserved.