We are trying to implement a plugin which sends emails to the customers who have a product in their wishlist if the price for that product changes.
What we tried so far was to override the Edit from ProductController:
[Area(AreaNames.Admin)]
[AuthorizeAdmin]
[AutoValidateAntiforgeryToken]
public class ProductController : Nop.Web.Areas.Admin.Controllers.ProductController
{
private readonly IBackInStockSubscriptionService _backInStockSubscriptionService;
private readonly ICustomerActivityService _customerActivityService;
...
public ProductController(...)
: base(...)
{
....
}
[HttpPost, ParameterBasedOnFormName("save-continue", "continueEditing")]
public async override Task<IActionResult> Edit(ProductModel model, bool continueEditing)
{
....
}
public class RouteProvider : IRouteProvider
{
public int Priority => int.MaxValue;
public void RegisterRoutes(IEndpointRouteBuilder endpointRouteBuilder)
{
endpointRouteBuilder.MapControllerRoute(Constants.ConfigurationRouteName,
"~/Admin/Product/Edit",
new { controller = "Product", action = "Edit", area = AreaNames.Admin });
}
}
But we are getting an error
AmbiguousMatchException: The request matched multiple endpoints. Matches:
Nop.Web.Areas.Admin.Controllers.ProductController.List (Nop.Web)
<pluginName>.Areas.Admin.Controllers.ProductController.List (<pluginName>)
but shouldn`t the plugin override just that method? If not, how can it be done?
Is there a way to achieve this via a plugin without editing the core code? (nopCommerce 4.50)
Thank you in advance!