Developer Resources for AbleCommerce eCommerce platform
In This Topic
    Event System
    In This Topic

    Take a look at /CommerceBuilder/Eventing/DefaultEventsHandler.cs.

    You may also wish to purchase the AbleCommerce source code as a reference, or to tie directly into the core eventing engine.

    Extending the Store Event Handler

    You can easily extend the store event handler and add your own code when store event occurs. For example, define a new event handler class like this.

    Example MyEventsHandler
    Copy Code
    public class MyEventsHandler
    {
            /// <summary>
            /// Initializes a new instance of the MyEventsHandler class
            /// </summary>
            public MyEventsHandler()
            {
            }
            /// <summary>
            /// Custom event handler implementation for OrderPlaced event
            /// </summary>
            /// <param name="o">The object that raised the event</param>
            /// <param name="e">Event arguments for this event</param>
            public virtual void OrderPlaced(object o, OrderPlacedEventArgs e)
            {
                Order order = e.Order;
                AbleContext.Current.Database.BeginTransaction();
                // do some event handling here
                AbleContext.Current.Database.CommitTransaction();
            }
            /// <summary>
            /// Default event handler implementation for OrderCancelled event
            /// </summary>
            /// <param name="o">The object that raised the event</param>
            /// <param name="e">Event arguments for this event</param>
            public virtual void OrderCancelled(object o, OrderCancelledEventArgs e)
            {
                Order order = e.Order;
                AbleContext.Current.Database.BeginTransaction();
                // do some event handling here
                AbleContext.Current.Database.CommitTransaction();
            }
    }

    And then hook these event handlers functions at application start:

    Copy Code
    var eventHandler = new MyEventsHandler();
                 EventsManager.Instance.OrderPlaced += new OrderPlacedHandler(eventHandler.OrderPlaced);
                 EventsManager.Instance.OrderCancelled += new OrderCancelledHandler(eventHandler.OrderCancelled);

    Now both the default event handlers and your own event handlers will be executed when the respective store events will occur. For a complete list of events check the following interface: 

    CommerceBuilder.Eventing.IStoreEventsHandler definition

     

    Purchase option for the CommerceBuilder Source Code

    We offer an option to purchase the source code for AbleCommerce.  This will give you access to the DLL files.  Otherwise, you will already have access to everything else because we only encrypt the DLL's in the downloadable version.

    Some developers find it helpful to purchase the source code and use it as a reference, but in most cases, it is not required for customizations nor do we suggest that you modify the source. This will only make upgrades more difficult.

    https://www.ablecommerce.com/CommerceBuilder-Source-Code-P240.aspx

    We do not have a separate maintenance fee for the source code purchase.  As long as you maintain an active subscription for the corresponding license, then we include free source code updates at no additional charge.