Add checkout fields (or better add checkout step with a plugin)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 年 前
Hello,

I'd like to write a plugin for the checkout process where I will add some special checkout fields. Because those fields are a bit more complex I think I cannot use the built-in checkout attributes.

So my question is how should I start with this plugin? Do I need to create a general plugin or a payment plugin? How can I include my plugin's fields into the checkout view?

EDIT: I think now, that I need to create a widget. I have already managed to render some fields with a widget. However, I would like to add an entire new checkout step. How can this be done with a plugin?


Thank you very much for any answers!
multi
9 年 前
multidigital wrote:
Hello,

I'd like to write a plugin for the checkout process where I will add some special checkout fields. Because those fields are a bit more complex I think I cannot use the built-in checkout attributes.

So my question is how should I start with this plugin? Do I need to create a general plugin or a payment plugin? How can I include my plugin's fields into the checkout view?

EDIT: I think now, that I need to create a widget. I have already managed to render some fields with a widget. However, I would like to add an entire new checkout step. How can this be done with a plugin?


Thank you very much for any answers!
multi


Perhaps you can look at this: http://www.pronopcommerce.com/overriding-intercepting-nopcommerce-controllers-and-actions.

What you can do is:

1. Check for the specific controller / action
2. Use ActionFilter to redirect to your plugin controller / action when [1] is reached
3. Redirect back to original flow when [2] is finished

Hope this helps! :)
9 年 前
Hello,

thank you very much for your answer. It sounds a bit difficult. Also, I aim only to work with plugins since I do not want to change the source code.

Thanks anyway,

multi
9 年 前
Yes, what I am describing is plugin-only approach... You don't need to modify source code... That is the power of ActionFilter anyway... :)
7 年 前
Hey there,
I am stuck on what you whooncherk described as [2]
I am using Actionfilter to add a step on checkout process right before BillingAddress is shown.
I call my own plugin function with a view. When the view form is handled I would like to get back
on track to go on with standard NOP Checkout Progress. But I don't know where to put my call.

My Filter
   public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);
            switch (filterContext.ActionDescriptor.ActionName)
            {
                case "BillingAddress":
                    {
                         var shoppingCartController = EngineContext.Current.Resolve<AboCheckoutController>();
                        filterContext.Result = shoppingCartController.ReisendenIdentifikation();
                      
                        break;
                    }
            }
        }


My AboCheckoutController

public ActionResult ReisendenIdentifikation(AboReisendenIdentifikationModel oMod)
        {
//some code
return View();
//there should be redirection now to BillingAddress simple Redirect won't work or I messed up the code
}


I am sure there is a way I just don't see right now.
7 年 前
I need to correct myself,
I am stuck on [3]
Redirect back to original flow.

My problem is, when I call
return  RedirectToAction("BillingAddress","Checkout");
from my Action itself, it would lead me back into the filter.
So I would need to call it inside the filter itself.
But have not figured out how to do that properly.
Do I have a possibility to know who originally called and get back there....
Right now  I am trying to avoid an endless circle.
7 年 前
You could store a 'timestamp' in a generic attribute (associated with customer).
7 年 前
Thank you.
Maybe I was just tired.
You gave me the right idea...I solved it.

I added a parameter to the redirect in my controller function

return  RedirectToAction("BillingAddress","Checkout",new{ done=true});

                


and then simply caught the parameter in my filter

 public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
switch (filterContext.ActionDescriptor.ActionName)
            {

                case "BillingAddress":
                    {
          if (filterContext.RequestContext.HttpContext.Request.RawUrl.Contains("done"))
                  break;
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.