Welcome to MSDN Blogs Sign in | Join | Help

How to iterate properties of a product and get if property is set to DisplayOnSite

CatalogSiteAgent ctlgAgent = new CatalogSiteAgent(); ctlgAgent.SiteName = "StarterSite";
CatalogContext ctlgCtx = CatalogContext.Create(ctlgAgent);
Product prod = ctlgCtx.GetProduct("Adventure Works Catalog","AW099-15");
CatalogDefinition ctlgDef = ctlgCtx.GetDefinition(prod.DefinitionName);
CatalogDefinitionPropertiesDataSet.CatalogDefinitionPropertiesDataTable properties = ctlgDef.DefinitionProperties.CatalogDefinitionProperties;

foreach (CatalogDefinitionPropertiesDataSet.CatalogDefinitionProperty property in properties)
{
    CatalogProperty propertyDefinition = ctlgCtx.GetProperty(property.PropertyName);

    if ((bool)propertyDefinition["DisplayOnSite"])
    {
        Console.WriteLine(propertyDefinition.Name);
    }
}

 

Published Thursday, March 15, 2007 10:09 PM by Max Akbar

Comments

New Comments to this post are disabled
 
Page view tracker