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.
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…
Step 2) Create a product based on the product type just created.
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.
Once completed, the file is then saved into the system folder library and attached to the product.
Upon successful purchase by the customer, the customer can go to their My Account page to download the digital file.
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"
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.
Step 2) Go to Ecommerce->Attributes
Step 3) View the attributes
Click “ES” adding the Spanish version, then enter the Spanish name for the Attribute:
Then add the values in the second language:
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
Here is the screen shot in Spanish
(The pages, product, templates all need to be translated)