menu_node_views.module is an important helper to create views out of menu items. It's useful for example to create overview pages under tree menu items without own content.
The module works really great, but sometimes we ran into the problem that content was not sorted like in the menu tree. We've already set the "Menu: weight" as sorting criteria correctly.
So what's the reason?
To find out why the elements are sorted in a different manner, we simply added the "Menu: weight" as field in output to debug it.
We now found out, that some of the menu elements had the same weight, that was "0" (zero).
I think these were nodes that were created but not assigned any weight manually. They are being sorted into the menu tree without a specific weight. So the view handled them corrently.
What's the solution to fix menu node views item sorting?
- The solution is quite simple, but there are two variants:
- Simply drag and drop the menu items around in your menu hierarchy. The JavaScript D&D library now automatically assigns the right weight and everything is fine after saving
- Another solution requires no change in the menu, but in the view. Simply add order by "nid" ascending as second sort criteria. I think the menu module must do something like this to accieve the sorting as we see it without a specific weight. You can see this solution in the screenshot above.
If my hints helped you, feel free to leave a comment :)