WebSphere Commerce Enterprise

Price rule element template parameters

Price rule element template parameters specify the pieces of data that a price rule element task command needs to perform its function. The pricing services pass the data to the task command when processing a condition or action in a price rule.

Element template parameters are specified in the corresponding price rule element template definition. In the following example from a custom condition element that checks when a customer registered with the store, the two lines of code in bold text beginning with <Argument are element template parameters:
<FlowElementImplementation type = "RegistrationTimeCondition">
    <Implementation invocationType = "TaskCommand">
        <Class name = "com.mycompany.commerce.price.rule.commands.element.RegistrationTimeConditionElementCmd">
            <Argument name = "registrationTime" value = "PRICERULE_registrationTime"/>
            <Argument name = "registrationTimeOperator" value = "PRICERULE_registrationTimeOperator"/>
        </Class>
    </Implementation>
</FlowElementImplementation>
  • The registrationTime parameter represents the registration time that a business user specifies for this element in the user interface, in YYYY/MM/DD format. This parameter is compared with the actual registration time for a given customer.
  • The registrationTimeOperator parameter represents the operator to use when comparing two registration time values, for example:
    • Actual registration time is before the registration time the business user specifies.
    • Actual registration time is after the registration time the business user specifies.
    • Actual registration time is equal to the registration time the business user specifies.
Each template definition can contain 0 or more element template parameters. These parameters typically map to the data that a business user enters in the user interface, but you can also specify the data directly in the template definition.

Format of price rule element template parameters

The format depends on where the data is coming from. There are two options:

  1. Data is coming from the user interface.
    If the data the task command needs is data that a business user enters when setting up the condition or action, then the format looks like this:
    <Argument name="paramName" value="PRICERULE_paramName" />

    All parameter values that come from the user interface start with this prefix: PRICERULE_. Here is an example; in this case, it is for a condition that evaluates whether the customer has registered on, before, or after a specific date:

    <Argument name = "registrationTime" value = "PRICERULE_registrationTime"/>

    When a business user inputs data about a condition or action used in a price rule and then saves it, the name-value pairs for each price rule element template parameter are saved to the PRELEMENTATTR table. Here is an example of a row in the table for a condition with the PRELEMENT_ID of 1000:

    Sample PRELEMENTATTR table content
    PRELEMENT_ID NAME VALUE
    1000 "registrationTime" 2010-07-01 00:00:00

    When the price rule is used on the storefront to set pricing:

    • The pricing services look up the paramName in the PRELEMENTATTR table, and replace the value PRICERULE_paramName in the runtime XML with the corresponding value.
    • If the paramName is not found in the PRELEMENTATTR table, then value will be set to any empty string, and that parameter will be ignored.
  2. Data is specified directly in the template definition.

    For certain conditions and actions, the task command needs data that a business user does not enter. In this case, the parameter value does not have the prefix PRICERULE_.

    For example, if a task command must check whether a user is registered, then the following parameter can pass this information to the task command:

    <Argument name="userType" value="R" />

Parameters for lists captured in grid objects

For some price rule elements, business users can specify lists of things like categories, or catalog entries, or member groups. For example, a business user can specify more than one category for the Catalog Condition element. In the properties view of the price rule element, the lists are captured using a grid object. When the list is persisted in the PRELEMENTATTR table, each row in the grid corresponds to one row in the PRELEMENTATTR table, and each row refers to the same property name. For example:

Sample PRELEMENTATTR table content for a grid object
PRELEMENT_ID NAME VALUE
1000 "categoryIdList" "10101"
1000 "categoryIdList" "10102"
1000 "categoryIdList" "10103"

When this type of parameter is included in a price rule element template definition, the parameter needs to specify only one element. For example, the parameter for the previous example looks like this:

<Argument name="categoryIdList" value="PRICERULE_categoryIdList"/>

To get the list from the user interface, the corresponding price rule element task command must call the method getElementParameters. The method returns a comma separated list of all the values from the PRELEMENTATTR table. For the previous example, the code getElementParameters().get("categoryIdList") returns 10101,10102,10103.

Common parameters used in price rule elements

The conditions and actions shipped with the Management Center have many parameters defined. If you are creating a new condition or action, you can use the parameters defined here to send user interface data to the task command, or you can create your own.

Parameter Data it specifies, or valid values
PRICERULE_priceListId A price list ID
PRICERULE_scope Valid values:
catalogEntries
The element is applicable to specific catalog entries.
categories
The element is applicable to catalog entries in specific categories.
catalogFilter
The element is applicable to a specific catalog filter.
PRICERULE_specifiedInTable Valid values:
yes
The catalog entry being priced must be in a specified list of catalog entries.
no
The catalog entry being priced must not be in a specified list of catalog entries.
PRICERULE_inCategories Valid values:
yes
The catalog entry being priced must be in a specified list of categories.
no
The catalog entry being priced must not be in a specified list of categories.
PRICERULE_catalogEntryIdList A catalog entry ID (for example, a product or SKU)
PRICERULE_categoryIdList A category ID
PRICERULE_includedInCatalogFilters Valid values:
yes
The catalog entry being priced must be in a specified catalog filter.
no
The catalog entry being priced must not be in a specified catalog filter.
PRICERULE_calculationType Valid values:
markUp
Mark up the input price.
markDown
Mark down the input price.
usePriceEquation
Use a price equation to calculate the price.
PRICERULE_markUpPercentage The percentage to mark up the input price.
PRICERULE_markDownPercentage The percentage to mark down the input price.
PRICERULE_priceEquationId A price equation ID.
PRICERULE_priceRuleId A price rule ID.
PRICERULE_inputOperandType Valid values:
PriceConstant
The operand is a price constant.
PriceList
The operand is a price list.
PriceEquation
The operand is a price equation.
Variable
The operand is the price passed in to this element.
PRICERULE_inputOperandReferenceId The reference ID (for example, the ID of the price constant)
PRICERULE_operator An operator to compare numbers only (for example, cannot be used to compare dates or times). Valid values:
=
equal to
!=
not equal to
>
greater than
>=
greater than or equal to
<
less than
< =
less than or equal to
PRICERULE_comparisonOperandType
PriceConstant
The operand is a price constant.
PriceList
The operand is a price list.
PriceEquation
The operand is a price equation.
Number
The operand is a number that the user enters.
PRICERULE_comparisonOperandReferenceId The reference ID (for example, the ID of the price constant)
PRICERULE_numericalValue The value of the number that the user enters.
PRICERULE_coordinatorType Valid values:
lowestPrice
Use the path with the lowest price.
highestPrice
Use the path with the highest price.
firstValidPath
Use the first path that returns a valid price.
PRICERULE_pattern The rounding pattern to use to round prices.
PRICERULE_definingCurrencyCodes The currencies to which the rounding pattern applies.
PRICERULE_scope Valid values:
memberGroups
The element is applicable to specific member groups.
organizations
The element is applicable to specific organizations.
PRICERULE_targetMemberGroups
inAny
The customer must be in any of the specified member groups.
inAll
The customer must be in all of the specified member groups.
notIn
The customer must not be in any of the specified member groups.
PRICERULE_targetOrganizations
inAny
The customer must be in any of the specified organizations.
inAll
The customer must be in all of the specified organizations.
notIn
The customer must not be in any of the specified organizations.
PRICERULE_memberGroupIdentifier The IDs of the specified member groups.
PRICERULE_organizationIdentifier The IDs of the specified organizations.
PRICERULE_inPriceLists
yes
The catalog entry being priced must be in a specified price list.
no
The catalog entry being priced must not be in a specified price list.