Tutorial: Adding new search conditions in the advanced search of the Catalogs tool
This tutorial demonstrates how to add new search conditions to the Advanced Search dialog in the Catalogs tool.
Users can perform complex searches that contain several search conditions in the Advanced Search dialog in the Catalogs tool.
When you customize the Advanced Search dialog to include more properties of the catalog entry as search conditions, users can search more precisely. When customizing the advanced search, you add user interface widgets to the Advanced Search dialog. These widgets are used by the business user to specify their search criteria and the values for the search criteria are passed to the search service. In this tutorial, you extend the advanced search with two new conditions: warranty type and warranty term.
These extended properties were added in the catalog entry in Tutorial: Adding new fields in the Catalogs tool. IBM recommends that you deploy all of the customized code at the same time. If you are performing both tutorials and deploying to the production server, only perform the deployment step once after you complete both tutorials.
Learning objectives
- Extend the Advanced Search dialog to include extended properties as search
- Extend the controller JSP file to transfer extended search parameters
- Configure parametric search to search on custom data
- Create a new expression builder to override a default expression builder
- Add the extended properties as a column to a list view
Time required
Expect this tutorial to take about two hours to complete.
You can download the completed tutorial code for this tutorial for the reference:
- Download the completed tutorial code for WebSphere Commerce v7 and Feature Pack 1.
- Download the completed tutorial code for WebSphere Commerce v7 Feature Pack 2.
However, in order to fully attain the learning objectives, it is recommended that you perform the tutorial step by step.
Audience
This tutorial is intended for Management Center for WebSphere Commerce developers.
Prerequisites
Before beginning this tutorial ensure that you have:
- Enabled the management-center feature
- Created a category manager
- Completed the following tutorials: :
- Tutorial: Adding new properties to a WebSphere Commerce service using the data service layer
- Tutorial: Adding new fields in the Catalogs tool
Prerequisite knowledgeTo complete this tutorial you should have a basic understanding of:
- WebSphere Commerce Developer
- The Management Center for WebSphere Commerce programming model
- The OpenLaszlo programming API to extend the catAllCatalogEntriesAdvancedSearchContent class
- The Java programming language
- GetData tag configuration
- JSP pages
- HTML
- XML
- Struts configuration
Lessons in this tutorial
- Extend the Advanced Search dialog to include extended properties as search
The Advanced Search dialog in the Catalogs tool is implemented by the catAllCatalogEntriesAdvancedSearchContent class in WCDE_INSTALL\workspace\LOBTools\WebContent\WEB-INF\src\lzx\commerce\catalog\restricted\searchDefinitions\CatalogAdvancedSearchContent.lzx. catAllCatalogEntriesAdvancedSearchContent is a subclass of wcfAdvancedSearchContent.
- Extend the controller JSP file to transfer extended search parameters
Each wcfSearchDefinition has an associated wcfSearchService. This service is implemented as a controller JSP file that takes the search terms as parameters. When you add new search terms, extend the controller JSP file to support these new search terms from the extAllCatalogEntriesAdvancedSearchContent class as parameters.
- 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.
- Create a new expression builder to override a default expression builder
To override a default WebSphere Commerce expression builder, create a new expression builder with the same name in a custom get-data-config.xml.
- Add the extended properties as a column to a list view
In this step, the Catalog Search Result list view is extended to display search results with the new properties: warranty term and warranty type. Business users can then use the view to view the warranty term and warranty type in a list of objects returned by the search.
- Test the customizations
In this section we will test the customization result.
- Deploy the customized code
This section refers to deploying the customized code.
Related tasks
Ovveride a retrieve service for a Management Center object