Disabling and enabling commands and views in preview

The commands and views disabled in preview are determined by the preview exclusion file. Initially, this file is empty, meaning that all commands and views are enabled in preview.

Procedure

  • Disable a command or view in preview
    1. Copy the following file to a temporary location:
      • workspace_dir/WC/xml/config/previewExclusion.xml

      This file should never be directly modified. For more information, refer to XML configuration directory.

    2. Open the temporary copy of the file in a text editor.
    3. Add the command or view to disable in preview in a RestrictedCommand tag.

      For commands, you need the URL for the command or view. To determine the URL for a command or view, examine the contents of the struts-config.xml file in the following directory:

      • WC_eardir/Stores.war

      You can determine the short names for command and views by examining the path property of the action tag. The short name is the value in the path property without the initial slash character ("/").

      HCL Commerce Developer You can also find the URLs for commands and views that you want to disable by referring to URLs.

      For example, OrderItemUpdate has the following entry in the struts-config.xml file (in HCL Commerce Version 9.0.0.x):

      
      <action-mappings
      type="com.ibm.commerce.struts.ECActionMapping">
      ...
        <action nparameter="com.ibm.commerce.orderitems.commands.OrderItemUpdateCmd"
      path="/OrderItemUpdate" type="com.ibm.commerce.struts.BaseAction">
          <set-property property="authenticate" value="0:0"/>
          <set-property property="https" value="0:1"/>
      </action> 
      
      In Version 9.0.1+, the code looks like this:
      <action class="com.ibm.commerce.struts.v2.BaseAction" name="OrderItemUpdate">
      <param name="authenticate">0:0</param>
      <param name="csrfProtected">0:0</param>
      <param name="https">0:1</param>
      <param name="parameter">com.ibm.commerce.orderitems.commands.OrderItemUpdateCmd</param>
      </action>

      To prevent the OrderItemUpdate URL from running within preview, add the following text:

      <RestrictedCommand>OrderItemUpdate</RestrictedCommand>

      The resulting file looks like this:

      
        <?xml version="1.0" encoding="ISO-8859-1" standalone="no"
      ?>
        <RestrictedCommands
      xmlns="http://www.ibm.com/WebSphereCommerce"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.ibm.com/WebSphereCommerce
      previewExclusion.xsd">
        
       
      <RestrictedCommand>OrderItemUpdate</RestrictedCommand>
        
        </RestrictedCommands>
      
    4. Save the preview exclusion file.
    5. Update HCL Commerce with the updated file. For more information, see the Updating enterprise application files topic. Ensure that you follow the instructions for updating a single file.

      You will need the following information:

      Enterprise application name
      WC_enterpise_application
      Relative path to file
      xml/config/previewExclusion.xml
    6. Open the Administration Console and select Site on the Administration Console Site/Store Selection page.
    7. Click Configuration > Registry. A list of registry components is displayed.
    8. Select Preview Command Exclusion and click Refresh. You do not need to restart the HCL Commerce server.
  • Enable a command or view in preview
    1. Copy the following file to a temporary location:
      • workspace_dir/WC/xml/config/previewExclusion.xml
    2. Open the temporary copy of the file in a text editor.
    3. Remove the commands that you want to enable in preview.
    4. Save the preview exclusion file.
    5. Update HCL Commerce with the updated file. For more information, see the Updating enterprise application files topic. Ensure that you follow the instructions for updating a single file.

      You will need the following information:

      Enterprise application name
      WC_enterpise_application
      Relative path to file
      xml/config/previewExclusion.xml
    6. Open the Administration Console.
    7. Click Configuration > Registry.
    8. Select Preview Command Exclusion and click Refresh. You do not need to restart the Transaction server.