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.
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.
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.
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.
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.
Credit goes to Boyan Barnev for writing this code. (Thank you B!)
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.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
You have the right to request deletion of your Personal Information at any time.
You can also ask us not to pass your Personal Information to third parties here: Do Not Sell My Info
Copyright © 2020 Progress Software Corporation and/or its subsidiaries or affiliates.All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.