Sitefinity Ecommerce - Pre-purchasing processing hook

Sitefinity Ecommerce - Pre-purchasing processing hook

May 24, 2012 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

Another hook introduced into Sitefinity 5.0 is a pre-processing hook that allows you to write customized code through a pre-purchase processing hook in the Ecommerce module.   This could be used to do any business logic that a merchant needs before processing an order.   A developer can create custom code and register the code to be called before the order is placed.
There are endless reasons for why you would want custom code to be executed before placing the order.  Below are just a few ideas on how you may take advantage of this extendable and powerful new feature in Sitefinity Ecommerce.
1.    Perform any business logic needed before purchasing and cancel an order if it doesn’t pass validation.
2.    Check inventory quantities with a third party software package such as SAP, NetSuite, QuickBooks and Microsoft Dynamics.
3.    Allow specific products to be purchased based on rules such as 1) only product B to be purchased if product A has been purchased in the past by that user or role.
4.    Check low inventory quantities – send email to applicable purchaser.
5.    Change pricing if needed based on roles or some other business rules.

To use these events developers should add Global.asax file to SitefinityWebApp project and subscribe to the Ecommerce events.

The Ecommerce specific events can only be registered after Sitefinity’s Bootstrapper has initialized.  So, first subscribe to the Bootstrapper.Initialized method. In the Bootstapper_Initialized method you can subscribe to Ecommerce specific events like EcommerceEvents.OrderPlaced or EcommerceEvents.PaymentResponse.

See the code below for an example.

I am sure you will find this feature very helpful allowing you to integrate customizations that you may need for your online store.  All future exposed events will be in the EcommerceEvents class. 


The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments are disabled in preview mode.
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

More From Progress
ProgressNEXT: Premier Event for Modern Application Development
Read More
Seven Reasons to Check Out Sitefinity 11.1
Read More
Getting Started with Your Omnichannel Content Strategy
Read More