Adding additional step to the checkout process NopCommerce V4.4

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 2 años
I want To Add additional step in a plugin to the checkout process to add a gift if the customer meet some rules.
I'm new to nopCommerce developpement , can anyone guide me through the right process with the best practice of nopCommerce plugin developpement to achieve this.
Thanks
Hace 2 años
You could override the checkout controller, and add an additional step, or use an Action filter to add an extra step where you want.
Hace 2 años
Thanks For the reply,
since i'm new to nopCommerce if ther's a small example of an action filter i'll be very greatful.
Thank you
Hace 2 años
This should give you an idea : https://www.majako.net/how-to-create-a-custom-action-filter-in-nopcommerce-v4/
Hace 2 años
Thank You So Much :)
Hace 2 años
It's Working like a charm :)
Thank you so much Again :)
Hace 2 años
No problem, glad you got sorted out :)
Hace 2 años
One thing I should say, is maybe post a small snippet of your code so that it may help others out in future :)
Hace 2 años
For sure m. First thing to do tomorrow :)
Hace 2 años
This is a snippet of My Code :
1- we should create our filter attribute that inherits From ActionFilterAttribute
public class WelcomeProgramAttribute : ActionFilterAttribute
    {
        private readonly IWelcomeGiftCalculationMethod _welcomeGiftCalculationMethod;

        public WelcomeProgramAttribute(IWelcomeGiftCalculationMethod welcomeGiftCalculationMethod)
        {
            _welcomeGiftCalculationMethod = welcomeGiftCalculationMethod;
        }

        public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            if (context.ActionDescriptor is ControllerActionDescriptor actionDescriptor && actionDescriptor.ControllerTypeInfo == typeof(ShoppingCartController)
                && actionDescriptor.ActionName.Equals("Cart"))
            {
                await _welcomeGiftCalculationMethod.CheckWelcomeGiftRules();
                await next();
            }
            else
            {
                await next();
            }
                

        }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.