The Random products web part displays products that correspond to the criteria specified in the content filter.
You can modify the functionality of Random products by setting properties in the Web Part properties dialog as you can see on the following image:
Content filter main properties
Product public status |
Public status of products which should be displayed. |
Product internal status |
Internal status of products which should be displayed. |
Product department |
Department of products which should be displayed. |
Only random N products |
Indicates how many random products should be displayed. Don't put any value, if you want display all products. |
Top N |
The first N products selected according to the chosen criteria. |
Path |
Path of the documents to be displayed. |
Document Types |
Indicates from which document types should be products chosen. |
WHERE Condition |
WHERE part of the SELECT query. |
ORDER BY expression |
ORDER BY part of the SELECT query. |
The Random products web part can be used in many different ways. All you have to do is to set the content filter accordingly to get rights products displayed.
1. Featured products on Home page
On the Home page, Random products is set to display the maximum of 4 random products that have the public status set to Show as featured product:
Only random N products: 4
The maximum of 4 random products is displayed.
Product public status: Show as featured product
Only products with the public status set to Show as featured product are displayed.
Transformation name: ecommerce.transformations.EcommerceSite_FeaturedProducts
The ecommerce.transformations.EcommerceSite_FeaturedProducts transformation used in the list view mode.
For description of how to display the given product as the featured product, please refer to the Displaying featured products chapter.
2. Similar products at the product detail
At the product detail, the given web part is set to display the maximum of 4 random products which have price similar to the currently chosen product and which are of the same type.
Show for document types: CMSProduct.Camera;CMSProduct.CellPhone;CMSProduct.Computer;CMSProduct.Laptop;CMSProduct.MediaPlayer;CMSProduct.PDA
Random product is displayed only in the given document types, therefore, at product detail. If a user switch to the product list, the given web part is hidden. If you add a new product type and you want it to be displayed with the Random product web part, you need to add your new product type into the Show for document types text box.
Only random N products: 4
The web part displays 4 random products at most, according to the filter conditions.
WHERE condition: (SKUPrice > {%SKUPrice%} * 0.6) AND (SKUPrice < {%SKUPrice%} * 1.4) AND (NodeSKUID <> {%NodeSKUID%})
Ensures that only products with the price similar to the currently chosen product are displayed.
Document types: {%ClassName%}
Ensures that only the products of the same type as the currently chosen product are displayed.
For more details about the context macros please refer to the Appendix A - Macro expressions chapter in Kentico CMS Developer's Guide.
Transformation name: Ecommerce.Transformations.EcommerceSite_RandomProducts
The Ecommerce.Transformations.EcommerceSite_RandomProducts transformation used in the list view mode.
For instance, if the currently chosen product is type of cmsproduct.cellphone with SKUPrice set to 100, the Random product web part displays the maximum of 4 products, type of cmsproduct.cellphone with SKUPrice between 60 and 140.
3. Recommended products on News page and Home page
On the News page, the given web part is set to display 4 random products, regardless of their type.
In this case, the Only random N products property is set to 4 and the Transformation name property is set toecommerce.transformations.Ecommerce_RandomProducts.
On the Home page, the given web part is set to display 1 random product, regardless of its type.
In this case, the Only random N products property is set to 1. The Transformation name property is set toecommerce.transformations.Ecommerce_RandomProduct.
Page url: http://devnet.kentico.com/docs/5_5r2/ecommerceguide/index.html?random_products.htm