Adding a step to checkout and overriding checkout controller

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 年 前
Hi guys. Im having some trouble figuring out how to add an additional step to the checkout page.
I've overridden the view, the js and now Im trying to override the controller to change the flow so that from payment info step it goes to my additional info step and then to confirm order step.

I can't remove the route of the Nop.Web.Controllers to add Nop.Plugin.Misc.<myplugin>.Controllers.
If I use
public int Priority
        {
            get
            {
                return -1;
            }
        }
public void RegisterRoutes(RouteCollection routes)
        {
ViewEngines.Engines.Insert(0, new CostumViewEngine());
            
            routes.Remove(routes["Checkout"]);
            routes.MapLocalizedRoute("Checkout",
                            "checkout/",
                            new { controller = "Checkout", action = "Index" },
                            new[] { "Nop.Plugin.Misc.<myplugin>.Controllers" });
}

I get an error saying that Checkout method was not found.


If I use:


public int Priority
        {
            get
            {
                return 100;
            }
        }
public void RegisterRoutes(RouteCollection routes)
        {
ViewEngines.Engines.Insert(0, new CostumViewEngine());
            
var route = routes.MapLocalizedRoute("MyCheckout",
                            "checkout/",
                            new { controller = "Checkout", action = "Index" },
                            new[] { "Nop.Plugin.Misc.<myplugin>.Controllers" });
            routes.Remove(route);
            routes.Insert(0, route);
}


It doesn't work because there is some other Nop.Web controllers using redirects by name, like:

[ValidateInput(false)]
[HttpPost, ActionName("Cart")]
[FormValueRequired("checkout")]
public ActionResult StartCheckout(FormCollection form){
....
return RedirectToRoute("Checkout");
}

And it keeps using the Nop.Web.Controllers CheckoutController instead of Nop.Plugin.Misc.<myplugin>.Controllers CheckoutController...

Does anyone know how to fix this or a better way to do it?
I also need to use a WebService later, in the confirm order so I will need to override that aswell.
Thanks
7 年 前
This might be late, but you might want to check out this one:
https://www.pronopcommerce.com/overriding-intercepting-nopcommerce-controllers-and-actions
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.