i'm currently writing a plugin in which i want to modify some behaviors of the shopping cart controller:
so this is what i did:
I made a new controller inheriting from ShoppingCartController, like:
public class MyOwnProductShoppingCartController : ShoppingCartController
and in the RouteProvider i did:
public void RegisterRoutes(RouteCollection routes)
{
routes.MapLocalizedRoute("Plugin.NopSolutions.HandlingFeeProduct.ApplyDiscountCoupon",
"cart/",
new { controller = "MyOwnProductShoppingCart", action = "Cart" },
new[] { "Nop.Plugin.NopSolutions.MyOwnProduct.Controllers" }
);
}
public int Priority
{
get
{
return 2;
}
}
Then in the controller i added the following method:
[ValidateInput(false)]
[HttpPost, ActionName("Cart")]
[FormValueRequired("applydiscountcouponcode")]
public ActionResult MyOwnApplyDiscountCoupon(string discountcouponcode, FormCollection form)
{
//some code
}
After installing my plugin, when i apply a discount i get the following error:
The current request for action 'Cart' on controller type 'HandlingFeeProductShoppingCartController' is ambiguous between the following action methods:
System.Web.Mvc.ActionResult MyOwnApplyDiscountCoupon(System.String, System.Web.Mvc.FormCollection) on type Nop.Plugin.NopSolutions.HandlingFeeProduct.Controllers.HandlingFeeProductShoppingCartController
System.Web.Mvc.ActionResult ApplyDiscountCoupon(System.String, System.Web.Mvc.FormCollection) on type Nop.Web.Controllers.ShoppingCartController
What am i doing wrong?