Jaa


AddPriceRule Method

Adds a pricing rule from a base catalog to the virtual catalog.

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

Syntax

'Declaration
Public Sub AddPriceRule ( _
    catalogName As String, _
    categoryName As String, _
    productId As String, _
    variantId As String, _
    priceChangeType As CatalogPricingRuleType, _
    priceChange As Decimal _
)
'Usage
Dim instance As VirtualCatalog
Dim catalogName As String
Dim categoryName As String
Dim productId As String
Dim variantId As String
Dim priceChangeType As CatalogPricingRuleType
Dim priceChange As Decimal

instance.AddPriceRule(catalogName, categoryName, _
    productId, variantId, priceChangeType, _
    priceChange)
public void AddPriceRule(
    string catalogName,
    string categoryName,
    string productId,
    string variantId,
    CatalogPricingRuleType priceChangeType,
    decimal priceChange
)
public:
void AddPriceRule(
    String^ catalogName, 
    String^ categoryName, 
    String^ productId, 
    String^ variantId, 
    CatalogPricingRuleType priceChangeType, 
    Decimal priceChange
)
public function AddPriceRule(
    catalogName : String, 
    categoryName : String, 
    productId : String, 
    variantId : String, 
    priceChangeType : CatalogPricingRuleType, 
    priceChange : decimal
)

Parameters

  • productId
    Type: System..::.String
    The product identifier for the product in the base catalog.
  • variantId
    Type: System..::.String
    The variant identifier for the product in the base catalog.

Exceptions

Exception Condition
ValidationException

The rule is invalid.

RuleAlreadyExistsException

The price rule already exists.

Remarks

Use this method to add price rules from one or more base catalogs to this virtual catalog. A catalog level price rule will always be applied to all the catalog items included from the base catalog. However, if additional category, product or variant level price rules are also specified, these prices rules will override the catalog level price rule. When a rule is added from a base catalog 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. Call the Rebuild method to apply the rules to the virtual catalog.

You can specify four types of price rules:

  • AddFixedAmount - Adds the amount specified by priceChange to the price of the catalog item in the base catalog.

  • NoPriceChange - The price of the catalog item in the base catalog remains unchanged.

  • PercentageMultiplier - Adds the percentage amount specified by priceChange to the price of the catalog item in the base catalog. The priceChange can be less than zero to discount the price of the catalog item in the base catalog.

  • ReplacePrice - Sets the price of the catalog item in the base catalog to priceChange to the price of the product in the base catalog.

Permissions

See Also

Reference

VirtualCatalog Class

VirtualCatalog Members

Microsoft.CommerceServer.Catalog Namespace