Develop > Presentation layer > Customize promotions > Promotions customization: Management Center > Create a custom promotion type in the Management Center
Specify 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 collect information from business users have already been defined for use in the existing promotion types. When creating a new promotion type, specify which of these widgets you need, and then arrange and customize them as required to support the 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:
In the Management Center, each object definition has a different wcfObjectProperties class 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, 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
- Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- Create a directory to store the new property group file. You can store the file in a directory structure similar to the following example:
LOBTools/WebContent/WEB-INF/src/lzx/your_company_name/promotion/propertiesViews/promotionTypes/
- Create an OpenLaszlo class file with this syntax: propromotion_type_nameProperties.lzx, for example, proProductLevelPWPFixedCostDiscountProperties.lzx.
- Define the new property group. See the example at the end of this procedure.
- Register 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/
- Create an instance of the new property group in the PromotionPropertiesView.lzx file.
The file is stored at this path:
LOBTools/WebContent/WEB-INF/src/lzx/commerce/promotion/propertiesView/
Example
For the 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:
<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>
For 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>
Previous topic: Create the object template for the new promotion type
Next topic: Add the new promotion type to the Promotion Type Selector window