HCL Commerce Enterprise

Comparison Condition

Use this condition in a price rule to set prices differently based on the outcome of a comparison. For example, you might want to compare your offer price to a competitor's offer price; if your price is higher, you can use the price rule to mark down your price. You must provide the Comparison Condition element with the two values or prices that you want to compare, and specify how to compare them.

How the Comparison Condition works in a price rule

Consider the following example price rule, which compares prices in two price lists. The pricing manager maintains the store's prices in the Offer Price list, and his competitor's prices in a Competitor's Price list. For each catalog entry that the price rule handles:
  1. If the Competitor's Price is lower than the store's Offer Price, the pricing manager wants to sell the catalog entry at the Competitor's Price marked down by 1%.
  2. If the store's Offer Price is lower, the pricing manager wants to sell the catalog entry at that price.
To set prices differently for these two conditions, this price rule requires a Condition Branch with two paths:
Figure 1:

Example 1: A price rule using the Comparison Condition
When a customer views a catalog entry on the storefront, the price rule works like this:
  • 1 The price rule compares the values defined in the Comparison Condition element on path 1:
    • If the condition requirement is met, then the price rule uses the actions on path 1 to set the price of the catalog entry. In this example, if the value from the Competitor's Price list is lower than the value from the stores's Offer Price list, then the price of the catalog entry is the value from the Competitor's Price list marked down by 1%.
    • If the condition requirement is not met, the price rule ignores path 1 and continues to path 2.
  • 2 On path 2, there is no Comparison Condition element. Therefore, this path sets the price of all other catalog entries that this price rule handles. In this example, the price is pulled from the Offer Price list.

Here is another example. Here, the pricing manager wants to calculate costs by marking up a Base Cost price list by 30%, but wants to be sure that these prices are always at least 5% lower than prices in the List Price list. In this case, the price rule begins with two actions: Get Price from Price List and Calculate Price. These actions pass in a price to the paths following the Condition Branch:

Figure 2:

Example 2: A price rule using the Comparison Condition
  • 1 The Comparison Condition element compares the price passed in to the value calculated by the following price equation: List Price list * 0.95.
    • If the price passed in is greater than the List Price list * 0.95, then the price rule uses the action on path 1 to set the price of the catalog entry.
    • If not, the price rule ignores path 1 and continues to path 2.
  • 2 On path 2:
    • There is no Comparison Condition element; therefore, this path sets prices for all other catalog entries that this price rule handles.
    • There is no action element; therefore this path uses the price passed in (the Base Cost list marked up by 30%).

Guidelines for using the Comparison Condition in price rules

To create a valid price rule, use the Comparison Condition element according to the following guidelines. The previous price rule examples adhere to these guidelines, so use them as reference as you read each guideline:
  • Your price rule must contain a Condition Branch element to split a single path into multiple paths.
  • Your price rule can have as many paths as you need.
  • Each path that follows the Condition Branch must start with a Comparison Condition element, except for the bottom path. Typically, you should not add a condition element to the bottom path. The bottom path should determine pricing for any catalog entries that do not meet the conditions on the other paths. This prevents the situation in which catalog entries on the storefront do not have a price because the price rule cannot output a price. (In other words, the catalog entry does not meet any condition in the price rule.) If you have a business case for using a condition on every path, you can do so, but ensure that the price rule can output a price for every catalog entry it needs to handle.
  • For a given Condition Branch, all conditions must be of the same type. For example, you cannot use a Comparison Condition element on one path and a Catalog Condition element on another path.
  • To the right of each condition element, include any actions you need to output a price for catalog entries that meet the condition. Some paths might not require an action if the correct price is already passed in to the path, as illustrated by the example in Figure 2 (see path 2).
  • You can use more than one Condition Branch in a price rule to nest conditions within other conditions. In this case, you can use multiple condition types in the same price rule, as long as each Condition Branch contains paths that use only a single condition type.

Values you can compare in a Comparison Condition

Think of the Comparison Condition element as a way to compare "value A" to "value B." You must specify the source of these two values.

The source of "value A" can be:

  • A price list (refer to Figure 1, which uses the Offer Price list and the Competitor's Price list)
  • A price equation (refer to Figure 2, which uses the price equation List Price list * 0.95)
  • A price constant, which can be a percentage, a number, or a currency (price).
  • A price passed in by previous actions in the price rule (refer to Figure 2, which passes in the Base Cost list marked up by 30%)

The source of "value B" can be:

  • A price list
  • A price equation
  • A price constant, which can be a percentage, a number, or a currency (price).
  • A number

When you specify the values to compare, make sure you are comparing values of the same format. For example:

  • Compare a price to another price.
  • Compare a percentage to another percentage.
  • Compare a number to another number.
  • Do not compare a price to a percentage or a number.