
Adding custom sort options for product lists and search results
In the Catalog Entry List widget, you can add custom sort options to the SORT BY list for product lists that are displayed on subcategory pages and search results pages. This customization involves defining the new sort options in an extended WebSphere Commerce search configuration file and in the widget JSP files.

You can add a custom sort option, such as a Part Number option, to help shoppers find a specific product more quickly.
Part 1. Adding the custom sort option to the relevant search profiles
Before you begin
Apply interim fix JR50972. This interim fix corrects an issue in which the default REST sort profiles are removed when you add new REST sort profiles to a custom search profile.
- To familiarize yourself with search profiles, read WebSphere Commerce search configuration file (wc-search.xml) (Search EAR). Specifically, review the information for the sort property of a search profile. This part of the customization task requires you to add a sort field to the sort property for multiple search profiles in the extended version of the WebSphere Commerce search configuration file (wc-search.xml).
Procedure
Part 2: Customizing the JSP files for the Catalog Entry List widget to add the custom sort option
About this task
- Read the overview of the Catalog Entry List widget that contains the SORT BY list.
- Familiarize yourself with the storefront components of a Commerce Composer widget in Commerce Composer widget architecture.
Procedure
Part 3: Adding the custom sort option to the widget properties view in Management Center
When Management Center users create a layout that uses the Catalog Entry List widget, they can set certain display properties for the widget. The Initial sort order property controls how products are sorted in the widget on the store page before the shopper chooses a different sort option. You must add your custom sort option to the object definition for the Catalog Entry List widget if you want Management Center users to be able to select the option in the Commerce Composer tool.

Procedure
Part 4: Test the results of the customization in the storefront.
Procedure
- In a browser, go to the URL for your store.
- Do a search by entering a search term. When the search results page is displayed, in the Catalog Entry List widget, confirm that the SORT BY list displays your custom sort option and that the sort works as expected.
- Navigate to a subcategory that contains products. In the Catalog Entry List widget, confirm that the SORT BY list displays your custom sort option and that the sort works as expected.