Excluding characters from automatically generated promotion codes

You can omit certain characters from being included in automatically generated promotion codes by configuring the unique promotion code pattern settings in wc-admin-component.xml. This prevents confusion for characters that look similar, such as the numeric 0, and the letter O.

Before you begin

To understand the properties that this file contains, see Promotion component configuration file (wc-admin-component.xml).

Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. Create a folder for your customized promotions component configuration file:
    1. Navigate to the following directory:

      WC_eardir\xml\config\

    2. In the config folder, add a com.ibm.commerce.promotion-ext folder so the directory looks like this:

      WC_eardir\xml\config\com.ibm.commerce.promotion-ext\.

      If this folder exists and it contains a customized version of the wc-admin-component.xml file, then open the file and skip to step 6.

  3. Navigate to the following directory:

    WC_eardir\xml\config\com.ibm.commerce.promotion\

  4. Copy the wc-admin-component.xml file to the new com.ibm.commerce.promotion-ext folder you created in the step 2.
  5. Open the copied wc-admin-component.xml in an editor. This copy becomes the customized version of the wc-admin-component.xml file.
  6. Change any properties as required for your site. The characters that you do not want to include in the automatically generated promotion codes must not be indicated within the <value> tag.
    1. If you use pattern a, update the <value> element in line 1 to indicate which lowercase characters to include.
    2. If you use pattern M, update the <value> element in line 2 to indicate which lower and uppercase characters to include.
    3. If you use pattern A, update the <value> element in line 3 to indicate which uppercase characters to include.
    4. If you use pattern x, update the <value> element in line 4 to indicate which numeric and lowercase characters to include.
    5. If you use pattern N, update the <value> element in line 5 to indicate which numeric, lower, and uppercase characters to include.
    6. If you use pattern X, update the <value> element in line 6 to indicate which numeric and uppercase characters to include.
    7. If you use pattern D, update the <value> element in line 7 to indicate which numeric characters to include.
  7. Save and close your file. After these changes, your file should resemble the following sample:
    <?xml version="1.0" encoding="ISO-8859-1">
    
    <_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="UniquePromotionCode">
    
            <!-- Sample settings for UniquePromotionCode pattern properties> where the following characters are removed from unique promotion code generation:
            numeric   :    1, 0
            lower case: i, l, o
            upper case: I, L, O
            note: Simple system-generated promotion codes uses pattern X (numbers and upper case characters)
            Advanced system-generated promotion codes can use any of the patterns. 	
    
            1<!-- Property to indicate lowercase characters.
            pattern: a
            original value: abcdefghijklmnopqrstuvwxyz -->
            <_config:property name="com.ibm.commerce.promotion.uniquecode.generator.AlphabeticLowerPatternCharacters" value="abcdefghjkmnpqrstuvwxyz"/>	
    
            2<!-- Property to indicate lower and upper case characters. 
            pattern: M 
            original value: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -->
            <_config:property name="com.ibm.commerce.promotion.uniquecode.generator.AlphabeticMixPatternCharacters" value="abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ"/>
    
            3<!-- Property to indicate upper case characters.
            pattern: A 
            original value: ABCDEFGHIJKLMNOPQRSTUVWXYZ -->   
            <_config:property name="com.ibm.commerce.promotion.uniquecode.generator.AlphabeticUpperPatternCharacters" value="ABCDEFGHJKMNPQRSTUVWXYZ"/>
    
            4<!-- Property to indicate numeric and lower case characters.
            pattern: x 
            original value: abcdefghijklmnopqrstuvwxyz0123456789 -->
            <_config:property name="com.ibm.commerce.promotion.uniquecode.generator.AlphaLowerNumericPatternCharacters" value="abcdefghjkmnpqrstuvwxyz23456789"/>
    
            5<!-- Property to indicate numeric, lower and upper case characters.
            pattern: N 
            original value: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -->
            <_config:property name="com.ibm.commerce.promotion.uniquecode.generator.AlphaMixNumericPatternCharacters" value="abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789"/>
    
            6<!-- Property to indicate numeric and upper case characters.
            pattern: X 
            original value: ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -->
            <_config:property name="com.ibm.commerce.promotion.uniquecode.generator.AlphaUpperNumericPatternCharacters" value="ABCDEFGHJKMNPQRSTUVWXYZ23456789"/>
    
            7<!-- Property to indicate numeric characters.
            pattern: D 
            original value: 0123456789 -->
            <_config:property name="com.ibm.commerce.promotion.uniquecode.generator.NumericPatternCharacters" value="23456789"/>
    
        </_config:configgrouping>
    
      </_config:extendedconfiguration>
    
    </_config:DeploymentConfiguration>
You can customize Management Center to prevent your excluded characters from displaying in Management Center. By preventing these characters from displaying, Management Center does not include these characters in the calculated Maximum number of possible unique codes, which ensures that this value is accurate.
  1. Edit the PromotionCodeUtil.lzx to include the updated character patterns:
    1. Navigate to the following directory:

      LOBTools/WebContent/WEB-INF/src/lzx/commerce/promotion/objectDefinitions/

    2. Open the PromotionCodeUtil.lzx file for editing.
    3. Add the following character patterns to the file:
      <proBasePromotionCodeUtil id="proCodeUtil"
        valuesForCharacterD="23456789"
        valuesForCharacterA="ABCDEFGHJKMNPQRSTUVWXYZ"
        valuesForCharactera="abcdefghjkmnpqrstuvwxyz"
        valuesForCharacterM="abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ"
        valuesForCharacterX="ABCDEFGHJKMNPQRSTUVWXYZ23456789"
        valuesForCharacterx="abcdefghjkmnpqrstuvwxyz23456789"
        valuesForCharacterN="abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ23456789"
      />
    4. Save and close your file.
  2. Rebuild the LOBTools OpenLaszlo Project.