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 лет назад
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 лет назад
[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 лет назад
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 лет назад
Thank You Guys!
6 лет назад
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 года назад
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 года назад
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 года назад
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 года назад
Is anybody know process of removing it.
2 года назад
[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.