Skip to content
Last updated

Filtering Product Lists in Norce Commerce Product Service

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.

Introduction to Product List Filtering

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.

Key Filtering Methods

Norce Commerce Product Service offers several methods for retrieving filters, that are mirroring a ListProduct method that returns the actual products:

Method NameDescriptionList Product method
ListProductFilters2Returns filters for a given product list.ListProducts2
ListProductFiltersByCustomerFilters for products by customer.ListProductsByCustomer
ListProductFiltersByIdsFilters for products by Product Ids.ListProductsByIds
ListProductFiltersByPricelistFilters for products by price list.ListProductsByPriceList

Tip:
Use ListProducts2 to get a batch of products and ListProductFilters2 to get filter options for the same result set. This enables dynamic, user-driven filtering in your application.

How Filtering Works

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.

Product filtering

Example: Step-by-Step Filtering Process

The following table illustrates a typical user journey when filtering products, with corresponding API calls and results.

Table: Example Filtering Steps and Results

User ActionAPI CallResult
User clicks on a navigation listing (e.g., all iPhones)ListProducts2 (with category smartphones and manufacturer apple)Returns the first 10 Apple phones.
ListProductFilters2Returns a list of filters for the full result set. Only filters with a count > 0 are included. Filter example 1 and Filter example 2
User selects "iPhone 11"ListProducts2 (with additional filter: parf|L6360_13239)Returns only iPhone 11 products.
ListProductFilters2Returns updated filters with new counts. All counts are updated except for the last changed filter. Filter example 3
User selects "iPhone 11 Pro"ListProducts2 (filter: parf|L6360_13239*L6360_13240)Returns iPhone 11 and 11 Pro products.
ListProductFilters2Returns updated filters. Filter example 4 and Filter example 5
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".
ListProductFilters2Returns updated filters. Filter example 6 and Filter example 7
User chooses a product pageGetProductByIdReturns 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.

Understanding Filter and FilterItem Entities

When using ListProductFilter, the response includes:

  • Filter: Contains a Name (used for further filtering), a Type (descriptive name), and a list of FilterItems.
  • FilterItem: Each item has an Id (for further filtering), a Count (number of matching products), and optionally a SortOrder and Uom (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.

How to Apply Further Filtering

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;

Filter Types and Syntax

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)DescriptionRestrictionsFilter 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 ParametricFilters by list value.-L6360_13239*
MultipleList ParametricFilters by multiple list value.-M6355_3390*
Integer/Decimal/Date ParametricFilters by value range.-V60_256-1024
Boolean ParametricFilters 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.