Example Action Delegate Pipeline Integration Project

Overview

The action delegate pipeline is only one of many built-in extension points that Hotcakes Commerce has available for you to get the most value out of your e-commerce experience – for you as the merchant, as well as your customers.  This specific extension point allows you to intercept the workflow of the customer at a few key moments to execute logic as needed.

Requirements

The following concepts and knowledge are required to complete the goals of this article:

  • Familiarity with Visual Studio 2012 or newer
  • Familiarity with C#
  • General understanding of frameworks
  • Have a site ready with Hotcakes Commerce installed

Getting Started

You are about to use a Visual Studio project to connect to your Hotcakes Commerce store.  The project can be downloaded on the right.  The documentation below will walk you through how to use this project.

Make sure you have a development website ready to accept API calls from your project.  This would consist of the DNN CMS and Hotcakes Commerce.  Also, if you do not already have products in your store, you should consider adding some or adding the sample products.  This could even be a restored back-up of your production website.

Action Delegate Pipeline Integration Sample Project

If you haven’t done so already, make sure your site is up and running and ready for you to develop on it. We are about to have you set up your project.  Once you understand how this works, feel free to set up your project and solution in any way that works for you.  Also, please do not do this development work on your production website.

Open the download from above using your favorite zip utility.  Grab all of the files from the zip archive and unzip them into the root of your development site.

Drag and drop files from the zip to your website folder

If you receive any prompts from Windows, it’s likely that you already have a set of Hotcakes project files added to your development site.  Go ahead and overwrite the files.  This should result in the MyIntegration, References, and MyIntegration.sln folders and files in your DNN folder as shown below.

Project files are in the website folder

Next, open the solution that is now in the root of your website.  Double-clicking on it will do the trick.  This will open Visual Studio and show your project open.  Your Solution Explorer view should look similar to the image below.

Visual Studio Solution Explorer showing the project files

You will notice three (3) class files in the solution.  You can use one (1), two (2) or all three if you’d like.  It’s up to you.

File Name Integration Name Description
MyCartIntegration.cs BeforeProceedToCheckout Used for executing logic before loading the checkout page. This allows you to perform logic and determine whether the customer should still proceed to checkout or not. A common usage of this would be to check an external service or data source to ensure inventory still exists.
MyCheckoutIntegration.cs BeforeCheckoutCompleted This is essentially an event that you can plug into when the customer clicks to complete the checkout process. This allows you to execute custom logic and determine whether you want to allow the checkout process to complete or not. This is a very convenient moment to verify details against other services or data sources and to update inventory.
MyProductIntegration.cs BeforeProductAddedToCart You can execute code at the moment that the user chooses to add a product to the cart using this integration point. This can allow you to verify product availability or any other number of tasks before determining if the product should continue to get added to the cart.

Integration Result Object

Each of the action delegate pipeline integrations that you can extend makes use of a Hotcakes Commerce type of IntegrationResult.  You must return this object in order to properly integrate with the action delegate pipeline.  The IntegrationResult class has two properties, listed in the table below.

Property Values Description
AbortMessage String This value is only necessary if you choose to abort the integration event. If IsAborted is false, this value will be displayed to the customer. You should be very specific about why the action was aborted for the best customer service experience. Please note: While an empty string is accepted, an empty string should not be used.
IsAborted Boolean If true, the specific integration event will not proceed. The customer will instead see the message you put into the AbortMessage property.

In your custom integration, you would first add and perform any necessary logic, then return the IntegrationResult object, as shown in the image below.

Example Action Delegate Pipeline Code

From this point forward, just adjust the code samples as you need to in order to build your own applications to integrate with your Hotcakes Commerce store.

Deploying Your Code – Development Environment

If you are in your development environment, all you would need to do is:

  1. Ensure that you are building to the /Bin directory of your website
  2. Choose the integration you build in the Store Admin > Admin > Extensibility view  (see below for a screenshot)

Deploying Your Code – Production

Once you are happy with the results of your action delegate pipeline integration, build it in release mode and move the DLL you have built to the /Bin directory of your production website.  The name of the DLL will be whatever you have chosen to name it in your project properties.

Once you move the DLL file, choose the new integration(s) in your Store Admin > Admin > Extensibility view.  Select the extension in the appropriate drop-down list as shown below.

Choosing a custom integration in the Admin > Extensibility view

That’s it…  We hope you think this is as easy as we do!

 

Have more questions? Submit a request

Need More Help?

Do you need more assistance with this article? Please review your support options.