Santori Posted January 30, 2018 Share Posted January 30, 2018 Hello, i require some help of the community. Prestashop 1.6 We have dome a modification in Classes/Category.php for show a counter of products by subcategories. to show them so in category.tpl: Category: A There are 100 products Subcategory a - Subcategory b- 30 products Subcategory b- 20 products This is the code into Classes/Category.php In foreach ($result as &$row) { $row['id_image'] = Tools::file_exists_cache(_PS_CAT_IMG_DIR_.$row['id_category'].'.jpg') ? (int)$row['id_category'] : Language::getIsoById($id_lang).'-default'; $row['legend'] = 'no picture'; $categ = new Category((int)$row['id_category'], (int)$id_lang); $row['nbproducts'] =$categ->getProducts(1, 1, 10000, NULL, NULL, true); } And the code into category.tpl {if $subcategory.nbproducts >0 } <span>({$subcategory.nbproducts}) {l s='Prods.'}</span> {else} - {/if} The Subcategory a have 2 subcategories with 25 and 25 products but because the parent category have no products associated is empty. We need the code count the products in this subcategory or summatory of the categories under. Can someone help tp fix it)? Link to comment Share on other sites More sharing options...
Santori Posted February 22, 2018 Author Share Posted February 22, 2018 No one has an idea? Link to comment Share on other sites More sharing options...
gerog Posted May 16, 2020 Share Posted May 16, 2020 On 2/22/2018 at 8:09 PM, Santori said: No one has an idea? Hello! Have you solved it? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now