Рекурсивное получение всех дочерних терминов
<?php
/**
* Рекурсивное получение всех дочерних терминов
* @param $tid - id термина
* @param int $vid - id словаря
* @return array - массив объектов дочерних терминов
*/
function taxonomy_get_children_all($tid, $vid = 0) {
$c = taxonomy_get_children($tid, $vid);
$result = array();
foreach ($c as $t => $d) {
$result[$t] = $d;
$below = taxonomy_get_children_all($t, $vid);
if (!empty($below)) {
foreach ($below as $nt => $nd) {
$result[$nt] = $nd;
}
}
}
return $result;
}