I have created a custom version of the Catalog/Category action.
In short it looks like this:
namespace Strelli.Nop.Controllers {
public partial class CatalogController : BasePublicController {
//ctor and stuff ...
[NopHttpsRequirement(SslRequirement.No)]
public ActionResult Category(int categoryId, CatalogPagingFilteringModel command) {
//custom stuff
}
}
}
I tried creating a custom routeprovider to hijack the calls to Catalog/Category like so:
namespace Strelli.Nop.Infrastructure {
public class StrelliRouteProvider : IRouteProvider {
public int Priority => 1000;
public void RegisterRoutes(RouteCollection routes) {
routes.MapGenericPathRoute(
"StrelliCategory",
"{SeName}",
new { controller = "Catalog", action = "Category" },
new[] { "Strelli.Nop.Controllers" }
);
}
}
}
But now I get the following error:
The parameters dictionary contains a null entry for parameter 'categoryId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Category(Int32, Nop.Web.Models.Catalog.CatalogPagingFilteringModel)' in 'Strelli.Nop.Controllers.CatalogController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters
What am I missing?