Product Catalog item field type

The Product Catalog item field type is used to select and render products in frontend without using a product catalog or product catalog for viewmodels app. It is not intended as a replacement product catalog, but rather as a convenient way of highlighting the selected products on e.g. a frontpage, a content page, or inside a newsletter.

Crucially, the Product Catalog item field type returns a ProductListViewModel which is markedly faster and more useful than working with template tags.

When in use, the field allows an editor to select one or more products on the item instance (Figure 1.1):

Figure 1.1 A Product Catalog item field being used

To render these products in frontend inherit either a PageViewModel or a ParagraphViewModel and retrieve the field via the system name, then cast the field content to a ProductListViewModel and work with it in the regular manner.

C#
@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @if (Model.Item.GetValue("ProductCatalog") != null) { ProductListViewModel productlist = Model.Item.GetValue("ProductCatalog") as ProductListViewModel; foreach (var product in productlist.Products) { <div>@product.Name</div> } }