I need to override the default behavior of the Register page and add a few fields to it. I have created a plugin which should do the overriding. In that plugin I have the RouteProvider.cs which is like this:
namespace Nop.Plugin.Misc.MyCustomPlugin
{
public class RouteProvider : IRouteProvider
{
private const string NAMESPACES = "Nop.Plugin.Misc.MyCustomPlugin.Controllers";
private const string CONTROLLER = "MyCustomPlugin";
public int Priority => int.MaxValue;
public void RegisterRoutes(RouteCollection routes)
{
routes.MapLocalizedRoute("Register",
"register/",
new { controller = CONTROLLER, action = "Register" },
new[] { NAMESPACES });
}
}
}
But this causes an error that the route names must be unique. If I change the name of the route then it installs fine but does not override the register page.
I have successfully overridden the About page with this route:
routes.MapGenericPathRoute("Plugin.Misc.MyCustomPlugin.GenericUrl",
"{generic_se_name}",
new { controller = "Common", action = "GenericUrl" },
new[] { NAMESPACES });
Which confuses me a bit.
How would I go about redirecting the register link to my own controller and method (action)?