Bouki Posted January 26, 2009 Share Posted January 26, 2009 Bonjour,je cherche a masquer les catégories sans produits, pour ce faire je pense avoir localisé le code concerné :page modules/blockcategories/blockcategories.php ligne 102 à 107 $result = Db::getInstance()->ExecuteS(' SELECT * FROM '._DB_PREFIX_.'category c LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (c.id_category = cl.id_category AND id_lang = '.intval($params['cookie']->id_lang).') WHERE level_depth <= '.intval(Configuration::get('BLOCK_CATEG_MAX_DEPTH')).' AND c.active = 1 ORDER BY level_depth, cl.name ASC'); je ne suis pas un expert en sql mais j'ai essayé ceci : $result = Db::getInstance()->ExecuteS(' SELECT * FROM '._DB_PREFIX_.'category c LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (c.id_category = cl.id_category AND id_lang = '.intval($params['cookie']->id_lang).') WHERE ( c.id_category IN (SELECT DISTINCT id_category FROM ps_category_product) OR c.level_depth = 2 ) AND c.active = 1 ORDER BY level_depth, cl.name ASC'); cependant cela ne marche pas, certaines catégories contenant des produits restent masqués, je pense que je suis proche de la solution.Si quelqu'un pourrait m'aider, merci. Link to comment Share on other sites More sharing options...
StoreCommander Posted January 26, 2009 Share Posted January 26, 2009 Essayez : $result = Db::getInstance()->ExecuteS(' SELECT * FROM '._DB_PREFIX_.'category c LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (c.id_category = cl.id_category AND id_lang = '.intval($params['cookie']->id_lang).') WHERE c.id_category IN (SELECT DISTINCT pcp.id_category FROM ps_category_product pcp) AND c.level_depth <= 2 AND c.active = 1 ORDER BY c.level_depth, cl.name ASC'); Link to comment Share on other sites More sharing options...
Bouki Posted January 27, 2009 Author Share Posted January 27, 2009 ca ne marche pas, aucune catégorie ne s'affiche, le probleme etant que j'ai par exemple les catégories :- livres- audiosqui ne contiennent aucun produits, mais livres contient les catégories roman policier, science fiction... qui eux contiennent des produits 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