private function fillTree(&$categories, $id_category) { $tree = array(); foreach ($categories[$id_category] as $category) { $tree[$category['id_category']] = $category; if (!empty($categories[$category['id_category']])) { $tree[$category['id_category']]['children'] = $this->fillTree($categories, $category['id_category']); } elseif ($result = BlogCategory::hasChildren($category['id_category'], $this->getLang(), false, $this->getShop()->id)) { $tree[$category['id_category']]['children'] = array($result[0]['id_category'] => $result[0]); } } return $tree; }