Digging into the 1.9 RWD nav menu, I am fiddling with
Varien_Data_Tree_Node - I haven't worked with these classes directly before and they seem unfinished as there are several empty methods in the classes.
Using an observer on the
page_block_html_topmenu_gethtml_before event, I am able to add a new item to the menu using:
$event = $observer->getEvent(); $menu = $event->getMenu(); $nodeData = array( 'name' => 'My Node', 'id' => 'my_node', 'url' => 'My-Url.html', 'is_active' => false ); $node = new Varien_Data_Tree_Node($nodeData, 'my-node', new Varien_Data_Tree()); $menu->addChild($node);
As expected, I see a new nav menu item on the front-end listed after any other nav items already built; however, I would like to position this node so that it is shown before or after any other items (such as how
after="-" are used in layout XML).
How can I adjust the position of items added to the nav menu in this fashion?