Specifying widgets for the promotion type properties view

Declare the widgets and child list editors for business users to enter data about the new promotion type. By doing this, you create the user interface, called the properties view, for the custom promotion type. The input widgets you need to collect information from business users have already been defined for use in the existing promotion types. When creating a new promotion type, you must specify which of these widgets you need, and then arrange and customize them as required to support your promotion type.

Before you begin

Review the following topics to ensure that you understand the basics of how to customize the Management Center user interface as well as the classes related to the properties view:

About this task

In the Management Center, each object definition has a different wcfObjectProperties class or ObjectProperties definition that is used to edit the properties of that specific object type. In the Promotions tool, all promotions are represented by a single object type. This means that they all share the same wcfObjectProperties class or ObjectProperties definition, that is, the properties view definition. Each promotion type then has its own unique property group to define the purchase condition and reward section of the properties view. The purchase condition and reward section is the only section of the properties view that is different from one promotion type to the next.

When a business user is creating a promotion, only the property groups for that specific promotion type are displayed in the Promotions tool user interface.

Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. Create a directory to store your new property group file.
    You can store the file in a directory structure similar to the following example:
    • WebSphere Commerce Version 7.0.0.0Feature Pack 1LOBTools/WebContent/WEB-INF/src/lzx/your_company_name/promotion/propertiesViews/promotionTypes/
    • Introduced in Feature Pack 2LOBTools/WebContent/config/your_company_name/promotion/propertiesViews/promotionTypes
  3. Create a new file for the promotion element object definition:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1OpenLaszlo (.lzx) class file WebSphere Commerce Version 7.0.0.0Feature Pack 1Use the following syntax to create this file: propromotion_type_nameProperties.lzx, for example, proProductLevelPWPFixedCostDiscountProperties.lzx.
    Introduced in Feature Pack 2Definition (.def) file Introduced in Feature Pack 2Use the following syntax to create this file: promotion_type_nameProperties.def, for example, ProductLevelPWPFixedCostDiscountProperties.def.
  4. Define the new property group.
    See the example at the end of this procedure.
  5. WebSphere Commerce Version 7.0.0.0Feature Pack 1Register the new property group definition in the PromotionExtensionsLibrary.lzx file.

    The file is stored at this path:

    LOBTools/WebContent/WEB-INF/src/lzx/commerce/promotion/

  6. Complete one of the following steps:
    OptionDescription
    WebSphere Commerce Version 7.0.0.0Feature Pack 1Create an instance of the new property group in the PromotionPropertiesView.lzx file WebSphere Commerce Version 7.0.0.0Feature Pack 1This file is stored in the LOBTools/WebContent/WEB-INF/src/lzx/commerce/promotion/propertiesView/ directory.
    Introduced in Feature Pack 2Add the new property group to the promotion properties view in the PromotionPropertiesView.def file Introduced in Feature Pack 2This file is stored in the LOBTools/WebContent/config/commerce/promotion/propertiesView directory.

Example

For your custom promotion type, Customers who purchase two dining chairs (FULO-01) qualify to purchase a dining table (FULO-02) at the reduced price of $200, the code for the property group to declare the property editor widgets and child list editors looks like this:

WebSphere Commerce Version 7.0.0.0Feature Pack 1

<class name="proProductLevelPWPFixedCostDiscountProperties"
      extends="wcfPropertyGroup" collapsable="false">
   <wcfEnablementCondition conditionId="promotionType"
         propertyName="promotionType" enablementValue="ProductLevelPWPFixedCostDiscount"/>
   <wcfPropertyGroup name="purchaseConditionAndRewardGroup"
         groupTitle="purchaseConditionAndRewardTitle">
      <wcfPropertyChildListEditor objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition/Purchase"
            objectTypes="Identifier_CatalogEntry,Identifier_InheritedCatalogEntry"
            name="purchaseCatalogEntry" listClass="proProductElementTypeGrid" required="true"
            promptText="Select_SKU_X" />
      <wcfPropertyStepper objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition/Purchase"
            propertyName="Quantity" required="true" promptText="Quantity_of_X" />
      <wcfPropertyChildListEditor objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition/Reward"
            objectTypes="Identifier_CatalogEntry" name="rewardCatalogEntry"
            listClass="proProductElementTypeGrid" required="true" promptText="Select_SKU_Y" />
      <wcfPropertyStepper objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition/Reward"
            propertyName="Quantity" required="true" promptText="Quantity_of_Y" />
      <wcfPropertyNumericText objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition"
            propertyName="FixedCost" required="true" promptText="Discount_on_Y" />
   </wcfPropertyGroup>
</class>  
In this example, the code to create an instance of the new property group in the properties view looks like this:

<class name="proPromotionManageTabPaneContent" extends="wcfPropertyPane">
   .
   .
   . 	
   <proProductLevelPWPFixedCostDiscountProperties/>
   .
   . 
</class>
Introduced in Feature Pack 2
<PropertyGroup definitionName="proProductLevelPWPFixedCostDiscountProperties"
      collapsable="false">
   <EnablementCondition conditionId="promotionType" propertyName="promotionType"
         enablementValue="ProductLevelPWPFixedCostDiscount"/>
   <PropertyGroup name="purchaseConditionAndRewardGroup"
         groupTitle="purchaseConditionAndRewardTitle">
      <PropertyChildListEditor
            objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition/Purchase"
            objectTypes="Identifier_CatalogEntry,Identifier_InheritedCatalogEntry"
            name="purchaseCatalogEntry" listDefinitionName="proProductElementTypeGrid"
            required="true" promptText="Select_SKU_X" />
      <PropertyStepper
            objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition/Purchase"
            propertyName="Quantity" required="true" promptText="Quantity_of_X" />
      <PropertyChildListEditor
            objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition/Reward"
            objectTypes="Identifier_CatalogEntry" name="rewardCatalogEntry"
            listClass="proProductElementTypeGrid" required="true"
            promptText="Select_SKU_Y" />
      <PropertyStepper
            objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition/Reward"
            propertyName="Quantity" required="true" promptText="Quantity_of_Y" />
      <PropertyNumericText objectPath="ProductLevelPWPFixedCostDiscountPurchaseCondition"
            propertyName="FixedCost" required="true" promptText="Discount_on_Y" />
   </PropertyGroup>
</PropertyGroup>
In this example, the code to add the new property group to the promotion properties view looks like this:
<PropertyPane definitionName="proPromotionManageTabPaneContent">
   .
   .
   . 	
   <PropertyGroup baseDefinitionName="proProductLevelPWPFixedCostDiscountProperties"/>
   .
   . 
</PropertyPane>