I add a vocablary named "product sub categories" and I want to fetch the whole tree structure from datebase through query? Can anybody can help me?
Asked
Active
Viewed 184 times
1 Answers
1
You can use the Drupal API taxonomy_get_tree function, you only need the vocabulary id.
$taxonomyTree = taxonomy_get_tree($vid);
If you are using Drupal 7, you can use taxonomy_vocabulary_machine_name_load to get the vocabulary object by its name.
$vocabularyObject = taxonomy_vocabulary_machine_name_load("product sub categories");

halfer
- 19,824
- 17
- 99
- 186

Mario Araque
- 4,562
- 3
- 15
- 25
-
`$vocabulary = taxonomy_vocabulary_machine_name_load("product sub categories"); $terms = taxonomy_get_tree($vocabulary);` ,here "product sub categories" is my vocabulary, I want to print the whole tree but didnt get any result from this – nomeer Mar 07 '15 at 04:49
-
Try with taxonomy_get_tree($vocabulary->vid); Also you can debug your variables to check correct results. – Mario Araque Mar 07 '15 at 09:01
-
Thanku so much @mario :) – nomeer Mar 09 '15 at 04:18