Posted on 03/03/2011 07:17:03
Hello Antonio,
I don't completely understand your task, but I have created two examples. I hope it will be usefull.
Get all group names for current product in product list:
public class ProductTemplateExtender1 : ProductTemplateExtender
{
public override void ExtendTemplate(Dynamicweb.Templatev2.Template template)
{
GroupCollection groups = this.Product.Groups;
List names = new List(groups.Count);
foreach (Group g in groups)
{
names.Add(g.Name);
}
string namesStr = string.Join(",", names.ToArray());
//todo: insert code here
}
}
Get all groups in product list:
public class ProductListTemplateExtender1 : ProductListTemplateExtender
{
public override void ExtendTemplate(Dynamicweb.Templatev2.Template template)
{
Dictionary allGroups = new Dictionary();
foreach (Product product in this.ProductList)
{
foreach (Group g in product.Groups)
{
if (!allGroups.ContainsKey(g.ID))
{
allGroups.Add(g.ID, g);
}
}
}
//todo: insert your code here
}
}
-- Dmitry