Hassan Abbas Hassan Abbas - 1 year ago 275
ASP.NET (C#) Question

override default method route from plugin in nopcommerce in 3.8

I want to override search controller. When I try to install a plugin, I get an error exception what multiple type were found for the controller named


Multiple types were found that match the controller named 'Catalog'. This can happen if the route that services this request ('AdvanceSearch') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter.

And my route priority is most(100).

public void RegisterRoutes(RouteCollection routes)
// Product Search,
new { controller = "Catalog", action = "Search" },
new[] { "Nop.Plugin.Misc.Twigoh.Search.Controllers" });

public int Priority
return 100;

Div Div
Answer Source

You can override your route like this:

When you override route, then you should use MapLocalizedRoute(not MapRoute) which is override localized route. Here you are trying to define route which is already define.

Here do not use MapRoute use MapLocalizedRoute in this way.

                            new { controller = "Catalog", action = "Search" },
                            new[] { "Nop.Plugin.Misc.Twigoh.Search.Controllers" });


I want same route and functionality but default controller can't have "/" search feature little bit different

/search is default route of product search, you can see in Nop.Web > Infrastructure > RouteProvider.cs

Hope this helps!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download