Tutorial: Adding a new search option in the IBM Sales Center
Attention: This tutorial is currently under revision. The content might contain errors or inaccuracies. Subscribe to this page to be notified when an updated version is available.
In the IBM Sales Center, you can search for products by several search options, such as product ID and product name. This tutorial demonstrates how to add a new search option, called Manufacturer Part Number.
Learning objectives
After completing the steps in this tutorial, we will be able to search for a product based on the product's manufacturer's part number. The manufacturer's part number information is stored in the database, in the CATENTRY table, MFPARTNUM column.
The following is a screen capture of the Find Product dialog before this tutorial:
The following is a screen capture of the Find Product dialog after this tutorial:
You can load the completed tutorial code instead of performing each step in the tutorial.
Time required
Expect this tutorial to take 2 hours to complete.
Audience
This tutorial is intended for WebSphere Commerce developers who will be responsible for customizing the IBM Sales Center.
Prerequisites
To complete this tutorial you should be familiar with the following terms and concepts:
- Eclipse plug-ins
- the Java programming language
- Rational Application Developer
- relational databases
Before beginning this tutorial ensure you have:
- Installed the development environment for both IBM Sales Center and WebSphere Commerce
- Published a starter store
Lessons in this tutorial
- Determine the id of the user interface widget
In this step, we will determine which user interface element of the IBM Sales Center client to extend and gather information about that extension point, such as its ID.
- Examine the Find Product dialog definition
In this step you examine the XML file that defines the Find Product dialog and determine what changes you require to add a new search option.
- Create a new plug-in
The IBM Sales Center consists of a set of eclipse plug-ins. In this step, you create a new plug-in to hold the custom code. By isolating the code in its own plug-in, we will be able to find the code and ensure that the customizations will not be overwritten by any fixpacks or migration to future versions.
- Create a properties file
The properties file is a resource bundle that contains translatable text that displays in the user interface. In this step, we will create a properties file that contains text for the new search option, and add an entry to myNewExtensionsPlugin to point to the new properties file.
- Create a set of control widget elements
As you determined in a previous step, to add a new search option requires a new set of three control widget elements: one parent and two children.
- Create a gridCompositeDefinition
In the previous step, you created three control widgets to define the new search option. In this step we will create the gridCompositeDefinition that groups the three widgets together. The composite definition is tied to the first composite control and adds the second and third controls as its children.
- Extend the stackCompositeDefinition
In the previous steps, you created three control widgets to define the new search option and a gridCompositeDefinition to group the three widgets together as a composite. In this step, we will add the new search option to the existing Select option list by adding the new control widget, MyNewSearchOption, to the existing findProductQuickStackDefinition. The referenceId tag references the default definition of the search terms: Product Identification, Short Description, and Category. The control tag will reference the new search option, label and field.
- Point to the new search option implementation
In the previous step, you created a customized version of the Search option list. In this step, we will create a file that indicates that the implementation should be used instead of the default.
- Write code to search for the new search option
This section refers to the code needed for searching for the new search option.
- Add the manufacturer part number data to the search result
In this step we will extend the populateSearchResult() method to contain the manufacturer's part number as part of its search result data. Using the UserData field, we will add a field called manufacturerPartNumber give it a value of the manufacturer part number in the catalog entry. The UserData field name and value is then added to the reply BOD (Business Object Document) that is sent back to the IBM Sales Center client.
- Register the new search option code
This section refers to registering the new search option code.
- Test the new search option changes
This section refers to testing the new search option changes.
- Examine the search result table definition
At this point in the tutorial, you can search for a product using the CATENTRY.MFPARTNUMBER field, but the manufacturer's part number does not display as part of the search result. For example, if you perform a wildcard search for mymfpart*, search results will return, but we will not know the actual the value of manufacturer part number. The steps in this section of the tutorial describe how to display the new search term in the search result table.
- Display the new search option in the search result table
To add a new column to the search results table, we will create a new table definition to override the default table definition that you examined in the last step.
- Point to the new table definition
In the previous step, you created a new table definition with a new column for the manufacturer part number. In this step, we will update the config.ini file to indicate that the table definition should be used instead of the default table definition.
- Test the completed tutorial and view the reply BOD
This section refers to testing the completed tutorial and view the reply BOD..
- Deploy the changes
This sections explains how to deploy the changes you made in the previous steps.