简体   繁体   English

PRESTASHOP 1.6在产品列表页面上显示产品类别描述

[英]PRESTASHOP 1.6 Display product category description on product list page

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; 我尝试了以下代码,并将其添加到我的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. 我了解我需要修改Product.php类函数,但不确定哪一个。 Can anyone guide me on this? 有人可以指导我吗?

I had tried to modify getProductsProperties class by adding 我试图通过添加来修改getProductsProperties类

$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. 然后将以下代码添加到product-list.tpl,但未显示任何内容。

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

请使用此代码显示当前类别

description:{$category->description}

description:{$category->description} 说明:{$ category-> description}

its definitely working Thanks @user2314737 它肯定工作谢谢@ user2314737

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM