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 |
---|---|
Gets a string that specifies the name of the base catalog for the catalog item. |
|
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:
|
|
Gets a string that specifies the name of the catalog to which this catalog item belongs; maximum length is 128 characters. |
|
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. |
|
Gets a string that specifies the name of the definition to which this item belongs; maximum length is 128 characters. |
|
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. |
|
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. |
|
Gets or sets a decimal value that specifies the list price of the catalog item. |
|
The property is used internally by the Catalog System and should not be used. |
|
Gets or sets a string that specifies the name of the primary parent category for the catalog item; maximum length is 128 characters. |
|
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. |
|
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. |
|
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. |
|
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 |
---|---|
Returns true if the columnName in the dataset cannot be updated, or false if the columnName in the dataset can be updated. |
|
Returns true if the columnName is a built-in column in the dataset, or false if the columnName is a user-defined property. |