Paging and sorting product lists
The method ListProduct
returns a collection that includes an ItemCount
followed by a list of ProductItem's. The ItemCount
represents the total number of products in the result, which may not necessarily be the same as the number of products in the list. Norce Commerce uses a paging functionality, and the number of items returned is determined by the pageSize
input parameter.
Passing in the parameter pageNo
will return a specified page. The default value is 1
. If you specify a pageNo outside the range of items, an empty result is returned.
Sorting
The sort parameter in the input allows you to specify the sorting order of the results based on some built-in sort functionality. The sort parameter takes a property and optionally a suffix Asc
or Desc
.
Allowed values of sort
PopularityRank
: This value allows you to sort the results based on a popularity ranking that is maintained globally and configured for the client. You can customize the factors that are relevant to your popularity calculation and the weighting of those factors in the admin UI. See separate documentation here.
Name
: This value sorts the results alphabetically by name in the selected language.
Price
: This value sorts the results by best price or from price (if the product has variants).
SortOrder
: This value sorts the results based on a manually maintained sort order in the admin, which needs to be activated in settings.
If no sort parameter is passed in, the default sorting is by Name
.