function showAllAction() { if (!Config::get("allCategoriesPageEnabled")) { return $this->return404(); } Display::set("adPage", "allcategories"); //get all categories first parents then childs to build tree $c = new Criteria(); $c->addOrder("parentCategoryId, name"); $categories = $this->category->findAll($c, "categoryId, parentCategoryId, name, urlName, validatedSitesCount"); $tree = new NavigationTree(); foreach ($categories as $category) { $value = $category; //add node to tree $tree->addNode($category['categoryId'], $category['parentCategoryId'], $value); } //build tree $this->set("allCategories", $tree->render()); }