How to hook and execute custom code against store events

From AbleCommerce Wiki
Revision as of 14:03, 22 May 2013 by Mazhar (Talk | contribs)

Jump to: navigation, search

In past we saw this question from time to time where developers asking for the ability to intercept store events like Order Placed, Order Paid etc. The good news is, now it will be possiable to intercept all avilable event triggers in Gold R5 and upwards. We have incorporated the support to implement store event handling more like a service. Out of the box there is default event handling implemented and configured. In order to provide your custom handling you can create your cutom event handler by following certain rules and then can plug it in place of default one.

Out of the box CommerceBuilder.Eventing.DefaultEventsHandler class provides the default event handling. If you want to override the default event handling completly then all you need is to implement CommerceBuilder.Eventing.IStoreEventsHandler interface. Alternativly you can also extend your class from CommerceBuilder.Eventing.DefaultEventsHandler and override specific event handler methods. Once you are done with your custom event handler you can register it into application by creating an entry in Website/App_Data/windsor.config file. This will hook your custom event handler and route the execution control to your custom class against events.