I am currently struggling against a problem I can't fix, probably because of my scarce knowledge of the Drupal API.
I have a taxonomy tree that looks like the following one:
SHOE BRANDS 143 KIDS 151 MEN 152 STIVALE/BOOT 164 SANDAL 165 PANTOFOLA/LOAFER 198 MOCASSIN 199 DERBY 200 FRANCESINA/OXFORD 201 POLACCHINO/ANKLE BOOT 202 SNEAKER 203 OUTDOOR/SPORT 153 WOMEN 154 STIVALE/BOOT 166 SANDAL 167 POLACCHINO/ANKLE BOOT 189 SNEAKER 190 DERBY 191 FRANCESINA/OXFORD 192 PANTOFOLA/LOAFER 193 SABOT 194 MOCASSIN 195 BALLERINA 196 DECOLLETEE/PUMP 197
What I need to do is to populate a select box with the child elements of the "SHOE BRANDS" parent (which should be "KIDS" "MEN" "OUTDOOR" and "WOMEN"). After that I will populate a second select box with an Ajax call passing the tid, to get all the different shoe types.
The query I'm using to populate the first select is this one (and the problem rises here):
SELECT * FROM node INNER JOIN term_node AS tn ON node.vid = tn.vid LEFT JOIN content_type_extra_content AS xc ON node.vid = xc.vid WHERE tn.tid IN (SELECT th.tid FROM term_hierarchy AS th WHERE th.parent = '143') GROUP BY tn.tid
Note the '143' which is the tid of the "SHOE BRANDS" term.
Don't know why, but I only get as output "KIDS" and "OUTDOOR" (which are the only terms with no child elements.
Am I missing something in my syntax?