Plugin development - configure not showing

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

I have the following routeProvider config:

public void RegisterRoutes(RouteCollection routes)
        {


           var configureRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.Configure",
                "Plugins/Shipping.LogistraAdmin/Configure",
                new { controller = "Logistra", action = "Configure" },
                new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
           );
            routes.Remove(configureRoute);
            routes.Insert(0, configureRoute);



            var indexRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin",
                  "Admin/Logistra",
                  new { controller = "Logistra", action = "Index", area = "Admin" },
                  new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
             );
            routes.Remove(indexRoute);
            routes.Insert(0, indexRoute);
            
            var processRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.LogistraProcess",
                 "Admin/logistra/process/{id}/{carrier}/{ident}",
                 new { controller = "Logistra", action = "ProcessConsignment", area = "Admin" },
                 new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
            );
            routes.Remove(processRoute);
            routes.Insert(1, processRoute);

            var seeAllOrdersRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.SeeAllOrders",
                "Admin/logistra/SeeAllOrders",
                new { controller = "Logistra", action = "SeeAllOrders", area = "Admin" },
                new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
           );
            routes.Remove(seeAllOrdersRoute);
            routes.Insert(2, seeAllOrdersRoute);


            var mainPrinterRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.SetMainPrinter",
                "Admin/logistra/setMainPrinter/{printerId}",
                new { controller = "Logistra", action = "SetMainPrinter", area = "Admin" },
                new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
           );
            routes.Remove(mainPrinterRoute);
            routes.Insert(2, mainPrinterRoute);


            var PrintOrderInformationForAllOrders = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.PrintOrderInformationForAllOrders",
                "Admin/logistra/PrintOrderInformationForAllOrders",
                new { controller = "Logistra", action = "PrintOrderInformationForAllOrders", area = "Admin"},
                new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
           );
            routes.Remove(PrintOrderInformationForAllOrders);
            routes.Insert(2, PrintOrderInformationForAllOrders);

            var GetAllTransportAgreements = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.GetAllTransportAgreements",
               "Admin/logistra/GetAllTransportAgreements",
               new { controller = "Logistra", action = "GetAllTransportAgreements", area = "Admin" },
               new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
          );
            routes.Remove(GetAllTransportAgreements);
            routes.Insert(3, GetAllTransportAgreements);

            
        }

        public int Priority
        {
            get { return 0; }
        }


Here is the description for the plugin:

Group: x
FriendlyName: Logistra ShippingAdmin
SystemName: Shipping.LogistraAdmin
Version: 1.0.1
SupportedVersions: 3.80
Author: x
DisplayOrder: 1
FileName: Nop.Plugin.Shipping.LogistraAdmin.dll


Does anyone see whats wrong?
7 years ago
I've also tried this:

public void GetConfigurationRoute(out string actionName, out string controllerName, out RouteValueDictionary routeValues)
        {
            actionName = "Configure";
            controllerName = "Logistra";
            routeValues = new RouteValueDictionary { { "Namespaces", "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }, { "area", null } };
        }


My plugin uses IAdminMenuPlugin, which seems to make it harder using configure. Could it be the case?
7 years ago
lintho wrote:
Hello.

I have the following routeProvider config:

public void RegisterRoutes(RouteCollection routes)
        {


           var configureRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.Configure",
                "Plugins/Shipping.LogistraAdmin/Configure",
                new { controller = "Logistra", action = "Configure" },
                new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
           );
            routes.Remove(configureRoute);
            routes.Insert(0, configureRoute);



            var indexRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin",
                  "Admin/Logistra",
                  new { controller = "Logistra", action = "Index", area = "Admin" },
                  new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
             );
            routes.Remove(indexRoute);
            routes.Insert(0, indexRoute);
            
            var processRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.LogistraProcess",
                 "Admin/logistra/process/{id}/{carrier}/{ident}",
                 new { controller = "Logistra", action = "ProcessConsignment", area = "Admin" },
                 new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
            );
            routes.Remove(processRoute);
            routes.Insert(1, processRoute);

            var seeAllOrdersRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.SeeAllOrders",
                "Admin/logistra/SeeAllOrders",
                new { controller = "Logistra", action = "SeeAllOrders", area = "Admin" },
                new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
           );
            routes.Remove(seeAllOrdersRoute);
            routes.Insert(2, seeAllOrdersRoute);


            var mainPrinterRoute = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.SetMainPrinter",
                "Admin/logistra/setMainPrinter/{printerId}",
                new { controller = "Logistra", action = "SetMainPrinter", area = "Admin" },
                new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
           );
            routes.Remove(mainPrinterRoute);
            routes.Insert(2, mainPrinterRoute);


            var PrintOrderInformationForAllOrders = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.PrintOrderInformationForAllOrders",
                "Admin/logistra/PrintOrderInformationForAllOrders",
                new { controller = "Logistra", action = "PrintOrderInformationForAllOrders", area = "Admin"},
                new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
           );
            routes.Remove(PrintOrderInformationForAllOrders);
            routes.Insert(2, PrintOrderInformationForAllOrders);

            var GetAllTransportAgreements = routes.MapRoute("Nop.Plugin.Shipping.LogistraAdmin.GetAllTransportAgreements",
               "Admin/logistra/GetAllTransportAgreements",
               new { controller = "Logistra", action = "GetAllTransportAgreements", area = "Admin" },
               new[] { "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }
          );
            routes.Remove(GetAllTransportAgreements);
            routes.Insert(3, GetAllTransportAgreements);

            
        }

        public int Priority
        {
            get { return 0; }
        }


Here is the description for the plugin:

Group: x
FriendlyName: Logistra ShippingAdmin
SystemName: Shipping.LogistraAdmin
Version: 1.0.1
SupportedVersions: 3.80
Author: x
DisplayOrder: 1
FileName: Nop.Plugin.Shipping.LogistraAdmin.dll


Does anyone see whats wrong?






Write bellow code at your LogistraAdminPlugin.cs class


public void GetConfigurationRoute(out string actionName, out string controllerName, out RouteValueDictionary routeValues)
        {
            actionName = "Configure";
            controllerName = "Logistra";
            routeValues = new RouteValueDictionary { { "Namespaces", "Nop.Plugin.Shipping.LogistraAdmin.Controllers" }, { "area", null } };
        }


Why you always remove and insert route, are there any possibility of duplicate route name? if not then no need to remove delete.
7 years ago
Without removing and adding the routes, it does not work. I never have to remove and add routes when im creating normal plugins without the IAdminMenuPlugin.
7 years ago
I was missing the implementation of IMiscPlugin in my LogistraAdminPlugin class.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.