WebSphere Commerce EnterpriseIntroduced in Feature Pack 2

Creating the summary for the price rule element

If you want to display summary text below the price rule element in the Price Rule Builder work area, create a new extension class for this summary. In the Price Rule Builder, business users can read the summary text to quickly understand how an element is being used in a price rule.

Before you begin

The summary class for a new price rule element is an extension class of the wcfFlowElementSummary class. Review the following topic to ensure that you understand the class:

lzx/commerce/foundation/restricted/flowBuilder/FlowElementSummary.lzx/wcfFlowElementSummary

About this task

This is an example of the summary for a condition as it would display to a business user in the Price Rule Builder work area; the summary is the text Customer registered before January 31, 2010:
Example of a price rule element summary

Typically, summary text can be either static text or a combination of static and dynamic text. In the previous example, all the text is static except for the actual date. This date changes dynamically depending on the date the business user specifies in the properties of the condition. You can review additional examples of summaries by looking at other price rule conditions and actions in Management Center.

Consider using the summary class of an existing, similar price rule element as a starting point for your new price rule element. The existing summary class files are stored here:

LOBTools/WebContent/WEB-INF/src/lzx/commerce/price/restricted/propertiesViews/priceRuleBuilder/

Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. Create a directory to store your new summary file.
    Use a directory structure similar to the following example:

    LOBTools/WebContent/WEB-INF/src/lzx/your_company_name/price/propertiesViews/priceRuleBuilder/

  3. Create an OpenLaszlo class file with this syntax: pricerule_element_nameSummary.lzx, for example, RegistrationTimeConditionSummary.lzx.
  4. Define the new summary class.
    Here is the code that produces the summary class in the previous example:
    <library>
        <class name = "prcRegistrationTimeConditionElementSummary" extends = "wcfFlowElementSummary">
            <wcfFlowSummaryParam name = "registrationTimeOperator" propertyName = "registrationTimeOperator"/>
            <wcfFlowSummaryParam name = "registrationTime" propertyName = "registrationTime"/>
            <!--- @keywords private -->
            <handler name = "oninit">
                <![CDATA[
                this.updateSummaryDel.register(prcMyPriceResources.summary_afterCondition, "onstring");
                this.updateSummaryDel.register(prcMyPriceResources.summary_beforeCondition, "onstring");
                this.updateSummaryDel.register(prcMyPriceResources.summary_equalCondition, "onstring");
                ]]&gt;
            </handler>
            <method name = "updateSummary" args = "e=null"> 1
                <![CDATA[
                var summaryText = "";
                var inputRegistrationTime=this.resolvedParams["registrationTime"];
                var operator=this.resolvedParams["registrationTimeOperator"];
                
                if(inputRegistrationTime!=""){
                if(operator == ">") {					
                summaryText = prcMyPriceResources.replaceValues("summary_afterCondition", [inputRegistrationTime]);
                }	
                if(operator == "<"){				           
                summaryText = prcMyPriceResources.replaceValues("summary_beforeCondition", [inputRegistrationTime]);
                }
                if(operator == "="){		
                
                summaryText = prcMyPriceResources.replaceValues("summary_equalCondition", [inputRegistrationTime]);
                
                }
                
                } 
                this.setSummaryText(summaryText);	2		    
                ]]&gt;
            </method>
        </class>
    </library>

    The following describes the lines with black numbered callouts:

    • 1 The updateSummary method sets the summary text for the price rule element.
    • 2 The updateSummary method must call the setSummaryText method with the summary text.
  5. Register this new summary class in the following file:

    LOBTools/WebContent/WEB-INF/src/lzx/commerce/price/PricingExtensionsLibrary.lzx

    The line of code that references the new summary class should look like the following example:

    <include href="../../your_company_name/price/propertiesViews/priceRuleBuilder/pricerule_element_nameSummary.lzx"/>