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.
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:
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
- Open
WebSphere Commerce Developer and switch to the Enterprise Explorer
view.
- 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/
- Create an OpenLaszlo class
file with this syntax:
pricerule_element_nameSummary.lzx
,
for example, RegistrationTimeConditionSummary.lzx.
- 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");
]]>
</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
]]>
</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.
- 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"/>