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.
<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, inYYYY/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.
Format of price rule element template parameters
The format depends on where the data is coming from. There are two options:
- 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.
- The pricing services look up the paramName in
the PRELEMENTATTR table, and replace the value
- 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:
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:
|
PRICERULE_specifiedInTable | Valid values:
|
PRICERULE_inCategories | Valid values:
|
PRICERULE_catalogEntryIdList | A catalog entry ID (for example, a product or SKU) |
PRICERULE_categoryIdList | A category ID |
PRICERULE_includedInCatalogFilters | Valid values:
|
PRICERULE_calculationType | Valid values:
|
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:
|
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:
|
PRICERULE_comparisonOperandType |
|
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:
|
PRICERULE_pattern | The rounding pattern to use to round prices. |
PRICERULE_definingCurrencyCodes | The currencies to which the rounding pattern applies. |
PRICERULE_scope | Valid values:
|
PRICERULE_targetMemberGroups |
|
PRICERULE_targetOrganizations |
|
PRICERULE_memberGroupIdentifier | The IDs of the specified member groups. |
PRICERULE_organizationIdentifier | The IDs of the specified organizations. |
PRICERULE_inPriceLists |
|