Embed Catalog Items in a Content Page
Present catalog items in a content page as part of a marketing effort.
Complete the following prerequisites:
-
There are one or more virtual or base catalogs containing product and category definitions.
-
You have created a rendering under
/sitecore/layout/Renderings/with appropriate code-behind or controller.
At the Content Editor:
-
Add a control.
-
Click the content item in the tree
-
Click → in the ribbon.
-
Click Edit on the device control.
-
Click Controls
-
Click Add, find your rendering, set its Placeholder and click on the Select button
-
-
Choose one:
Set a data source on the rendering
continue to the next step
Add an associated product field to the content item
continue to 6
-
Click your control in the device editor.
-
Click Edit on the device control.
-
Select a product and click OK.
If you are using MVC, you can retrieve the data source in your controller using the following:
RenderingContext.Current.Rendering.DataSourceIf you are using WebForms you can retrieve it in your code behind using the following
((Sublayout)Parent).DataSource -
Close the Presentation Details dialog
You have completed this procedure.
-
On the template for the content item:
-
Add a new field called
AssociatedProducts -
Set the type to
Treelist(orTreelist with Search) -
Set the source to
/sitecore/Commerce/Catalog Management/Catalogs
-