Develop > Presentation layer > Customize promotions > Promotions customization: Management Center > Create a custom promotion type in the Management Center


Register a serialization JSP file for the new object definition

The serialization JSP file takes the promotion authoring elements from the PX_ELEMENT and PX_ELEMENTNVP tables and displays them in the the Management Center user interface for the new promotion type. Business users can then use this section of the user interface when they create promotions.

The serialization JSP file is provided with the Management Center. It is named SerializeGenericPromotionElement.jsp. This file serializes the user interface elements in the user interface for the default promotion types. You can use this same file to serialize the user interface elements of a custom promotion type. Register this file with the new promotion type. Note that the PX_ELEMENT and PX_ELEMENTNVP tables are initially empty until a business user creates a new promotion using the Management Center.


Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.

  2. Expand LOBTools > WebContent > WEB-INF.

  3. Open the struts-extension.xml file with a Struts configuration file editor.

  4. Add a new action mapping:

    1. Click the ActionMappings tab.

    2. In the Action Mappings section, click Add.

    3. Under The following Action Mappings are defined for this config file, type /SerializePromotionElement-name_of_custom_object_definition

      For the name_of_custom_object_definition variable, use the name of the object definition you created, for example, ProductLevelPWPFixedCostDiscountPurchaseCondition.

    4. In the Action Mapping attributes section, select Include, and then type /jsp/commerce/promotion/restricted/SerializeGenericPromotionElement.jsp

    5. Save the struts-extension.xml configuration file.

    6. To verify the updates, view the source of the struts-extension.xml configuration file and ensure you see the code you added, as shown here:

      <action path="/SerializePromotionElement-name_of_custom_object_definition" 
              include="/jsp/commerce/promotion/restricted/SerializeGenericPromotionElement.jsp"/>  
      

  5. Restart the WebSphere Commerce test server to make the new configuration available.


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 new action mapping added to the existing struts-extension.xml file looks like this:

<action path="/SerializePromotionElement-ProductLevelPWPFixedCostDiscountPurchaseCondition"
      include="/jsp/commerce/promotion/restricted/SerializeGenericPromotionElement.jsp"/>


Previous topic: Add the new promotion type to the Promotion Type Selector window


Next topic: Create the XSLT template to transform the promotion XML


+

Search Tips   |   Advanced Search