Tutorials > Management Center > Add new search conditions in the advanced search of the Catalogs tool

< Previous | Next >


Configure parametric search to search on custom data

Before new properties can be used as search conditions in the query template, define the object path mapping so that the query can distinguish the object path as the corresponding column in the database table.

Define this mapping in a wc-component.xml file contained in the WC_EAR/xml/config/com.ibm.commerce.catalog-ext extension directory.

This file should already exist in this directory after being created in Part 1 of Tutorial: Adding new fields in the Catalogs tool.

In that previous tutorial, the warranty type and warranty term properties were added to the logical model by using UserData. To use this in the search, explicitly define the object path of UserData as UserData/UserDataField/property name.

To add mapping sections:

  1. Open WebSphere Commerce Developer.

  2. In the Enterprise Explorer view, navigate to WC > xml > config > com.ibm.commerce.catalog-ext and double-click the wc-component.xml file to open it in the default editor.

  3. Locate the _config:dataservice and add the mapping section to it. The following example shows the updated code after the mapping section is added:

    <_config:dataservice dataMediatorType="JDBC" 
                          metadataClass="com.mycompany.commerce.catalog.facade.server.metadata.MyCompanyMetaData">
     
    <_config:mapping>
       
    <_config:key name="CatalogEntry" />
       
    <_config:basetable name="CATENTRY" useAllColumns="false">
         
    <_config:associatedtable name="XWARRANTY" useAllColumns="false">
           
    <_config:columns name="WARTERM" propertyName="UserData/UserDataField/Warterm" caseSensitive="false" />
           
    <_config:columns name="WARTYPE" propertyName="UserData/UserDataField/Wartype" caseSensitive="false" />
         
    </_config:associatedtable>
       
    </_config:basetable>
     
    </_config:mapping>
    </_config:dataservice>
    

  4. Click Save. The following example is provided in the wc-component.xml file:

    <?xml version="1.0" encoding="UTF-8"?>
    <_config:DevelopmentComponentConfiguration
        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-component.xsd ">
        <_config:dataservice dataMediatorType="JDBC"
            metadataClass="com.mycompany.commerce.catalog.facade.server.metadata.MyCompanyMetaData">
            
            <_config:mapping>
                <_config:key name="CatalogEntry" />
                <_config:basetable name="CATENTRY" useAllColumns="false">
                    <_config:associatedtable name="XWARRANTY"
                        useAllColumns="false">
                        <_config:columns name="WARTERM"
                            propertyName="UserData/UserDataField/Warterm"
                            caseSensitive="false" />
                        <_config:columns name="WARTYPE"
                            propertyName="UserData/UserDataField/Wartype"
                                caseSensitive="false" />
                    </_config:associatedtable>
                </_config:basetable>
            </_config:mapping>
            
        </_config:dataservice>
    </_config:DevelopmentComponentConfiguration>
    

  5. Restart the WebSphere Commerce Test Server to load the new configuration.

< Previous | Next >


+

Search Tips   |   Advanced Search