Sign up |
For a restaurant menu, i have a category editor with dragSortOrder sorting.
I have another editor for menu items. In this editor, one field is a list that uses the categories database to select a category for each menu item. This is set to dragSortOrder as well.
The code on my page loops through each item and if it matches a current category being displayed, it displays. Works fine. On my web page, all the categories are listed in the order I dragged them in the categories editor and so do the items. I can make it perfectly match the printed menu whenever they change something.
However, when updating a menu in the menu item's CMSB editor, the list is not sorted like the front end. Clicking the Categories header in the editor list doesnt sort the way I expect. I would like it to be displayed the same as the front end and the printed menu for ease of visual editing . In this huge item list, I would like all the categories in whatever order I have dragged them in the category editor which is working well for the front end. Is this possible? I dont understand what order they are currently in. The items within each category of the menu items editor list are sorted properly. However, maybe the categories are listed in the menu items editor in the order i created them or something? Does the order of the Categories in the category editor affect the menu items editor list at all? That's what I need.
Sorting for menu items editor:
First display dragSortOrder of categories, then dragSortOrder of menu items
Hope that makes sense.
If I get it right, the categories and menu items worked fine with dragSortOrder before, and not working after you modified one of the menu items? Can you provide an example (link or screenshot) of how they were before and after edit? I suspect the issue may be the loop so if you can attach the loop code that will be great.
I will wait for your response :)
Hi Leo. I'm horrible at being clear even though I write a book, sorry.
No, the web page is fine. It's the CMS editor thats not listing them the way I want. I'm not sure if i have ever displayed the CMSB editor list like this before, it would just be nice in long lists.
Menu items editor:
See how the menu items editor is not sorted like the categories or web page? Why is Steak Toppers listing out after Appetizers? When I have a very long list of menu items and they make changes, if the CMS was in the same order, it would be much easier to overhaul a menu with an email or print in front of me. Making everything in sync, going down the list and checking off updates. Follow me? The only sorting I see is clicking the "Category" header in the editor list but that doesn't sort as desired.
Ah I see what you mean by "clicking the category to sort". So when you click the "category" column to sort the list items:
1. They are sorted by the value of that field. I suspect in this case the value of field "category" is the num of Category records, which means it's basically sorting by category num value
2. It's not actually "sorted". It does not change the item order in the database nor the default item order returned by getRecords().
However, dragSortOrder actually changes the item order. If you go to CMS Setup > Section Editors > [Menu Item Section], on top click "sorting" tab, you should see "dragSortOrder DESC" by default. This defines when getRecords() is called, the default order of items will be dragSortOrder descendent. And you can modify this value to change how the list should be ordered by default.
Let me know if you have any questions!
In the menu items editor, I have sorting set to dragSortOrder:
In the category list (I added record num to be viewable in the list), Soups are dragged to the second position (actually, they happen to be record 2 already).
So in the CMS menu items records list (even after clicking the column / category sort header), "Soups" is still not displaying as the second category. Steak Toppers is the second category showing:
I must be misunderstanding your explanation. Should soups be second in this case? Even if it was sorting by num (not what I want), Soups should be #2. I'm not feeling too bright here. :D It's all good, the food menu is now updated but I want to understand and believe it will be easier next time if I could get it sorted the way I want.
For an admin, I want the records list in screenshot 3 above to be in the same order according to how I have them in screenshot 2 above (category dragSortOrder). This would list Soups second.
The 3rd category list showing in the menu items list is "Sides".
I suspect the problem is that the category field is sorting by its string value, "1x" will be after "1" instead of "2" because the first digit is 1 which is smaller than 2. The fast solution will be changing this field to INT type. Go to CMS Setup > Section Editors > Menu Items and modify to category field. Find the "MySQL Column Type" field under "Advanced Options". It should be Auto by default. Change it to be "INT" should solve your problem.
Let me know if this works!
That seems to put them in order by Category num and a weird number order (when toggling the "category" header in the menu items list editor) but I want them in the dragSortOrder of the category list, not num. Here is what that gives me when clicking the category header in the menu items list:
No arrow, default on page arrival:
I assume the above is the INT order? I would like this to be the dragSortOrder of the Categories editor.
= opposite of arrow up
But I want:
Categories listed here in current drag order of category editor (already displaying on website correctly):