Closed
Description
When I set the value of Use Flat Catalog Category
to Yes
from Stores->Configuration->Catalog->Frontend
I don't have anymore the subcategories in the main menu in the frontend.
I only get the top level categories.
Max recursion level is the same.
Digging down I found that if I change in Magento\Catalog\Model\Observe::_addCategoriesToMenu()
this
if ($this->categoryFlatConfig->isFlatEnabled()) {
$subcategories = (array)$category->getChildrenNodes();
} else {
$subcategories = $category->getChildren();
}
to this:
$subcategories = $category->getChildren();
everything works.
I found that with flat catalog on and off $category
is always an instance of Magento\Framework\Data\Tree\Node
so the if
statement that checks if the flat catalog is enabled might not be needed.
I didn't add this as a pull request because I'm not sure if I'm right or not.
Please review it.
Thanks in advance.
Metadata
Metadata
Assignees
Labels
No labels