Registering a custom email activity template

By registering a custom email activity template, you make the template available to business users within the Marketing tool. To register a custom template, update the Struts configuration file for your store and the HCL Commerce database to include your custom template in the list of available templates.

Before you begin

Ensure that you know the storeId value for your store. This value is stored within the STOREENT.STOREENT_ID database column.

Procedure

  1. Open HCL Commerce Developer and switch to the Enterprise Explorer view.
  2. Locate the customized struts configuration.
    • Expand Stores > WebContent > WEB-INF.
    • HCL Commerce Version 9.0.1.0 or laterExpand Stores > src.
  3. Open the configuration file for editing.
    • struts-config-ext.xml
    • HCL Commerce Version 9.0.1.0 or laterstruts-wcs-stores-custom.xml
  4. Add the email template mapping to the struts configuration file.
    • Add the following <forward> element configuration to the struts-config-ext.xml file.
      
      <forward className="com.ibm.commerce.struts.ECActionForward" 
       name="template_view/storeId/-3" 
       path="template_path">
          <set-property property = "interfaceName" value = "com.ibm.commerce.messaging.viewcommands.MessagingViewCommand"/>
          <set-property property = "implClassName" value = "com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/>
      </forward>
      Where:
      • template_view is the Struts view name for identifying the custom email template.
      • storeId is the store ID as defined in the STORE_ID column of the STOREENT database table. Use -3 as shown. This value specifies the email transport.
      • template_path is the path to the custom email template JSP file.
      For example, the following forward configuration configures an email template JSP for an activity related to sending emails about abandoned shopping carts.
      
      <forward className="com.ibm.commerce.struts.ECActionForward"    
          name="AbandonedCartEmail/10101/-3" 
          path="/include/AbandonedCart.jsp">
          <set-property property="interfaceName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommand"/>
          <set-property property="implClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/>
      </forward> 
    • HCL Commerce Version 9.0.1.0 or laterAdd the following <result> element configuration to the struts-wcs-stores-custom.xml file:
      <result name="template_view/storeId/-3" type="wcsstore">
      	<param name="location">template_path</param>
      	<param name="interfaceName">com.ibm.commerce.messaging.viewcommands.MessagingViewCommand</param>
      	<param name="implClassName">com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl </param>
      </result> 
      
      Where:
      • template_view is the Struts view name for identifying the custom email template.
      • storeId is the store ID as defined in the STORE_ID column of the STOREENT database table. Use -3 as shown. This value specifies the email transport.
      • template_path is the path to the custom email template JSP file.
      For example, the following forward configuration configures an email template JSP for an activity related to sending emails about abandoned shopping carts.
      <result name="AbandonedCartEmail/10101/-3" type="wcsstore">
      	<param name="location">/include/AbandonedCart.jsp</param>
      	<param name="interfaceName">com.ibm.commerce.messaging.viewcommands.MessagingViewCommand</param>
      	<param name="implClassName">com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl </param>
      </result> 
      
  5. Save and close the struts-config-ext.xml file (Version 9.0.0.x), or the struts-wcs-stores-custom.xml file (Version 9.0.1+).
  6. Connect to your development environment database and run the following SQL statement to register the template.
    
    INSERT INTO EMLMSG (EMLMSG_ID, STOREENT_ID, JSPPATH, NAME, STATUS, EMLBODYTYPE, PROPERTYFILE) 
    VALUES (emlmsg_id, storeId, 'template_view', 'template_name', 1, 0, '');
    
    Where:
    • emlmsg_id is a numeric ID that you assign to the email message, for example, 10.
    • storeId is the store ID as defined in the STORE_ID column of the STORE table.
    • template_view is the Struts view name for identifying the custom email template. This name must match the template_view name that you specified in the <forward> element.
    • template_name is the name for the custom email template that displays in Management Center to business users.
    For example,
    
    INSERT INTO EMLMSG (EMLMSG_ID, STOREENT_ID, JSPPATH, NAME, STATUS, EMLBODYTYPE, PROPERTYFILE) 
    VALUES (10, 10101, 'AbandonedCartEmail', 'Reminder for abandoned carts', 1, 0, '');
    
  7. Restart the HCL Commerce Test Server for your changes to take effect.
  8. Deploy your changes to the production environment.