Hi, I did not find a good solution for a mega menu extension, so I was thinking about writing my own, since I do not need anything special. Therefore my plan was to get the categories in a block and iterate over them in the phtml with a foreach and add the css classes.
I’m not exactly sure which Magento models or factories to use, though. I found this one to get the level 2 categories (which are the top level categories) and also MagentoCatalogModelCategoryFactory; to build the subcategories.
However, I’m sure there is a better solution so I wanted to ask if you could help me on this.
My second concern is performance. I’m not sure if it’s actually a good idea to go the ‘foreach’ approach in the phtml to iterate over the catgeories.
TL:DR: How to get categories in block and output them in phtml so that I can build my own menu?
Thank you very much in advance.