Hi,
In the productListtemplateExtender you can't modifie the ProductList. Fore some reason the extender is called after the products is rendered. Instead you must use the ProductList Notification.
[Subscribe(Dynamicweb.Notifications.eCommerce.ProductList.BeforeSort)]
public class ProductListModifier : NotificationSubscriber
{
public override void OnNotify(string notification, NotificationArgs argsBase)
{
Dynamicweb.Notifications.eCommerce.ProductList.BeforeSortArgs args = (Dynamicweb.Notifications.eCommerce.ProductList.BeforeSortArgs)argsBase;
for (int i = args.Products.Count - 1; i >= 0; i--)
{
if (args.Products[i].ID == 'PROD100')
args.Products.RemoveAt(i);
}
}
}
You must be logged in to post in the forum