Enable rule-based sales categories

We can enable rule-based sales categories so that business users can apply the rules for rule-based sales categories in the Catalogs tool. When we are enabling rule-based sales categories, we can also configure properties to control how to automatically reapply the rules for rule-based sales categories.

By default, business users can create, change, and delete rule-based sales categories and define the rules for the categories, but they cannot apply the rules. Before a business user can apply the rule for finding and assigning catalog entries, we must enable the evaluation and application of rule-based sales category rules.

When we are updating our custom catalog component configuration file, we can also configure the values that control automatically reapplying the rule for each category.


Procedure

  1. Edit...

    Note: If the custom com.ibm.commerce.catalog-ext directory and wc-admin-component.xml file does not exist for the site, we must create the directory and file.

  2. Go to the following directory and open the default wc-admin-component.xml catalog features component configuration file:

    The wc-admin-component.xml file in this directory includes configuration properties that you set to change the behavior of catalog-related features. The RuleBasedCategoryConfiguration configuration grouping in this file includes the configurable properties specific to rule-based sales categories.

  3. Copy the following RuleBasedCategoryConfiguration configuration grouping from the default wc-admin-component.xml configuration file into the corresponding location in our custom wc-admin-component.xml configuration file.

      <_config:configgrouping name="RuleBasedCategoryConfiguration">
        <_config:property name="evaluationEnabled" value="false" />
        <_config:property name="evaluationHostname" value="" />	
        <_config:property name="evaluationTimeInterval" value="-1" />
      </_config:configgrouping>

    The comments in the file are omitted for readability.

  4. In our custom wc-admin-component.xml configuration file, enable the evaluationEnabled configurable property by setting the value for the property to "true". This property indicates whether the rules for rule-based categories can be applied to the categories. This setting applies for all rule-based sales categories in the system. When the rule is applied to a category, WebSphere Commerce search uses the rule to find catalog entries that match the search filters in the rule. The catalog services then assign the catalog entries to the category. The resulting relationships between the catalog entries and the category are stored in the CATGPENREL database table.

    When this property is enabled, a check is performed to determine whether the EvaluateRuleBasedCategories job is being run in a production environment. If the environment that we are running the EvaluateRuleBasedCategories job within does not have workspaces or a configured staging environment, the evaluationEnabled property is disabled. This check ensures that the rule does not get reapplied in the production environment. If rules need to be defined for assigning catalog entries that exist only in a production environment, copy the data from the product environment to the authoring environment. By applying the rules for a category in an authoring environment, the application of the rule can be tested and approved before the category is propagated to production.

    Note: We can reset the enablement configuration setting and other rule-based sales category configuration settings by changing the values for the properties and refreshing the RuleBasedCategoryConfiguration registry in the Administration Console. If our custom wc-admin-component.xml file includes only the RuleBasedCategoryConfiguration grouping, the contents of your file can look like the following file:

      <_config:DeploymentConfiguration 
        xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-admin-component.xsd">
        <_config:extendedconfiguration>
          <_config:configgrouping name="RuleBasedCategoryConfiguration">
            <_config:property name="evaluationEnabled" value="true" />
            <_config:property name="evaluationHostname" value="" />	
            <_config:property name="evaluationTimeInterval" value="-1" />
          </_config:configgrouping>
        </_config:extendedconfiguration>
      </_config:DeploymentConfiguration>

  5. Optional: Configure the properties that control the use of a EvaluateRuleBasedCategories job for automatically reapplying rule-based sales category rules. By configuring these properties, the rule evaluation and application job can run automatically after a configured amount of time elapses from the last time that the rule was evaluated.

    1. In our custom wc-admin-component.xml configuration file, set a value for the evaluationHostname configurable property. This property ensures that the EvaluateRuleBasedCategories job runs on only a single node. Consider setting a value for this property to isolate the process for finding and assigning catalog entries to rule-based sales categories from other processes.

      Set the value for this evaluationHostname property to be the hostname for the server that we want the EvaluateRuleBasedCategories job to run on.

    2. Set a value for the evaluationTimeInterval configurable property to be a positive value. This value is the time interval in seconds that elapses before the job runs to reapply the rule for a category. The default value for this property is "-1", which indicates that the evaluation job is to never run.

      When the time interval elapses, the EvaluateRuleBasedCategories job runs to reapply the rule to a category. This interval is measured independently for each rule-based category from the time that the rule was last applied.

      Note: If you set a value that causes rules to be reapplied frequently, multiple evaluation jobs are added to the scheduler, which can affect performance. If you configure the evaluation job to run infrequently, business users that are working with the category in Management Center might not be working with most current catalog entries that belong in the category. Business users must then manually reapply the rule to work with an up-to-date category.

      This time interval is ignored when the value in the CATGRPRULE.EVALUATING column for a category is set to "2". This column value indicates that the job to reapply the rule can be run regardless of the time interval. For example, when the buildindex REST API is called as part of a staging propagation process. When the search indexing completes, the column value for any updated categories is set to "2" and an event listener is triggered. The event listener calls the RuleBasedCategoryHelper utility class to begin the process to reapply the rule for the categories.

  6. Save and close the file.

  7. Optional: Configure the maximum number of catalog entries that can be returned by WebSphere Commerce search to be assigned to a rule-based sales category. The value for this property sets an upper limit for the number of catalog entries that can be assigned in case a business user does not set a maximum value in the Catalogs tool for a category or sets the value too high. The count for this limit is based on the products, bundles, kits, and category-level SKUs that match the search filter conditions and are specified by a business user.

    1. Go to the following directory and open our custom wc-search.xml WebSphere Commerce search configuration file for editing:

      Note: If the custom wc-search.xml file does not exist for the site, we must create the directory and file

    2. Go to the following directory and open the default wc-search.xml WebSphere Commerce search configuration file:

    3. Search for the following configuration profile:

        <_config:profile indexName="CatalogEntry" name="IBM_salesCatalogDynamicCatalogEntryRecommendation">
          <_config:query>
            <_config:param name="maxRows" value="500"/>
            <_config:param name="maxTimeAllowed" value="15000"/>
            .....
          </_config:query>
          <_config:result>
            <_config:field name="catentry_id"/>
          </_config:result>
        </_config:profile>

    4. Copy the "maxRows" configurable property from the default wc-search.xml file to the corresponding location in our custom file.

    5. Change the value of the "maxRows" configurable property to set the maximum number of catalog entries that can be assigned to a category.

    6. Save and close the file.

  8. Test the configuration changes.


Related concepts
Rule-based sales categories
Rule-based sales category overview


Related tasks
Define the rule for assigning catalog entries to a rule-based sales category
Reapply the rule to assign catalog entries to a rule-based sales category
Administer rule-based sales categories
Create the rule-based sales category evaluation scheduled job