Tutorials > Management Center > Create a new promotion type

< Previous | Next >


Create the gift reward grid class or list view definition for the user interface

In this lesson, you create the Management Center user interface element in which business users specify the free gift and quantity information for the promotion. This Management Center user interface element is:

For this new promotion type, business users can specify a gift comprising multiple (different) catalog entries in varying quantities. To support this in the user interface, you need a grid with the following three columns:

By default, the Promotions tool has a gift reward grid. The grid contains two columns: Type and Catalog entry.

To support the new promotion type, add an additional column called Quantity for free.

You must also customize this gift grid to allow business users to add additional rows, to accommodate multiple (different) catalog entries as gifts. This is covered in the next lesson, Create the promotion properties view for the user interface.


Procedure

  1. Complete one of the following steps:

    Option Description
    Create a folder for the gift reward grid class

    1. In the Enterprise Explorer view, navigate to the LOBTools > WebContent > WEB-INF > src > lzx > mycompany > promotion directory.

    2. Right-click the promotion folder and click New > Folder.

    3. In the Folder name field, type listViewDefinitions.

    4. Click Finish. The directory structure should now look like this screen capture:

    Create a folder for the gift reward list view definition

    1. In the Enterprise Explorer view, navigate to the LOBTools > WebContent > config > mycompany > promotion directory.

    2. Right-click the promotion folder and click New > Folder.

    3. In the Folder name field, type listViewDefinitions.

    4. Click Finish. The directory structure should now look like this screen capture:

  2. Complete one of the following steps:

    Option Description
    Create a new OpenLaszlo file to define the new gift grid

    1. Right-click the listViewDefinitions folder.

    2. Click New > File.

    3. Click New > Other.

    4. In the "Select a wizard" window, expand the Simple folder and click File.

    5. Click Next.

    6. Name the new file ChildListEditorListViews.lzx.

    7. Click Finish to save the file. The file opens in the default XML editor.
    Create a new definition file to define the new gift list view

    1. Right-click the listViewDefinitions folder.

    2. Click New > File.

    3. Name the new file ChildListEditorListViews.def.

    4. Click Finish to save the file. The file opens in the default XML editor.

  3. To define the gift reward grid:

    Option Description
    ChildListEditorListViews.lzx In this new class file:

    1. Copy and paste the following code:

      <library>
        
      <class name="extProGiftRewardGrid" extends="proProductGrid" preferenceKey="extProductGrid">
          
      <wcfGridStepper name="giftQuantity" propertyName="giftQuantity" minimumValue="1"
               editable="true" visible="true" width="200" required="true" 
               text="${extPromotionResources.promotion_Free_gift_qty.string}" />
        
      </class>
      </library>
      

    2. Save and close the file.

    This class extends the proProductGrid class, which the Promotions tool provides. This class displays the contents and characteristics of a list of SKUs, products, or kits as promotion gifts. On this grid, the code above adds a new column named giftQuantity to capture this value. The wcfGridStepper class is used as an input widget to allow business users to enter an integer for the gift quantity. This column is defined as a mandatory entry, and the minimum value is 1.

    ChildListEditorListViews.def In this new definition file:

    1. Copy and paste the following code:

      <Definitions>
         
      <ObjectGrid definitionName="extProGiftRewardGrid" baseDefinitionName="proProductGrid"
              preferenceKey="extProductGrid">
          
      <GridStepper name="giftQuantity" propertyName="giftQuantity" minimumValue="1"
               editable="true" visible="true" width="200" required="true"
               text="${extPromotionResources.promotion_Free_gift_qty}"/>
         
      </ObjectGrid>
      </Definitions>
      

    2. Save and close the file.

    This definition extends proProductGrid definition, which the Promotions tool provides. This definition displays the contents and characteristics of a list of SKUs, products, or kits as promotion gifts. On this grid, the previous code sample adds a new column named giftQuantity to capture this value. The wcfGridStepper class is used as an input widget to allow business users to enter an integer for the gift quantity. This column is defined as a mandatory entry, and the minimum value is 1.

  4. Right-click the ChildListEditorListViews.lzx file; then click Build OpenLaszlo Project on the context menu.

  5. Register the grid class file in the promotion extensions library:

    1. In the PromotionExtensionsLibrary.lzx file, which should still be open from a previous step, add the following include statement within the <library> element:

      <include href="../../mycompany/promotion/listViewDefinitions/ChildListEditorListViews.lzx"/>
      

    2. Save the file.

    3. Right-click the PromotionExtensionsLibrary.lzx file; then click Build OpenLaszlo Project on the context menu.

In this lesson, you created the Management Center widget where business users can specify the promotion gifts and their quantity. In the next lesson, you create the remaining Management Center user interface widgets to support the promotion.

< Previous | Next >


+

Search Tips   |   Advanced Search