Skip to main content
The WEBSALE | search module not only enables the classic product search, but can also be used for filtering and sorting on category pages. This way, customers can narrow down the displayed products by criteria such as color, price, or availability, and display them in a desired order. This documentation describes how the filter and sort function for categories is integrated into the shop. Two scenarios are distinguished:
  • If the search & search result page has already been integrated into the shop, many required components are already in place, and only targeted adjustments are required for the category templates.
  • If no WEBSALE search is used (e.g. because an external provider such as Findologic or FACT Finder is responsible for the search), the necessary components and scripts must be fully included for the category pages.
The following sections explain which adjustments are required for the different scenarios and which WebComponents and scripts must be used for a smooth integration.

Scenario: search & search result page already integrated

Already existing components

If the search has already been implemented in the shop, the following components are already included in all templates and do not need to be integrated again:
  • WEBSALE JavaScript library
  • JavaScript bundle (ws-search-component-<version identifier>.js)
  • Communication component (ws-search)
  • Search input field with optional suggest function (ws-search-box)
  • Search event dispatcher & forwarding of search queries (wsResultDispatcher.subscribe)

Adjustments for the category page (ws_category.htm)

For the category template ws_category.htm, only the following additional adjustments then need to be made:
  • Inclusion of the ws-search-result component
  • Template placeholder for the product box (<template id="resultItemTemplate">)
  • Filtering of the category products via ws-filter
  • Optional: include/exclude switch for individual filters via ws-filter-toggle
  • JavaScript for rendering the filters
  • Sorting of the category products via ws-sort-box
  • Pagination / paging of the category products via ws-pagination

Extension of the existing communication component

The <ws-search> component may only appear once in the template. Since it has already been included for the search & search result page, for the category page only the parameter category="" with a breadcrumb output without a separator needs to be added.

Scenario: no existing search integration

If the shop search runs via external providers such as Findologic or FACT Finder, the WEBSALE search is not integrated. In this case, for the filter and sort functions on category pages, all required components must be explicitly included for the category template (ws_category.htm). The following guide describes the necessary adjustments to correctly integrate filtering and sorting via the WEBSALE search module.

Provision of the required resources

For the search module to work on the category page, the following resources must be included:

WEBSALE JavaScript library

The WEBSALE JavaScript library provides all relevant JavaScript modules for the search module as well as other standard shop functions. There are two variants of the library:
  • ws-system-<version identifier>.js - WEBSALE JavaScript modules including the jQuery library.
  • ws-core-<version identifier>.js - WEBSALE JavaScript modules without jQuery. In this case, jQuery must be included separately.
You can find more information in the documentation for the WEBSALE JavaScript library as well as in the overview of the available versions and modules.
If the WEBSALE JavaScript library is already included for other shop functions, it does not need to be integrated again.

JavaScript bundle

WEBSALE provides the JavaScript bundle ws-search-component-<version identifier>.js. This is required for the functionality of the filter and sort components. You can include the bundle via the WEBSALE PageSpeed tool or download it directly at:
If you would like to make individual adjustments to the filter or sort logic, the JavaScript bundle can be modified.

Communication component

In addition to the JavaScript bundle, the ws-search component is required. It is provided by WEBSALE and is used for the communication between the frontend, the backend, and the integrated WebComponents. This component may only appear once per template.
You can find more details about the communication component in the detailed documentation for the ws-search component.

Inclusion of the search box component

For the filter and sort functions to be used correctly, the ws-search-box component must be included technically - even if it is not actively used for the search.
You can find more details about the component in the detailed documentation for ws-search-box.

Search event dispatcher for filter & sort

The following script ensures the correct rendering of the filter and sort functions and should be included in the <head> of the template.
Function of the script
  • Detects when new search results or filter results are available.
  • Loads the product boxes via AJAX.
  • Enables a smooth filter and sort experience.

Integration of the products

The integration for the products on the category template must be adjusted as follows:

Using the ws-search-result component

The <ws-search-result> component processes the data from the search module and displays the filtered products on the category page.
You can find details about how this component works in the detailed documentation for ws-search-result.

Template placeholder for the product box

To avoid height shifts when loading the product boxes, a <template> can be specified inside ws-search-result. This is displayed as soon as the product box is loaded. To define the template for the placeholders, result-placeholder must be specified at the slot:
You can find details about the template placeholders in the detailed documentation for template placeholders.

Template for the WEBSALE product box (incl_productbox.htm)

To reload the product box, an additional template must be created and stored in the shop’s template directory (default: translation template directory). If the name of the template differs from incl_productbox.htm, the associated JavaScript script (see Search event dispatcher & forwarding of search queries) must be adjusted accordingly.
  • ~WS-Fast_Include(Incl-ProductBoxCategory)~: This is the include area that loads the complete product box with all shop functions.
Incl-ProductBoxCategory usually comes from the file incl_fast_includes.htm, but can be named differently depending on the shop. Make sure to enter the correct include name. Inside the product box, the class wsProductBox-XX (replace XX with the product number) should be present so that these products, if already present, are not reloaded during sorting or filtering.

Filtering the products

Before filters are available in the frontend, the product data fields that can be used for filtering must be defined in the configuration of the search module. This configuration defines which filter types (e.g. checkboxes, sliders) can be used for specific fields.

Filter components

Example for the integration of the filter components:
The filter components work dynamically and are rendered based on the configuration of the search module. If the user should be able to toggle a filter between Include (eq) and Exclude (neq), the ws-filter-toggle component can additionally be included before the respective filter:
You can find more details about usage and configuration in the detailed documentation:

JavaScript for rendering the filters

As of ws-search-component-1.9.1.js, this functionality is included natively in the WebComponents: filters are automatically set from the URL parameters and the category path when the page is loaded (see Automatic filter initialization). The following script is only required for older bundle versions.
When loading the products or after filtering, the active filters are passed to the WebComponents to display the correct filter values.

Sorting the products

The sorting is controlled via the <ws-sort-box> component:
You can find more details about the component in the detailed documentation for ws-sort-box.

Pagination / paging of the products

Pagination enables users to control the result page by selecting the number of products displayed per page and navigating between pages. This is done through a combination of several components for the result display, page size, and paging function. Example for the integration of the pagination components:
You can find more details about usage and configuration in the detailed documentation: