When I am using $category->getChildren();
and I am getting empty array? I have children categories defined and I can see them via Admin Panel.
Where should I look for the clue?
thanks
Magento 1.9 Category Issue – $category->getChildren() Not Working
categorycategory-treemagento-1.9
Best Answer
ok found the solution.
my
$category
is ofVarien_Data_Tree_Node
type and$category->getChildren()
isVarien_Data_Tree_Node_Collection
the problem was that in the Magento Config, Maximal Depth was set to 1. That is why I was getting empty collection (Varien_Data_Tree_Node_Collection
) for each category and children_count was OK. Changing Maximal Depth variable to 2 solved the problem.Thanks!