Can anyone advise me on how to add a menu item to the customer navigation from a plugin? So currently under "My Account" a customer would see: - Customer info - Addresses - Orders - Downloadable products - Back in stock subscriptions - Change password - My product reviews
Whereas I'd like to add a further menu item between Orders and Downloadable products.
Thanks for your answer. I'm actually referring to the customer navigation items and not navigation items of the website itself (I'm speaking of the navigation items when the customer is logged in and navigated to his account, i.e.: www.domain.com/customer/info). The customer navigation items are been created and added to the CustomerNavigationModel in the CustomerController.cs controller, which looks like this:
private CustomerNavigationModel GetCustomerNavigation(int selectedTabId = 0) { var model = new CustomerNavigationModel();
I don't want to touch the core and add my own navigation item to the CustomerController controller. Copying the CustomerNavigation.cshtml page and changing it won't work, then as mentioned above the items are added on the controller and is not static content of the page.
and others) but that is not what I want to achieve. What I want is to add a additional menu item Quotation inside the customer navigation section between the Orders and Downloadable Products tabs. How can I achieve this programmatically within my plugin?
Copying the CustomerNavigation.cshtml page and changing it won't work, then as mentioned above the items are added on the controller and is not static content of the page.
But the CustomerNavigationModel is passed to the view. If you override the view you can perform any manipulations you like on the model, including inserting new items.
Other approaches: 1. Override the CustomerNavigation ActionResult from your plugin. 2. Use an Action Filter to alter the CustomerNavigationModel after it's been generated. 3. Override the PostInitialize method (inherited from BaseNopModel) to alter the CustomerNavigationModel after it's been generated
Thanks a bunch, Pete, very helpful! I must have misunderstood what L.K meant by copying and overwriting the view - but now understand thanks to your explanation.
Thanks a bunch, Pete, very helpful! I must have misunderstood what L.K meant by copying and overwriting the view - but now understand thanks to your explanation.
Hi Max,
Yes, you will have to override the default view from your custom plugin (CustomerNavigation ActionResult) in your case as Pete mentioned above in order to add custom menu items.