Creating a properties field in Management Center

You can enable a customizable field in the properties view for a price list in the Catalog Filter and Pricing tool. You can use the extra field to display offers and discounts for certain regions to your customers.

About this task

This example shows you how to add a Region column to the properties view for a price list in the Catalog Filter and Pricing tool. Example of properties views for a price list in the Catalog Filter and Pricing tool.

Procedure

  1. Activate the FIELD1 column in the Management Center user interface, and change the name from FIELD1 to become the Region column.
    1. Modify the PriceListPrimaryObjectDefinition.def file to change the user interface to add the FIELD1, or Region column to Management Center.
    2. Go to WCDE_installdir\LOBTools\WebContent\config\commerce\price\objectDefinitions and open the PriceListObjectDefintion.def file.
    3. Find the following line of code:
      <ServiceParam name=qualifier propertyName=qualifier
      </DeleteService> 
      
    4. Add the line of code directly after: <PropertyDefinition displayName=field propertyName=x_field required=true/>. Save and close the file.
    5. Go to WCDE_installdir\LOBTools\WebContent\config\commerce\price\listViewDefinitions and open the PriceListListView.def file.
    6. Find the following code: <GridNumeric editable=true name=maximumQuantity propertyName=maximumQuantity text=$(catalogResources.maximumQuantity)/>
    7. Add the line of code directly after: <GridText editable=true name=x_field text=field visible=true width=100/>.
    The field column is now displayed on the Manage Price List tab in the Catalog Filter and Pricing tool.
  2. Modify the Management Center mapping file.
    1. Go to WCDE_installdir\LOBTools\WebContent\WEB-INF\config\com.ibm.commerce.price folder and open the wc-price-clientobjects.xml file.
    2. Find the following code: <_config:URLParameter name=storeId nounElement=/PriceListIdentifier/ExternalIdentifier/StoreIdentifier/UniqueID />.
    3. Add the line of code directly following the code from Step 2.b.: <_config:URLParameter name=x_ nounElement=/PriceEntry/UserData/UserDataField type=UserData key=false />
    4. In the same file, find the following code: <_config:URLParameter name=/storeId nounElement=PriceListIdentifier/ExternalIdentifier/StoreIdentifier/UniqueID />.
    5. Add the line of code directly following the code from Step 2.d.: <_config:URLParameter name=x_ nounElement=/PriceEntry/UserData/UserDataField type=UserData key=false />
    6. In the same file, find the following code: <_config:URLParameter name=priceListId nounElement=/PriceListIdentifier/UniqueID key=true return=true />.
    7. Add the line of code directly following the code from Step 2.f.: <_config:URLParameter name=x_ nounElement=/PriceEntry/UserData/UserDataField type=UserData key=false />
    8. Restart the test server to reflect the change in the XML file.
  3. Customize the server-side logic to display the new Region field in Management Center.
    1. Choose the price entry command that you want to modify to display the new Region field in.
    2. In the userData field, update the field value with the property name.
      For example, if you want the property to be named Region, field must be updated to region.
      
         for (Map.Entry<String, String> entrys : userDataFields
                 .entrySet()) {
             System.out.printIn(userdata  + entrys.getKey()
                           +  value   + entrys.getValue ());  
         }
      } else {
          userData = CommerceFoundationFactory.eINSTANCE
                  .createUserDataType();
      }
      userData.getUserDataField() .put(field, 123;
      
      priceEntry.setUserData (userData);
      }
           
    3. Go to WCDE_installdir\LOBTools\WebContent\WEB-INF\config\com.ibm.commerce.price folder and open the SerializePriceEntry.jspf file.
    4. Find the following code: <defaultStoreCurrency>${priceEntry.price.price/currency}</defaultStoreCurrency>
    5. Add the following code directly before the code you just found:
      <c:forEach var=userDataField items=$(priceEntry.userData.userDataField)>
            <x_${userDataField.typedKey}><wcf:cdata data=userDataField.typedValue}/></x${userDataField.typedKey}>
      </c:forEach>