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
1 Answer
ok found the solution.
my $category
is of Varien_Data_Tree_Node
type and
$category->getChildren()
is Varien_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!
getChildrenCategories()
?getChildren()
should return a string with coma seperated ids, not an array at all.$category->getData()
via print_r or var_dump and see what's in there for children