Delen via


How to Create a Static Catalog Set

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

A catalog set consists of one or more catalogs that you make available to different users or organizations. You create a static catalog set by specifying the catalogs you want to include in the catalog set. You can edit the set of catalogs at any time.

To create a static catalog set

  1. Use the CatalogSetsContext property on the CatalogContext object to create a CatalogSetsContext object.

  2. Use the CreateStaticCatalogSet method on the CatalogSetsContext object to create a StaticCatalogSet object.

  3. Use the AddProductCatalog method on the StaticCatalogSet object to add product catalogs to the catalog set.

    - or -

    Use the CreateStaticCatalogSet method on the CatalogSetsContext object to create a StaticCatalogSet object with the catalogs specified by the productCatalogs parameter.

  4. Use the Save method on the CatalogSet object to save the catalog set to the system.

To add a catalog to a static catalog set

  1. Use the AddProductCatalog method on the StaticCatalogSet object to add product catalogs to the catalog set.

  2. Use the Save method on the CatalogSet object to save the changes.

To remove a catalog from a static catalog set

  1. Use the RemoveProductCatalog method on the StaticCatalogSet object to remove product catalogs from the catalog set.

  2. Use the Save method on the CatalogSet object to save the changes.

To delete a static catalog set

Example

The following example creates a static catalog set that contains two product catalogs, Catalog1 and Catalog2, which exist in the system. It then removes Catalog1 from the catalog set and adds Catalog3.

public static void CreateStaticCatalogSet(CatalogContext context)
{
    // Get the CatalogSetsContext object.
    CatalogSetsContext catalogSetsContext = context.CatalogSetsContext;

    // Create the catalog set.
    string setName = "PreferredCustomerCatalog";
    string description = "Catalog for preferred customers";
    StaticCatalogSet staticCatalogSet = catalogSetsContext.CreateStaticCatalogSet(setName, description);
            
    // Add the product catalogs to the catalog set.
    staticCatalogSet.AddProductCatalog("Catalog1");
    staticCatalogSet.AddProductCatalog("Catalog2");

    // Save the changes.
    staticCatalogSet.Save();

    // Edit the catalog set.
    // Remove Catalog1 and add Catalog3.
 
    staticCatalogSet.RemoveProductCatalog("Catalog1");
    staticCatalogSet.AddProductCatalog("Catalog3");

    // Save the changes.
    staticCatalogSet.Save();
}

See Also

Other Resources

Managing Catalog Sets by Using the Catalog API