public function recurseLiteCategTypeTree($max_depth = 3, $current_depth = 0, $id_lang = null, $excluded_ids_array = null) { $id_lang = is_null($id_lang) ? Context::getContext()->language->id : (int) $id_lang; $children = array(); $subcats = $this->getSubCategoriesType($id_lang, true); if (($max_depth == 0 || $current_depth < $max_depth) && $subcats && count($subcats)) { foreach ($subcats as &$subcat) { if (!$subcat['id_category']) { break; } elseif (!is_array($excluded_ids_array) || !in_array($subcat['id_category'], $excluded_ids_array)) { $categ = new Category($subcat['id_category'], $id_lang); $children[] = $categ->recurseLiteCategTypeTree($max_depth, $current_depth + 1, $id_lang, $excluded_ids_array); } } } if (is_array($this->description)) { foreach ($this->description as $lang => $description) { $this->description[$lang] = Category::getDescriptionClean($description); } } else { $this->description = Category::getDescriptionClean($this->description); } return array('id' => (int) $this->id, 'link' => Context::getContext()->link->getCategoryLink($this->id, $this->link_rewrite), 'name' => $this->name, 'desc' => $this->description, 'children' => $children); }