HCL Commerce Enterprise

Creating the price rule element template definition

By creating the price rule element template definition, you define the blueprint for your price rule element. When you have defined the price rule runtime XML you require, you must add the template definition to the PRELETEMPLATE table as a new entry.

Before you begin

Review the following topic to ensure that you understand price rule element template definitions and what they must contain to support your price rule element:Review the sample that is relevant to your customization:

Procedure

  1. Define the runtime XML for your price rule element template definition.
  2. Write an SQL statement to register the price rule element template definition in the PRELETEMPLATE table. This includes inserting the implementation definition XML fragment into the RUNTIMEXML column.

    The following is an example SQL statement for a new condition. 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>');

    Where:

    preletemplate_id
    The ID of this price rule element template definition. Choose a number greater than 1000 that is not already used for another price rule element template definition.
    identifier
    The unique name of this price rule element template definition. You must refer to this name in the objectType when you create the object definition for the price rule element.
    storeent_id
    The store identifier to which the price rule belongs.
    description
    A description of this price rule element template.
    preletpltgrp_id
    The unique identifier of template group to which this price rule element belongs.
    • For a condition, use this value: 2
    • For an action, use this value: 3
    runtimexml
    The runtime XML code for this price rule element template definition. In the XML code, enclose attribute values in double quotation marks, for example, value="PRICERULE_registrationTime". Do not use single quotation marks.