+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

Sitefinity 5.0 Ecommerce Features Explained

by Steve Miller

In this blog post, I will explain how to create a digital download, how the pre-processing hook works and review the update we made to product variations adding support for multilingual variations.

Digital Downloads

Below are the steps you would follow when creating a digital download in the Sitefinity backend.

Step 1) Create a Product Type and assign the type as a “Downloadable product”. You can add fields for this product type such as the artist, author, ISBN, manufacturer, number of pages, etc…

clip_image002a

Step 2) Create a product based on the product type just created.

clip_image003

Add a new product and select the “File to Download” button. Select the file from their local computer or use a file which has already been uploaded and attach it to the product.
clip_image004

clip_image005

Once completed, the file is then saved into the system folder library and attached to the product.

Customer download

Upon successful purchase by the customer, the customer can go to their My Account page to download the digital file.

clip_image007

Pre-Processing Hook

The Pre-Processing hook provides the ability for a developer to cancel an order based on a custom order processing rule. You can create a custom rule to cancel the order if the order did pass certain pre-defined rules. For example, you may want to check the inventory quantity from an ERP system before you communicate with the payment gateway. The OrderValidator class allows you the ability to show a Friendly Error Message on why an order did not go through.

(The pre-processing hook compliments our post-processing hook which was released in version 4.4. With the post-processing hook, a call can be made to a CRM or ERP system transmitting the successful order information automatically into a 3rd party system.)

Documentation article(s) / Extension sample(s):

Add a Global.asax file then add the code below in a cs file

Protected void Application_Start(object sender, EventArgs e) 
{ 
Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized); 
} 
void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e) 
{ 
if (e.CommandName == "Bootstrapped") 
{ 
EcommerceEvents.PreProcessOrder += new EcommerceEvents.OnPreProcessOrder(EcommerceEvents_PreProcessOrder); 
} 
} 
OrderValidator EcommerceEvents_PreProcessOrder(Guid cartOrderId, CheckoutState checkoutState, Customer customer) 
{ 
bool isOrderValid = DateTime.Now.Second % 2 == 0; 
OrderValidator orderValidator = new OrderValidator 
{ 
IsOrderValid = isOrderValid, 
StatusMessage = "Order failed because of my custom rule" 
}; 
return orderValidator; 
} 
 

Multilingual Variations

If the site is multilingual then the attributes/values can also be shown another languages.

Follow the steps below to create a multilingual variation:

Step 1) Administration->Settings, click the Languages on the left nav.

clip_image009

Step 2) Go to Ecommerce->Attributes

clip_image010

Step 3) View the attributes

clip_image012

Click “ES” adding the Spanish version, then enter the Spanish name for the Attribute:

clip_image014

Then add the values in the second language:

clip_image016

clip_image018

Once you’ve translated the attributes/values then you can view the product and the variations on the store front.

Here is a screen shot in English

clip_image020

Here is the screen shot in Spanish
clip_image022

(The pages, product, templates all need to be translated)

1 comment

Leave a comment
  1. Pierre Alain Carrier Mar 07, 2012
    I'd like to see an event for when an order is paid, either online or offline (mark as Paid in the backend).

    Leave a comment