I've managed to override the ShoppingCartController with a plugin, but I have had to modify the core, because overriding the procedure was causing an error - I did a simple modification by adding "virtual" to the method I needed to override :
I had to modify the original ShoppingCartController.cs in Nop.Web
This is the first override I've done on a controller as it is quite a difficult, but it could be easier. I've seen in the change logs about adding "virtual" - but as this is the first time I've had to modify the core I wanted to ask if this "virtual" attribute will be added to the controllers for future versions of nop, so that overriding controllers via plugins is easier. For a previous plugin I had to copy the controller, create a duplicate and override the routes - but this method allows me to override just what I need, so upgrades will be easier to maintain.
in my plugin i also had to extend the shoppingcartcontroller and to accomplish without modifying the nop code i did it in the same way as mattsoundworld said.
it works very well, but it doesn't feel fine to copy the source in your own plugin, i also think that all public controller methods should be at least virtual
Basically - It's a customization to allow no VAT for certain size variations (UK, child sizes are VAT Free!) I don't need to override any of the Actions for this plugin - only the [NonActions] - the plugin has overrides for:
Adding "virtual" to the functions I need to override means that I have to use a custom Nop.Services.dll and Nop.Web.dll - but this isn't an issue for this project as I've documented the process and hopefully when we upgrade to 3.3 all the protected [NonAction] functions in all the controllers will have "virtual" added - I will put a request in the 3.3 thread for this to see if it's possible.
Upgrading the store in question from 3.1 to 3.3 has highlighted that I still need to modify the core to give the functionality I need. I have now voted for the workitem (bit late I know ;-) as we have some more stores being developed that need the zero VAT for child sizes, so I hope that the plugin architecture can be further developed for future versions of Nop.
Is there a way that I can contribute to the plugin architecture? There are a few more points in the code where dummy classes could be added, specifically for adding routines from plugins - one that comes to mind would be in the Global.asax Application_Begin_Request.
I've finished the upgrade and I can see that some of the proposed work has been completed, but I still have a custom Nop.Admin.Dll and Nop.Web.Dll because "virtual" hasn't added to the [NonAction]'s in the controllers; specifically:
nop.admin - OrderController, line 228, protected virtual void PrepareOrderDetailsModel(OrderModel model, Order order)