HCL Commerce Enterprise

Example: price rule element template for an action

When creating a custom action 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 action in this sample is to get an external price for a catalog entry by calling external service. The SQL statement looks like this:

INSERT INTO PRELETEMPLATE VALUES 
(11,'customGetExternalPriceAction',0,'Custom get external price action element.',3,'
<FlowElementImplementation type="CustomGetExternalPriceAction">
<Implementation invocationType="TaskCommand">
<Class name="com.ibm.commerce.price.rule.commands.element.CustomGetExternalPriceActionElementCmd">
<Argument name="serviceURL" value="PRICERULE_serviceURL"/> 
</Class></Implementation></FlowElementImplementation>',null,null,null,0);
For this example, the PRICERULE_serviceURL parameter in the element template definition will be replaced with the actual URL (for example, http://mycompany.com/external/offerprice) when the price rule is used on the storefront to set pricing.