Share via


AddVirtualCatalogRule Method

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

Adds an inclusion or exclusion rule from a base catalog to the current virtual catalog.

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

Syntax

'Declaration
Public Sub AddVirtualCatalogRule ( _
    catalogName As String, _
    categoryName As String, _
    productId As String, _
    variantId As String, _
    isExclusionRule As Boolean _
)
'Usage
Dim instance As VirtualCatalog
Dim catalogName As String
Dim categoryName As String
Dim productId As String
Dim variantId As String
Dim isExclusionRule As Boolean

instance.AddVirtualCatalogRule(catalogName, _
    categoryName, productId, variantId, _
    isExclusionRule)
public void AddVirtualCatalogRule(
    string catalogName,
    string categoryName,
    string productId,
    string variantId,
    bool isExclusionRule
)
public:
void AddVirtualCatalogRule(
    String^ catalogName, 
    String^ categoryName, 
    String^ productId, 
    String^ variantId, 
    bool isExclusionRule
)
public function AddVirtualCatalogRule(
    catalogName : String, 
    categoryName : String, 
    productId : String, 
    variantId : String, 
    isExclusionRule : boolean
)

Parameters

  • variantId
    Type: System..::.String
    The variant ID for the product in the base catalog.
  • isExclusionRule
    Type: System..::.Boolean
    If true, adds an exclusion rule. If false, adds an inclusion rule.

Exceptions

Exception Condition
ValidationException

The rule is invalid.

Remarks

This method adds inclusion and/or exclusion rules from one or more base catalogs to the current virtual catalog. If isExclusionRule is false then an inclusion rule is added else an exclusion rule is added. To add a catalog level rule from a catalogName set the categoryName, productId , variantId to nullNothingnullptra null reference (Nothing in Visual Basic). To add a category rule from a catalogName set the categoryName to the category name and the parameters productId , variantId to nullNothingnullptra null reference (Nothing in Visual Basic). To add a product rule from a catalogName set the productId to the product ID and the parameters categoryName, variantId to nullNothingnullptra null reference (Nothing in Visual Basic). To add a variant rule from a catalogName set the productId to the product ID, variantId to the variant ID and the parameter categoryName to nullNothingnullptra null reference (Nothing in Visual Basic). When a rule is added from the catalogName to the virtual catalog the catalogName is added as a dependent catalog of the virtual catalog. Call the Save method to save the changes to the catalog system. You should also call the Rebuild method to apply the rules to the virtual catalog. If a category is added as an inclusion rule the category and all its descendants will be added to the virtual catalog unless some of the descendants are excluded from the virtual catalog by exclusion rules. The exclusion rules will always override the inclusion rules. If a category is excluded then all its descendants will be excluded even if there is an explicit include rule on the descendant.

A limit of 84 base catalogs can be used to create a virtual catalog.

Permissions

See Also

Reference

VirtualCatalog Class

VirtualCatalog Members

Microsoft.CommerceServer.Catalog Namespace