cancel
Showing results for 
Search instead for 
Did you mean: 

Not possible to order top menu items

0 Kudos

Not possible to order top menu items

Feature request from Yonn-Trimoreau, posted on GitHub Feb 17, 2016

When I observe page_block_html_topmenu_gethtml_before event, just like Magento\Catalog\ObserverAddCatalogToTopmenuItemsObserver does, and add some items to the top.menu, I can't order the items I add (whether it should be displayed before or after category listing, for example).

I think it should be possible, since the "top menu" must be one of the first and most modified element on any website.

Maybe by adding a special \Magento\Framework\DataObject attribute "order" which will be used inside or before Magento\Theme\Block\Html's _getHtml method, in a way to reorder the \Magento\Framework\Data\Tree\Node before rendering it ?

Or even clearer : adding a $_position property to the Node class, and a non-mandatory variable to the Node class constructor, which could be used in a similar way I expressed before ?

Simple, non-breaking, no performance issue, really useful. Right ?

I can try to make a pull request if you accept this issue.

1 Comment
apiuser
New Member

Comment from Yonn-Trimoreau, posted on GitHub Feb 17, 2016

This issue may be resolved by fixing https://github.com/magento/magento2/issues/2354 But it still persists in a matter of simplicity