Gueshino95 Posted December 13, 2012 Share Posted December 13, 2012 Bonjour à tous, Je cherche depuis un moment comment récupérer la catégorie parente d'un produit. Explication.. Mon site est préparer en 2 Univers qui sont 2 grosse catégorie placé en catégorie d'accueil. Univers 1 - Catégorie 1.1 - SCatégorie 1.1.1 - SCatégorie 1.1.2 - Catégorie 1.2 - Catégorie 1.3 Univers 2 - Catégorie 2.1 - Catégorie 2.2 - Catégorie 2.3 Par exemple j'ai mon produit dans la SCatégorie 1.1.2, je coche au niveau des association donc Univers 1 + Catégorie 1.1 + SCatégorie 1.1.2 Mais j'aimerais pouvoir récupérez via un code ou function l'ID de la catégorie parente sélectionner la plus haute relative au produit. Afin d'appliquer un style particulier a ma fiche produit. J'ai essayer via Catégorie par defaul mais sa fait déconner le fil d'arianne =/ Quelqu'un pour m'aider .. Link to comment Share on other sites More sharing options...
Gueshino95 Posted December 17, 2012 Author Share Posted December 17, 2012 personne ? Link to comment Share on other sites More sharing options...
Sébastien Houzet Posted December 17, 2012 Share Posted December 17, 2012 Bonjour, As tu commencé par regarder sur l'object category ? $category->id_parent Tu peux remonter pour chaque catégorie vers l'id_parent le plus haut. Voilà une première piste à explorer. Link to comment Share on other sites More sharing options...
Gueshino95 Posted December 17, 2012 Author Share Posted December 17, 2012 (edited) Bonjour Sébastien, Merci de ton retour. Oui j'ai pu étudier l'objet category. Après avoir étudiez à nouveau la classe Catégory il y'a une méthode qu'on peut utiliser "getParentsCategories" Avec un petit override bien placer cela règle tous les problèmes Edited December 17, 2012 by Gueshino95 (see edit history) 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