So was able to override the PrepareCustomerNavigationModel in one plugin with the code below. But what If I have two plugins and they both want to add a Customer Navigation Menu item.
I played with the Order in the DependencyRegistrar and the Plugin with the highest order gets called to add the menu Item and the other Plugin's PrepareCustomerNavigationModel does not get called. Is there a way to do get both override methods to be called or another way to add Customer Navigation Menu items?
public override CustomerNavigationModel PrepareCustomerNavigationModel(int selectedTabId = 0)
{
var model = base.PrepareCustomerNavigationModel(selectedTabId);
var navItems = model.CustomerNavigationItems;
//Get settings for current store
var storeScope = _storeContext.CurrentStore.Id;
var managerSettings = _settingService.LoadSetting<ManagerSettings>(storeScope);
if (managerSettings.Enabled)
{
navItems.Insert(
navItems.IndexOf(navItems.SingleOrDefault(n => n.Tab == CustomerNavigationEnum.Orders)),
new CustomerNavigationItemModel
{
RouteName = "Nop.Plugin.Scheduler.CustomerCalendar",
Title = _localizationService.GetLocaleStringResourceByName("Plugin.Scheduler.Account.CustomerCalendar")?.ResourceValue,
Tab = (CustomerNavigationEnum)CustomCustomerNavigationEnum.CustomerCalendar,
ItemClass = "customer-calendar"
});
}
model.SelectedTab = (CustomerNavigationEnum)(CustomCustomerNavigationEnum)selectedTabId;
return model;
}
I saw this post where there are other methods suggested
https://www.nopcommerce.com/en/boards/topic/45694/adding-menu-items-to-customer-navigation
but without trying to work out what they are suggesting it would be good to know if it will it solve my problem for two plugins both trying to add a Customer Navigation Menu item ?