jnasri Posted July 6, 2010 Share Posted July 6, 2010 Bonjour tout le monde,J'ai besoin d'afficher le nombre des produits dans une sous catégorie comme dans le site suivant :http://www.homology.com/Existe -il un module gratuit pour ça ?Merci d'avance. Link to comment Share on other sites More sharing options...
jeckyl Posted July 6, 2010 Share Posted July 6, 2010 Bonjour,il n'existe pas de module, c'est un développement spécifique.Mais je crois qu'en cherchant sur le forum vous pourrez trouver une explication pour ajouter le nombre de produit d'une catégorie dans le menu. Link to comment Share on other sites More sharing options...
jnasri Posted July 6, 2010 Author Share Posted July 6, 2010 Merci beaucoup Jeckyl pour votre réponse Link to comment Share on other sites More sharing options...
AkrOpad Posted December 2, 2011 Share Posted December 2, 2011 Si ça peut aider ! Test sous Prestashop 1.4.5.1 Dans modules/blockcategories/blockcategories.php Dans : public function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0) Trouvez : return array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), 'name' => $resultIds[$id_category]['name'], 'desc'=> $resultIds[$id_category]['description'], 'children' => $children); Remplacez le code par celui-ci : return array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), 'name' => $resultIds[$id_category]['name'], 'desc'=> $resultIds[$id_category]['description'], 'children' => $children, 'product_count' => $resultIds[$id_category]['product_count']); Dans : public function hookLeftColumn($params) Trouvez la boucle : foreach ($result as &$row) { $resultParents[$row['id_parent']][] = &$row; $resultIds[$row['id_category']] = &$row; } Remplacez la par celle-ci : foreach ($result as &$row) { if($row['id_category'] != 1) { $result_product_count = Db::getInstance()->ExecuteS(' SELECT COUNT(ac.`id_product`) as totalProducts FROM `'._DB_PREFIX_.'category_product` ac LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ac.`id_product` WHERE ac.`id_category` = '.$row['id_category'].' AND p.`active` = 1'); $row['product_count'] = $result_product_count[0]['totalProducts']; } $resultParents[$row['id_parent']][] = &$row; $resultIds[$row['id_category']] = &$row; } Dans themes/votre_theme/category-tree-branch.tpl Rajouter ceci : ({$node.product_count}) après le lien : <a href="{$node.link|escape:'htmlall':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:'htmlall':'UTF-8'}">{$node.name|escape:'htmlall':'UTF-8'}</a> Link to comment Share on other sites More sharing options...
kelcible Posted January 16, 2012 Share Posted January 16, 2012 et comment faire pour avoir le cumul des produits des sous catégories ? Catégorie > Sous catégories (5) > Produits (10) donne Catégorie (15) 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