addproducttocart/catalog/{productId}/{shoppingCartTypeId}/{quantity}
Since it's not working, I'm wondering if this is even allowed? The normal code takes the ajax path above and re-routes to the Shopping Cart controller's AddProductToCart_Catalog ActionResult method.
I created my own shopping cart controller with a new method AddProductToCart_Catalog ONLY within my own namespace, and the re-routing isn't working. When I call the ajax function with the path w/ajax, it still goes to the nop.web core version of AddProductToCart_Catalog ActionResult (I added a breakpoint in the shopping cart controller there to check and it still gets hit.) (Am I missing something?) (Do I also have to override the AddProductToCart_Catalog method in the shopping cart controller as well?)
Here's my routeprovider code:
using System.Web.Mvc;
using System.Web.Routing;
using Nop.Web.Framework.Localization;
using Nop.Web.Framework.Mvc.Routes;
namespace Nop.Plugin.Custom.DealerDoorSelectionCenters
{
public partial class RouteProvider : IRouteProvider
{
public void RegisterRoutes(RouteCollection routes)
{
routes.MapLocalizedRoute("Plugin.Custom.DealerDoorSelectionCenters.AddProductToCart-Catalog",
"addproducttocart/catalog/{productId}/{shoppingCartTypeId}/{quantity}",
new { controller = "ShoppingCart", action = "AddProductToCart_Catalog" },
new { productId = @"\d+", shoppingCartTypeId = @"\d+", quantity = @"\d+" },
new[] { "Nop.Plugin.Custom.DealerDoorSelectionCenters.Controllers" });
// Original local route here:
//routes.MapLocalizedRoute("AddProductToCart-Catalog",
// "addproducttocart/catalog/{productId}/{shoppingCartTypeId}/{quantity}",
// new { controller = "ShoppingCart", action = "AddProductToCart_Catalog" },
// new { productId = @"\d+", shoppingCartTypeId = @"\d+", quantity = @"\d+" },
// new[] { "Nop.Web.Controllers" });
}
public int Priority => 10;
}
}