Share via


CatalogItemsDataSet

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

The CatalogItemsDataSet class contains information about the products and categories in a catalog. You can access the DataRowCollection of the dataset's data table by using the CatalogItems property. You can access each row in the collection by using the properties of the CatalogItemsDataSet..::.CatalogItem class.

This dataset contains both the built-in properties and the user-defined properties that are included in the product or category definition. The built-in properties are exposed as strongly typed properties, and the user-defined properties can be accessed by using the property name.

The following table contains the strongly typed properties in this dataset.

Property

Description

BaseCatalogName

Gets a string that specifies the name of the base catalog for the catalog item.

CatalogClassTypes

Gets an integer that specifies the class type of the catalog item. This property is one of the values of the CatalogClassTypes enumeration. The possible values for this property are as follows:

  • 1 - CategoryClass

  • 2 - ProductVariantClass

  • 4 - ProductClass

  • 8 - ProductFamilyClass

CatalogName

Gets a string that specifies the name of the catalog to which this catalog item belongs; maximum length is 128 characters.

CategoryName

Gets a string that specifies the name of the category; maximum length is 128 characters. This property returns null for products, product families, and variants.

DefinitionName

Gets a string that specifies the name of the definition to which this item belongs; maximum length is 128 characters.

DisplayName

Gets or sets a string that specifies the display name for the catalog item in the current active language; maximum length is 128 characters. This property cannot be set for variants. Variants inherit the display name from the product family. This property returns an empty string if the display name has not been defined for the catalog item.

IsSearchable

Gets or sets a Boolean value that specifies whether the category is searchable. A value of 1 means that the category is searchable, and a value of 0 means that the category is not searchable. This property is DBNull for products, product families, and variants.

ListPrice

Gets or sets a decimal value that specifies the list price of the catalog item.

Oid

The property is used internally by the Catalog System and should not be used.

PrimaryParentCategoryName

Gets or sets a string that specifies the name of the primary parent category for the catalog item; maximum length is 128 characters.

ProductId

Gets a string that specifies the product identifier; maximum length is 256 characters. For products, product families, and variants, this property gets or sets the product identifier. This property returns an empty string for categories.

Rank

Gets or sets an integer that specifies the rank of a category, product, or product family under a parent category, and the rank of a variant in a product family. This property can be set only on the CatalogItemsDataSet object that is returned by the ChildProducts and ChildCategories properties on the StaticCategory object, and the Variants property on the ProductFamily object.

UseCategoryPricing

Gets or sets a Boolean value that specifies whether a product or a product family uses category-based pricing. For categories, this value is 0. Variants inherit this value from the product family.

VariantId

Gets a string that specifies the variant identifier; maximum length is 256 characters. This property returns an empty string for categories, products, and product families.

Constraints

The CatalogItemsDataSet defines a unique constraint on the Oid column.

Using the CatalogItemsDataSet Class

The following example demonstrates how to access the properties of the CatalogItemsDataSet class.

public static void UseDataset(CatalogContext context,string catalogName, string categoryName, string categoryDisplayName, string categoryDefinitionName string parentCategoryName)
{
    // Get an existing catalog.
    ProductCatalog productCatalog = catalogContext.GetCatalog(catalogName);
    // Create a new category in the catalog.
    CatalogItem catalogItem = productCatalog.CreateCategory(categoryDefinitionName", categoryName);
    // Add attributes to the new category and save it to the Catalog System.
    CatalogItemsDataSet catalogItemInfo = catalogItem.Information;
    CatalogItemsDataSet.CatalogItem catalogItemAttributes = catalogItemInfo.CatalogItems[0];
    catalogItemAttributes.DisplayName = categoryDisplayName;
    catalogItemAttributes.IsSearchable = true;
    catalogItemAttributes.PrimaryParentCategoryName = parentCategoryName;
    catalogItem.Save();

    // Iterate through the dataset to access each CatalogItem in the set.
    foreach(CatalogItemsDataSet.CatalogItem catItem in  catalogItemInfo.CatalogItems)
    {
        string catName = catItem.CategoryName;
        string definitionName = catItem.DefinitionName;
        string parentCategory = catItem.PrimaryParentCategoryName;
        // Write the information to the console.
        Console.WriteLine(parentCategory);
    }
}

The CatalogItemsDataSetSchema Class

The CatalogItemsDataSetSchema class provides constants for all the built-in columns in the dataset and defines all the associated methods. The following table contains the associated methods for this class.

Method

Description

IsReadOnlyColumn

Returns true if the columnName in the dataset cannot be updated, or false if the columnName in the dataset can be updated.

IsBuiltInColumn

Returns true if the columnName is a built-in column in the dataset, or false if the columnName is a user-defined property.

See Also

Other Resources

Typed Datasets in the Catalog System

Typed Datasets in the Inventory System