Try Now
More in this section
Blogs RSS feed

Sitefinity Ecommerce - Adding related products

by Steve Miller

Out of the box, Sitefinity Ecommerce V5 does not have an interface for relating products to each other.  This feature is currently in design, but until it is released, I would like to show you how you can create related products using the API and creating a custom view based on products tags.  

How it works

In Sitefinity Ecommerce, you have the ability to add tags (taxonomies) to products (EX: software, on sale or women's clothing).    Sitefinity supports simple tags, categories, facet, and network taxonomies. These advanced taxonomies allow powerful relationships to be represented in Sitefinity.   By creating a custom view (using the default view as a template),  you can select products which have a the same tag of the main product and show related products under the main product details.  Below is the code for the ProductDetailViewCustom.ascx.cs.   This should help to give you a better understanding of how to select products based on a tag.

Getting Started

To begin, add 3 separate products into the Sitefinity backend and add the tag “example” to all 3 products.  Edit the page which has the product list control on it and click on the edit properties of the product list control.  Next, click on the “Advanced” button at the bottom of the control property window, then click on the button “ControlDefinition”.   In the ControlDefinition, scroll down to the bottom and click on “Views”.   In the views window, you will see 4 different views, select the ProductFrontendDetails which will bring you to the properties for the front end (public facing) views.


In the view window, scroll down to the bottom until you find TemplatePath, this is where you want to add the location of your view/template.  In my example, I am using “~/Widgets/Views/RelatedProductsRadRotator/ProductDetailViewCustom.ascx” as my path.   Click on the “Save” button at the bottom then publish the page and your are done.

In my example below, I am using the RadRotator for listing my Related Products, however I am also including another example of using the RadListControl.  Both views can be used but not at the same time.  Only 1 view can be included in the project as both examples have the same class name.



Download Examples

Go to https://gist.github.com/3007808 to download this example using the RadRotator showing related products. 

Go to https://gist.github.com/3007820 to download this example using the RadList control showing related products.

NOTE:  This template can be outdated. Please use the latest product details template included in Sitefinity version that you use and just add the RelatedProducts section to it.

Video of Example


Credit goes to Boyan Barnev for writing this code.  (Thank you B!)

1 comment

Leave a comment
  1. Justin Dec 05, 2012
    I have tried to implement this into the sitefinity store that I'm building (version 5.2.3800.0) but have failed to get it to work.. I followed the guide but results in an empty page. I did read that this function was to be added to v5.2 but didn't see it hence why I tried to implement it. other that what is written in this article, is there anything else I need to do (perhaps regarding the RadRotator). thanks in advance

    Leave a comment