Add menu item to Admin panel from Plugin Nop 4.0

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 anos atrás
Hey Guys,

I cannot find how to add a menu item to the Admin panel from a plugin in Nop 4.0, any help would be great.

Thank You,
6 anos atrás
[email protected] wrote:
Hey Guys,

I cannot find how to add a menu item to the Admin panel from a plugin in Nop 4.0, any help would be great.

Thank You,



You need to implement IAdminMenuPlugin (Nop.Web.Framework)
6 anos atrás
implement IAdminMenuPlugin  

and then  add this code

public void ManageSiteMap(SiteMapNode rootNode)
        {
            var menuItem = new SiteMapNode()
            {
                SystemName = "System Name",
                Title = "Name of item Need TO Add",
                ControllerName = "Controller name",
                ActionName = " action name",
                Visible = true,
                RouteValues = new RouteValueDictionary() { { "area", null } },
            };
            var pluginNode = rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Third party plugins");
            if (pluginNode != null)
                pluginNode.ChildNodes.Add(menuItem);
            else
                rootNode.ChildNodes.Add(menuItem);
        }
6 anos atrás
Thank You Guys!
6 anos atrás
For adding a menu item to a custom view in admin of Nop 4.0, this format worked for me:

public void ManageSiteMap(SiteMapNode rootNode)
        {
            {
                var menuItem = new SiteMapNode()
                {
                    SystemName = "MySystemName",
                    Title = "Text to display",
                    ControllerName = "MyControllerName",
                    ActionName = "MyActionName",
                    Visible = true,
                    IconClass = "fa-dot-circle-o",
                    RouteValues = new RouteValueDictionary() { { "area", AreaNames.Admin } },
                };

                var pluginNode = rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "ParentMenuItemSystemName");
                if (pluginNode != null)
                    pluginNode.ChildNodes.Add(menuItem);
                else
                    rootNode.ChildNodes.Add(menuItem);
            }
        }
4 anos atrás
Where Can I put this Implementation ( I need to know the path) ?
Thanks
Sizzler wrote:
For adding a menu item to a custom view in admin of Nop 4.0, this format worked for me:

public void ManageSiteMap(SiteMapNode rootNode)
        {
            {
                var menuItem = new SiteMapNode()
                {
                    SystemName = "MySystemName",
                    Title = "Text to display",
                    ControllerName = "MyControllerName",
                    ActionName = "MyActionName",
                    Visible = true,
                    IconClass = "fa-dot-circle-o",
                    RouteValues = new RouteValueDictionary() { { "area", AreaNames.Admin } },
                };

                var pluginNode = rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "ParentMenuItemSystemName");
                if (pluginNode != null)
                    pluginNode.ChildNodes.Add(menuItem);
                else
                    rootNode.ChildNodes.Add(menuItem);
            }
        }
4 anos atrás
Hi, can I have a direct contact with you ?
====================================
I need to know the path where I can do this implementation?
ero wrote:
implement IAdminMenuPlugin  

and then  add this code

public void ManageSiteMap(SiteMapNode rootNode)
        {
            var menuItem = new SiteMapNode()
            {
                SystemName = "System Name",
                Title = "Name of item Need TO Add",
                ControllerName = "Controller name",
                ActionName = " action name",
                Visible = true,
                RouteValues = new RouteValueDictionary() { { "area", null } },
            };
            var pluginNode = rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Third party plugins");
            if (pluginNode != null)
                pluginNode.ChildNodes.Add(menuItem);
            else
                rootNode.ChildNodes.Add(menuItem);
        }
4 anos atrás
In the main routine for your plugin where
        public override void Install()
is located

you will find some similar class (need to add IAdminMenuPlugin)

    public class YourPlugin : BasePlugin, IMiscPlugin, IAdminMenuPlugin
    {

        public override void Install()
        {
         ......
         }

        public override void Uninstall()
        {
         ......
         }

add
        public void ManageSiteMap(SiteMapNode rootNode)
        {
         ......
         }
2 anos atrás
Is anybody know process of removing it.
2 anos atrás
[email protected] wrote:
Is anybody know process of removing it.


do you have plugin source code. if yes  just remove ManageSiteMap code and build plugin again. if no then you can use
public void ManageSiteMap(SiteMapNode rootNode){
rootNode.ChildNodes.Remove(...);
}
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.