Close

Display Order of Mega Menu SubCategories

mlanglois
7 years ago
#13408 Quote
Avatar
  • 2
Hi,
One of our customer is using MegaMenu for NOP Commerce 3.60. They got lots of categories, they change often and the maintenance of a display order is a huge work. What our customer want is really simple. Order the category by name! We noticed that they are currently ordered by DisplayOrder,ID. With the use of the .cshtml we where able to add a .OrderBy clause. Unfortunately, in CategoryMenuTemplateWithPictures.cshtml, the Top menu is list in a For Loop and I cant find the trick to do an OrderBy for that. Also when that category is passed to the CategoryDataTable I cant find a way to Order them there also since I dont see any Foreach or loop.  For the 3rd level there is a ForEach call and there it's working great.

Any insight of what could be done? At the moment we have put an SQL Trigger to the category table that set the displayorder but I would prefer having it in the code directly.

Thanks!
anton_ivanov
7 years ago
#13415 Quote
Avatar
  • Moderator
  • 277
Hello,

The mega menu doesn't have the option to order the categories by name. However, after we saw your post we made changes to the mega menu plugin. Now the subcategories in the dropdowns of category menu items will order alphabetically by name if their display order is the same.

If you update your Mega Menu and make all your subcategories have display order 0, the subcategories in the category menu item dropdown will be ordered by name. This will help you not worry about display order of the subcategories.

You can check how to update a plugin in our documentation.

Hope that helps!
Regards,
Anton Ivanov
Nop-Templates.com
mlanglois
7 years ago
#13417 Quote
Avatar
  • 2
Thanks,
I will look into it!