HCL Commerce Enterprise

Example: price rule element template for a condition

When creating a custom condition for a price rule, you can refer to this sample SQL statement that adds an element template to the PRELETEMPLATE table.

Sample

The purpose of the condition in this sample is to determine if the customer registered on, before, or after a specific date. The business user can then specify a condition such as customer registered after October 31, 2010. The SQL statement looks like this:

INSERT INTO PRELETEMPLATE (preletemplate_id, identifier, storeent_id, description, preletpltgrp_id, runtimexml ) 
VALUES 
(1001,'RegistrationTimeCondition',0,'Shopper registration time condition',2,
'<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>');

For this example, the PRICERULE_registrationTime parameter in the element template definition will be replaced with the actual date (for example, "2010/11/15") when the price rule is used on the storefront to set pricing.