I need to override Admin action result for add product to order in my plugin. But I am getting this error.
AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied:
I have write this code.
public class OrderController : Nop.Web.Areas.Admin.Controllers.OrderController { public virtual IActionResult AddProductToOrder(int orderId) { //prepare model //[I will prepare model as per my requirement]
Use action filter for prepare your model. You can override PrepareAddProductToOrderSearchModel method in OrderModelFactory as per your requirement.
public partial class PluginModelFactory : IOrderModelFactory,OrderModelFactory { // your fields public PluginModelFactory():base(// needed fields for base) {
}
public override AddProductToOrderSearchModel PrepareAddProductToOrderSearchModel(AddProductToOrderSearchModel searchModel, Order order) { // prepare your code as per your requirement } }
please register in your DependencyRegistrar.cs file.
You cannot directly do that using route override, use action filter instead. Please follow the below link for your answer. https://www.pronopcommerce.com/overriding-intercepting-nopcommerce-controllers-and-actions
Thank you Sagar Kayasth
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Vous avez encore des questions ou avez besoin d'aide?