$category->getChildren(); does not work?
-
12-12-2019 - |
Question
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
Solution
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!
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange