Add menu / submenu to Plugin Admin menu item

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Hi,

I am trying to add a menu / submenu to the Plugin Admin menu item, only the "parent" node is showing without the rest. Here is a sample code.


public void ManageSiteMap(SiteMapNode rootNode)
        {
            var parentNode = new SiteMapNode() // this one is showing only
            {
                SystemName = "Widgets.PromoSlider",
                Title = "Promo Slider",
                ControllerName = "PromoSlider",
                ActionName = "CreateUpdatePromoSlider",
                Visible = true,
                RouteValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Widgets.PromoSlider.Controllers" }, { "area", null } }
            };

            var createUpdateNode = new SiteMapNode()
            {
                SystemName = "Widgets.PromoSlider",
                Title = "New Slider",
                ControllerName = "PromoSlider",
                ActionName = "CreateUpdatePromoSlider",
                Visible = true,
                RouteValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Widgets.PromoSlider.Controllers" }, { "area", null } }
            };

            var manageSlidersNode = new SiteMapNode()
            {
                SystemName = "Widgets.PromoSlider",
                Title = "Manage Sliders",
                ControllerName = "PromoSlider",
                ActionName = "ManagePromoSliders",
                Visible = true,
                RouteValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Widgets.PromoSlider.Controllers" }, { "area", null } }
            };

            parentNode.ChildNodes.Add(createUpdateNode);
            parentNode.ChildNodes.Add(manageSlidersNode);

            var pluginNode = rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Third party plugins");
            if (pluginNode != null)
                pluginNode.ChildNodes.Add(parentNode);
            else
                rootNode.ChildNodes.Add(parentNode);
        }
7 years ago
[email protected] wrote:
Hi,

I am trying to add a menu / submenu to the Plugin Admin menu item, only the "parent" node is showing without the rest. Here is a sample code.



Try this...


public void ManageSiteMap(SiteMapNode rootNode)
        {
            var pluginNode = rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Third party plugins");
            if (pluginNode != null)
            {
                var parentNode = new SiteMapNode() // this one is showing only
                {
                    //SystemName = "Widgets.PromoSlider",
                    Title = "Promo Slider",
                    ControllerName = "PromoSlider",
                    ActionName = "CreateUpdatePromoSlider",
                    Visible = true,
                    RouteValues = new RouteValueDictionary() { { "area", "admin" } }
                };

                parentNode.ChildNodes.Add(new SiteMapNode()
                {
                    Title = _localizationService.GetResource("Admin.Configuration.Settings"),
                    //   Title for your Sub Menu item
                    ControllerName = "Widget", // Your controller Name
                    ActionName = "ConfigureWidget", // Action Name
                    Visible = true,
                    RouteValues = new RouteValueDictionary() { { "systemName", this.PluginDescriptor.SystemName } },
                });
                parentNode.ChildNodes.Add(new SiteMapNode()
                {
                    SystemName = "Widgets.PromoSlider",
                    Title = "Manage Sliders",
                    ControllerName = "PromoSlider",
                    ActionName = "ManagePromoSliders",
                    Visible = true,
                    RouteValues = new RouteValueDictionary() { { "Namespaces", "Nop.Plugin.Widgets.PromoSlider.Controllers" }, { "area", null } }
                });
                pluginNode.ChildNodes.Add(parentNode);
            }
            
        }
7 years ago
Hey
Thanks for your reply, I'm having the same problem: https://www.nopcommerce.com/boards/t/43599/admin-plugin-item.aspx

I tried your suggestion, but is their a way to make this work with childnodes that only point to a url? >> see my code as example
7 years ago
[email protected] wrote:
Hey
Thanks for your reply, I'm having the same problem: https://www.nopcommerce.com/boards/t/43599/admin-plugin-item.aspx

I tried your suggestion, but is their a way to make this work with childnodes that only point to a url? >> see my code as example


Your post replied ==>https://www.nopcommerce.com/boards/t/43599/admin-plugin-item.aspx#173260
7 years ago
The answer to your question is here
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.