coooooool Posted September 13, 2010 Share Posted September 13, 2010 Bonjour tous le monde,j'arrive pas a afficher les liste des catégories sous forme hiérarchique dans un module prestashop que j'ai crée:echo''.$this->l('Liste de catégories de navigation').' '; $categories = Category::getCategories(intval($cookie->id_lang), false); Category::recurseCategory($categories, $categories[0][1], 1, ($this->getFieldValue($obj, 'id_category_default') ? $this->getFieldValue($obj, 'id_category_default') : Tools::getValue('id_category', 1))); echo'';Aide, Link to comment Share on other sites More sharing options...
Patric Posted September 13, 2010 Share Posted September 13, 2010 Pourquoi ne pas faire l'effort de poster dans la bonne section ?Topic déplacé dans la bonne section.De plus, je te conseille d'utiliser la balise CODE pour poster du code. Link to comment Share on other sites More sharing options...
coooooool Posted September 13, 2010 Author Share Posted September 13, 2010 Bonjour, Le but c'est de créer un combo-box dans un module qui ressemble à la figure ci-jointe c'est à dire d'un manière hiérarchique.Merci. 1 Link to comment Share on other sites More sharing options...
coooooool Posted September 13, 2010 Author Share Posted September 13, 2010 Bonjour,S'il vous plais, si quelqu'un a une réponse qu'il m'aideMerci bien Link to comment Share on other sites More sharing options...
jeckyl Posted September 13, 2010 Share Posted September 13, 2010 Salut,as tu regardé si sur Prestatools, un module identique n'existerait pas par hasard ? Link to comment Share on other sites More sharing options...
iNemo Posted September 14, 2010 Share Posted September 14, 2010 Salut coooooool, pour générer ce genre de select il faut faire : // Auparavant il faut faire : global $cookie; si tu est dans une fonction echo ' Catégorie : '; $categories = Category::getCategories(intval($cookie->id_lang), false); Category::recurseCategory($categories, $categories[0][1], 1); echo ' '; Link to comment Share on other sites More sharing options...
jeckyl Posted September 14, 2010 Share Posted September 14, 2010 Salut coooooool, pour générer ce genre de select il faut faire : // Auparavant il faut faire : global $cookie; si tu est dans une fonction echo ' Catégorie : '; $categories = Category::getCategories(intval($cookie->id_lang), false); Category::recurseCategory($categories, $categories[0][1], 1); echo ' '; Euh, dites moi, ils sont où les dans le select ? Link to comment Share on other sites More sharing options...
iNemo Posted September 14, 2010 Share Posted September 14, 2010 Le code de la fonction fait ce qu'il faut... static public function recurseCategory($categories, $current, $id_category = 1, $id_selected = 1) { global $currentIndex; echo ''. str_repeat(' ', $current['infos']['level_depth'] * 5).self::hideCategoryPosition(stripslashes($current['infos']['name'])).''; if (isset($categories[$id_category])) foreach ($categories[$id_category] AS $key => $row) self::recurseCategory($categories, $categories[$id_category][$key], $key, $id_selected); } 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