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?
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?
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
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
publicoverridevoid 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.
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.