PRESTASHOP 1.6 Display product category description on product list page

3.4k Views Asked by At

I have been trying to display my category description into the product listing page but can't crack it still.

I tried following codes and add it into my product-list.tpl;

($default_category->description)

AND

($product.default_category->description)

I understand that I need to modify the Product.php class function but I am not sure which one. Can anyone guide me on this?

I had tried to modify getProductsProperties class by adding

$results_array = array(); 
$categories_ids = Product::getProductCategories($row['id_product']);
$categories_names = array();
foreach ($categories_ids AS $id) {
$category = new Category($id);
$categories_names[] = $category->getName();
}
$row['categories'] = $categories_names;

then add following codes to product-list.tpl but it didn't show anything.

<!-- Display categories -->
<span id="product_categories">
{foreach from=$product.categories item=category name=category}
{$category} <br/>
{/foreach}
</span>
2

There are 2 best solutions below

1
On

please use this code to display current category

description:{$category->description}
0
On

description:{$category->description}

its definitely working Thanks @user2314737