Hi.
Develop plug-ins in Nop 4.10.
This article has been translated by Google Translator. Thank you for your understanding.
I want to override the existing Home screen in the plugin.
I have read this topic (http://www.strivingprogrammers.com/Beginners-Guide-to-nopCommerce-Plugin-Development-ASP-NET-MVC-Based-e-Commerce-Solution-Part-2).
I tried to follow it, but the version of the above article (Nop 3.7) seems to be different because it is different.
I am interested in this topic [How to override a default view from your customer plugin].
However, an error occurs in this part.
public class LocalizedRoute: Route
{
.
.
.
public LocalizedRoute (IRouter target, string routeName, string routeTemplate, RouteValueDictionary defaults,
IDictionary <string, object> constraints, RouteValueDictionary dataTokens, IInlineConstraintResolver inlineConstraintResolver)
: base (target, routeName, routeTemplate, defaults, constraints, dataTokens, inlineConstraintResolver)
{
_target = target ?? throw new ArgumentNullException (nameof (target));
}
}
Error content:
Microsoft.AspNetCore.Routing.RouteCreationException: 'An error occurred while creating the route with name' HomePagePlugin 'and template' '.'
RouteCreationException: The constraint entry 'Length' - '1' on the route '' must be a string value or a type which implements 'Microsoft.AspNetCore.Routing.IRouteConstraint'.
Below is the calling code, which is the code in the topic of interest.
public void RegisterRoutes (IRouteBuilder routeBuilder)
{
// home page
routeBuilder.MapLocalizedRoute ("HomePagePlugin", "",
new {controller = "Home", action = "Index"},
new [] {"Nop.Plugin.Misc.MyCustomPlugin.Controllers"});
}
The code here does not seem to fit in the .NET Core 2.1 environment.
What should I do?