I have a user Menu which can have multiple level and i would like to be able to output a correctly sorted format. To arrange my menu i have a parentid, a level and a position. So the first item has no parent and would be level 0 and item 0. Then a child has this item as parentid, a level of 1 and would be position 0 as its the first child.
Below is a sample of one of the Menu docs…
So they way i want to return the query is to to return by level where 0 is the lowest and the position of 0, then all items that are a child of that parent and any possible children, sorted by position. Then the next item with level 0 and the next position and so on…
I am not sure if this is even possible or if I will have to keep using some external script to create the sorted output.
Problem here is with your sample that it will sort by the parent_id for level 0 items and ignore the sort order. Also the parent of a level 2 menu item is not the parent_id of the level 0 but the one of level 1 parent.