如何在prestashop模板中获取类别描述

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

我想在我的产品列表页面中显示类别描述(在过滤器部分中)。但是我只有类别的名称和id,并且在类别类中找不到也给我描述的方法。

你能帮助我吗? :)

php prestashop smarty prestashop-1.7
3个回答
1
投票

我能够使用此方法获取类别信息:

{assign var='cat' value=Category::getNestedCategories($categoryId)}
{$cat[categoryId].description nofilter}

谢谢您的帮助。


0
投票

使用以下代码创建覆盖Link.php:

Class Link extends LinkCore {
    public function getInfoCateg($idc) { 
     $category = new Category($id);
     return $category->description;
    }
}

在你的tpl:

{$link->getInfoCateg($product.id_category_default)}

并清除缓存文件。

问候


0
投票

尝试使用以下代码获取类别说明。

$categories_id = Product::getProductCategories($row['id_product']);
$category = new Category($id);
$description = $category->description;
© www.soinside.com 2019 - 2024. All rights reserved.