How to call plugin service which has extra attributes, its not override of actual service in core

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 years ago
Hi,

My requirement is bot different, While adding product to shopping cart, i wanted to replace method with my own service method which has extra parameters, its not override of actual service.

Is there any way to do this or do i need to replace entire addtocart controller method?
3 years ago
What is it that you are trying to do?   You may be able to use an Action Filter.
3 years ago
New York wrote:
What is it that you are trying to do?   You may be able to use an Action Filter.


I am trying to use only start date and duration for rental products instead of start and end date. So, now from core attribute parser i want it to validate my new fields instead of default core rental fields.

I am looking for a way to override existing method with extra parameters instead of rewriting entire controller logic.
3 years ago
You can make a new product template which has a new version of _AddtoCart.cshtml which in tern actions new versions of existing routines to validate and addtocart

Did you see my plugin https://www.nopcommerce.com/en/accommodation-event-bookings-and-rentals which adds to and improves the Rental System :)
3 years ago
Yidna wrote:
You can make a new product template which has a new version of _AddtoCart.cshtml which in tern actions new versions of existing routines to validate and addtocart

Did you see my plugin https://www.nopcommerce.com/en/accommodation-event-bookings-and-rentals which adds to and improves the Rental System :)


Thank you, I have seen that plugin, but for me its a bit expensive. So, I am trying to develop my own.
Can you please suggest me how to override default routes from plugin. I created my own version of _AddtoCart template but, now i am trying to override route for "AddProductToCart-Details", or else is it good idea to create our own route? If yes, how to create our own route?


Thanks
3 years ago
I mapped my own route

endpointRouteBuilder.MapControllerRoute("AddProductsToCart-Rental", "addrentalproductstocart/details/{productId:min(0)}/{shoppingCartTypeId:min(0)}",
    new { controller = "CustomShoppingCart", action = "AddProductsToCart_Rental" });
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.