Class ProductListTemplateExtender
- Namespace
- Dynamicweb.Ecommerce.Products
- Assembly
- Dynamicweb.Ecommerce.dll
Product list template extender. Extends the rendering of a ProductCollection.
public abstract class ProductListTemplateExtender : TemplateExtender
- Inheritance
-
ProductListTemplateExtender
- Inherited Members
Examples
using System;
using System.Globalization;
using Dynamicweb.Ecommerce.Products;
using Dynamicweb.Rendering;
namespace Dynamicweb.Ecommerce.Examples;
public class ProductListTemplateExtenderSample : ProductListTemplateExtender
{
public override void ExtendTemplate(Template template)
{
ArgumentNullException.ThrowIfNull(template, nameof(template));
// Verify that User is logged in
if (!Security.UserManagement.UserContext.Current.IsLoggedOn)
return;
// Verify that Order is not complete
if (Order is null || Order.Complete)
return;
// Set my custom template tag
string tagContent = ProductList.Count > 50
? "You are showing more than 50 products on this page: {0}"
: "You are showing less than 50 products on this page: {0}";
template.SetTag("MyCustomModule.MyCustomTemplateTag", string.Format(CultureInfo.InvariantCulture, tagContent, ProductList.Count));
}
}
Properties
Order
Gets or sets the order.
public Order Order { get; set; }
Property Value
- Order
The order.
ProductList
Gets or sets the product list.
public ProductCollection ProductList { get; set; }
Property Value
- ProductCollection
The product list.