inkacola Posted November 5, 2008 Share Posted November 5, 2008 Bonjour,Beaucoup d'amélioration dans cette nouvelle version...bravo, encore qques bugs, mais ca commence à la faire...J'ai une question, comment peut on avoir le nombre à coté des catégories dans le menu du front(du genre: Colliers (10)) à la OS commerce, s'il vous plait? 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/modules/blockcategories/category-tree-branch.tpl Rajouter ceci après le lien : ({$node.product_count}) 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