שתף באמצעות


ProductFamily Class

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

Contains the functions specific to a product family in the product catalog system.

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

Syntax

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

Remarks

A product family is a product that contains product variants. A product family is not distinct from a product in any other way. A product family is an instance of the ProductFamily type. A product family is not a sellable unit. It is a logical container for product variants.

Examples

/// <summary>
/// Creates a product in the catalog
/// </summary>
internal ProductFamily CreateProductAndAddVariants(string catalogName, string definitionName, string productId, string variantId)
{
  try
  {
    BaseCatalog baseCatalog = (BaseCatalog)catalogContext.GetCatalog(catalogName);
    ProductFamily product = (ProductFamily)baseCatalog.CreateProduct(definitionName, productId);
    // Once the product is created additional properties can be set on the product
    product.DisplayName = "New Display name";
    product.ListPrice = 19.99M;
    // Add the variant to the product
    product.AddVariant(variantId);
    // Finally save the changes to the catalog system by calling product.Save
    product.Save();
    return product;
  }
  catch (EntityAlreadyExistsException 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..::.Product
            Microsoft.CommerceServer.Catalog..::.ProductFamily

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

ProductFamily Members

Microsoft.CommerceServer.Catalog Namespace