Overview:
This page explains how to implement product list filtering in Norce Commerce Product Service. It covers the available filter methods, how to use them, and how to construct filter strings for advanced filtering. The goal is to help you build accessible, and robust filtering mechanisms for your storefront or application.
Filtering allows users to narrow down product lists based on specific criteria such as category, manufacturer, price, or custom attributes (parametrics). Norce Commerce provides dedicated API methods to retrieve both product lists and their corresponding filter options.
Norce Commerce Product Service offers several methods for retrieving filters, that are mirroring a ListProduct method that returns the actual products:
Method Name | Description | List Product method |
---|---|---|
ListProductFilters2 | Returns filters for a given product list. | ListProducts2 |
ListProductFiltersByCustomer | Filters for products by customer. | ListProductsByCustomer |
ListProductFiltersByIds | Filters for products by Product Ids. | ListProductsByIds |
ListProductFiltersByPricelist | Filters for products by price list. | ListProductsByPriceList |
Tip:
UseListProducts2
to get a batch of products andListProductFilters2
to get filter options for the same result set. This enables dynamic, user-driven filtering in your application.
When you call ListProductFilters2
, you receive a collection of filters that describe the available filtering options for the current product set. Each filter includes a Name
, Type
, and a list of FilterItems
. These can be used to build a user interface for filtering.
Product filtering image:
The product filtering illustration displays available filter options (such as category, manufacturer, price range, etc.) with counts indicating how many products match each filter.
The following table illustrates a typical user journey when filtering products, with corresponding API calls and results.
Table: Example Filtering Steps and Results
User Action | API Call | Result |
---|---|---|
User clicks on a navigation listing (e.g., all iPhones) | ListProducts2 (with category smartphones and manufacturer apple) | Returns the first 10 Apple phones. |
ListProductFilters2 | Returns a list of filters for the full result set. Only filters with a count > 0 are included. ![]() ![]() | |
User selects "iPhone 11" | ListProducts2 (with additional filter: parf|L6360_13239) | Returns only iPhone 11 products. |
ListProductFilters2 | Returns updated filters with new counts. All counts are updated except for the last changed filter. ![]() | |
User selects "iPhone 11 Pro" | ListProducts2 (filter: parf|L6360_13239*L6360_13240) | Returns iPhone 11 and 11 Pro products. |
ListProductFilters2 | Returns updated filters. ![]() ![]() | |
User selects "Internal Memory capacity" | ListProducts2 (filter: parf|L6360_13239L6360_13240L6361_13241) | Returns products with model "iPhone 11" or "11 Pro" and internal memory "128GB". |
ListProductFilters2 | Returns updated filters. ![]() ![]() | |
User chooses a product page | GetProductById | Returns detailed product information. See product presentation. |
Description of filter images:
Each filter image shows the available filter options and the number of products matching each option. As filters are applied, the counts update to reflect the narrowed product set.
When using ListProductFilter
, the response includes:
- Filter: Contains a
Name
(used for further filtering), aType
(descriptive name), and a list ofFilterItems
. - FilterItem: Each item has an
Id
(for further filtering), aCount
(number of matching products), and optionally aSortOrder
andUom
(unit of measurement).
Note:
If all products in the result set share a filter value (e.g., all belong to the same category), that filter is omitted from the response.
To refine product results, construct a filter string using the Name
and Id
values from the filters and pass it as a parameter to both ListProducts2
and ListProductFilters2
. This updates the product list and filter counts.
Example filter string:
To filter by category IDs 11946 and 11947:catf|11946,11947;
The table below summarizes available filter types, their descriptions, restrictions, and how to construct filter strings for further filtering.
Table: Filter Types and Usage
Type (name) | Description | Restrictions | Filter String Example |
---|---|---|---|
Category (catf ) | Filters by category ID. Products can have multiple categories. | Filtering on more than one implies a logical "or". | catf|11946,11947; |
Flag (flgf ) | Filters by flag ID. | Logical "or" for multiple flags. | flgf|42,46; |
Manufacturer (mfrf ) | Filters by manufacturer ID. | Products must have one manufacturer. Logical "or" for multiple. | mfrf|7276,7277; |
OnHand (ohf ) | Filters by stock availability (true/false). | Only one value allowed. | ohf|true; or ohf|false; |
Price (prcf ) | Filters by price range (inc/excl VAT). | Only one range allowed. | prcf|true_12.50-25.00; |
Parametric (parf ) | Filters by parametric attributes. | Logical "and" between different parametrics, "or" within same parametric. | parf|L6360_13239*M6355_3390; |
List Parametric | Filters by list value. | - | L6360_13239* |
MultipleList Parametric | Filters by multiple list value. | - | M6355_3390* |
Integer/Decimal/Date Parametric | Filters by value range. | - | V60_256-1024 |
Boolean Parametric | Filters by boolean value. | - | V123_1-1 (true), V123_0-0 (false) |
Note:
All filter parameters are returned, but Text and Html parametrics are not included as filters.