Registering 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 Management Center user interface for your new promotion type. Business users can then use this section of the user interface when they create promotions.

About this task

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. You must 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 HCL Commerce Developer and switch to the Enterprise Explorer view.
  2. Expand LOBTools > WebContent > WEB-INF.
  3. Open one of the following files for editing, depending on your HCL Commerce version.
    • For HCL Commerce Version 9.0.0.x, open struts-extension.xml file with a Struts configuration file editor.
    • HCL Commerce Version 9.0.1.0 or laterOpen the spring-extension.xml file for editing.
  4. If you are using Version 9.0.0.x, 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 your 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. HCL Commerce Version 9.0.1.0 or laterAdd a new view controller.
    1. Add a new view controller element.
       <bean id="/SerializePromotionElement-name_of_custom_object_definition" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
      <property name="viewName" value="/jsp/commerce/promotion/restricted/SerializeGenericPromotionElement.jsp"/>
      </bean>
    2. Save and close the spring-extension.xml file.
  6. Restart the HCL Commerce test server to make the new configuration available.

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:
  • For Version 9.0.0.x, 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"/>
    
  • HCL Commerce Version 9.0.1.0 or laterThe new view controller looks like this:
    <bean id="/SerializePromotionElement-ProductLevelPWPFixedCostDiscountPurchaseCondition" class="org.springframework.web.servlet.mvc.ParameterizableViewController">
    <property name="viewName" value="/jsp/commerce/promotion/restricted/SerializeGenericPromotionElement.jsp"/>
    </bean>