Commerce Foundation Variant

A variant is a product option. To retrieve a variant directly you must query a product by its ID while specifying the CommerceQueryRelatedItem<Variant> in the relationship list. Typically, you retrieve a variant by using its product's variants property.

Model

This commerce entity can be modified, as required. This model, taken from the out-of-the-box site, is provided as an example.

<CommerceEntity name="Variant">
  <DisplayName value="Variant">
    <LanguageSpecific value="fr: Product" language="fr-CA"/>
  </DisplayName>
  <Description value="Product Variant">
    <LanguageSpecific value="fr: Product Variant" language="fr-CA"/>
  </Description>
  <EntityMappings>
    <EntityMapping
   csType="Microsoft.CommerceServer.Catalog.Variant"
   csAssembly="Microsoft.CommerceServer.Catalog, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
   <PropertyMappings>
     <PropertyMapping property="Id" csProperty="VariantId" />
     <PropertyMapping property="BaseCatalogName" csProperty="BaseCatalogName" />
     <PropertyMapping property="CatalogId" csProperty="CatalogName" />
     <PropertyMapping property="DefinitionName" csProperty="DefinitionName" />
     <PropertyMapping property="DisplayName" csProperty="DisplayName" />
     <PropertyMapping property="IsVirtualCatalog" csProperty="IsVirtualCatalog" />
     <PropertyMapping property="ListPrice" csProperty="cy_list_price" />
     <PropertyMapping property="OriginalListPrice" csProperty="OriginalPrice" />
     <PropertyMapping property="InternalId" csProperty="Oid" />
     <PropertyMapping property="OriginalProductId" csProperty="OrigProductId" />
     <PropertyMapping property="OriginalVariantId" csProperty="OrigVariantId" />
     <PropertyMapping property="ParentInternalId" csProperty="ParentOid" />
     <PropertyMapping property="ProductId" csProperty="ProductId" />
     <PropertyMapping property="InventoryCondition" csProperty="InventoryCondition"/>
   </PropertyMappings>
   <DefinitionMappings>
     <DefinitionMapping csDefinitionName="Pants">
    <PropertyMappings>
      <PropertyMapping property="Size" csProperty="ProductSize" />
    </PropertyMappings>
     </DefinitionMapping>
     <DefinitionMapping csDefinitionName="Shirts">
    <PropertyMappings>
      <PropertyMapping property="Size" csProperty="ProductSize" />
    </PropertyMappings>
     </DefinitionMapping>
   </DefinitionMappings>
    </EntityMapping>
  </EntityMappings>
  <Properties>
    <Property name="BaseCatalogName" dataType="String" />
    <Property name="CatalogId" dataType="String" />
    <Property name="DefinitionName" dataType="String" />
    <Property name="DisplayName" dataType="String" />
    <Property name="Id"   dataType="String" />
    <Property name="IsVirtualCatalog" dataType="Boolean" isStronglyTyped="true" />
    <Property name="ListPrice"  dataType="Decimal" />
    <Property name="OriginalProductId" dataType="String" />
    <Property name="OriginalVariantId" dataType="String" />
    <Property name="ProductId"  dataType="String" />
    <Property name="OriginalListPrice" dataType="Decimal" />
    <Property name="InternalId"  dataType="Integer" />
    <Property name="ParentInternalId" dataType="Integer"/>
    <Property name="InventoryCondition" dataType="Integer" isStronglyTyped="true">
   <EnumeratedValues >
     <EnumerationEntry value="0">
    <DisplayName value="In Stock"/>
     </EnumerationEntry>
     <EnumerationEntry value="1">
    <DisplayName value="Pre Ordered"/>
     </EnumerationEntry>
     <EnumerationEntry value="2">
    <DisplayName value="Back Ordered"/>
     </EnumerationEntry>
     <EnumerationEntry value="3">
    <DisplayName value="Out of Stock"/>
     </EnumerationEntry>
   </EnumeratedValues>
    </Property>
    <Property name="Size" dataType="String">
   <DisplayName value="Size">
     <LanguageSpecific value="fr: Size" language="fr-CA"/>
   </DisplayName>
   <Description value="Product Size">
     <LanguageSpecific value="fr: Product Size" language="fr-CA"/>
   </Description>
   <Constraints>
     <Range minValue="4" minBoundaryType="Include" maxValue="4" maxBoundaryType="Include" >
    <Message value="Product Size must be 4 characters long.">
      <LanguageSpecific value="fr: Boot Size must be 4 characters long" language="fr-CA"/>
    </Message>
     </Range>
   </Constraints>
    </Property>
  </Properties>
  <Relationships>
    <!-- Catalog entity relationships -->
    <Relationship name="BaseCatalog" type="Relationship" modelName="Catalog" isMultipleItems="false"> </Relationship>
    <Relationship name="PrimaryParentCategory" type="Relationship" modelName="Category" isMultipleItems="false"> </Relationship>
    <Relationship name="InventoryItems" type="Relationship" modelName="InventoryItem" isMultipleItems="true"> </Relationship>
    <Relationship name="PricingCategory" type="Relationship" modelName="Category" isMultipleItems="false"> </Relationship>
    <Relationship name="Product" type="Relationship" modelName="Product" isMultipleItems="false"> </Relationship>
  </Relationships>
</CommerceEntity>

Properties

Property

Type

Description

BaseCatalogName

String

The name of the base catalog.

CatalogId

String

ID (CatalogName) of the containing catalog.

DefinitionName

String

Name of this object's definition.

DisplayName

String

Display name for this object.

Id

String

Unique identifier of the commerce entity. This value is derived from the category name.

InventoryCondition

int?

The inventory condition of this product's inventory item for the specified inventory catalog. Options include:

0 - In stock.

IsVirtualCatalog

bool?

Type of Catalog.

If True: catalog is virtual

ListPrice

decimal?

List price for this category.

OriginalListPrice

decimal?

List price of the object when it was created.

OriginalProductId

String

Product ID with which this object was created.

OriginalVariantId

String

Variant ID with which this object was created.

ParentInternalId

int?

Maps to the Commerce Server object's object ID property, it is a unique DB key.

ProductId

String

The product ID for this object.

Relationships

Property

Description

InventoryItems

Relationship list of this product's inventory in various inventory catalogs.

Supported Operations

Commerce Foundation Product CommerceQuery

See Also

Other Resources

Developing with Commerce Server 2009