StaticCategory Class

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

The StaticCategory class manages a static category. A static category is a category to which product catalogs are explicitly added and removed. This class cannot be inherited.

Namespace:  Microsoft.CommerceServer.Catalog
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
Public NotInheritable Class StaticCategory _
    Inherits Category
'Usage
Dim instance As StaticCategory
public sealed class StaticCategory : Category
public ref class StaticCategory sealed : public Category
public final class StaticCategory extends Category

Remarks

After making any changes to the StaticCategory, you should call the Save method to save the changes to the catalog system.

Examples

// Creates a category in the catalog
internal void AddItemsToCategory(string catalogName, string categoryName, string parentCategory, string childProductId)
{
  try
  {
    ProductCatalog productCatalog = catalogContext.GetCatalog(catalogName);
    StaticCategory category = (StaticCategory)productCatalog.GetCategory(categoryName);
    category.AddParentCategory(parentCategory);
    category.AddProduct(childProductId);
    /*
    // Add a child category
    category.AddChildCategory("childCategoryName");
    // Add a relationship to other categories. You can also assign ranks to relationships
      category.AddRelationshipToCategory("targetcatalog", "targetcategory1", "relationship1", "description", 1);
      category.AddRelationshipToCategory("targetcatalog", "targetcategory2", "relationship2", "description", 2);
      // Add a relationship to other products. You can also assign ranks to relationships
      category.AddRelationshipToProduct("targetcatalog", "targetproduct1", "relationship2", "description", 1);
      category.AddRelationshipToProduct("targetcatalog", "targetproduct2", "relationship3", "description", 1);
     */
  // Finally save the changes to the catalog system by calling category.Save
  category.Save();
   
  }
  catch (OptimisticLockException ex)
  {
    Console.WriteLine(ex.Message);
    throw;
  }
}

Inheritance Hierarchy

System..::.Object
  Microsoft.CommerceServer.Catalog..::.CatalogObjectBase
    Microsoft.CommerceServer.Catalog..::.CatalogObject
      Microsoft.CommerceServer.Catalog..::.MultilingualCatalogObject
        Microsoft.CommerceServer.Catalog..::.CatalogItem
          Microsoft.CommerceServer.Catalog..::.Category
            Microsoft.CommerceServer.Catalog..::.StaticCategory

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

StaticCategory Members

Microsoft.CommerceServer.Catalog Namespace