getProductsCountByPageUrl
Get the product count of a catalog page by page URL.
Description
Counts the products on the catalog page with the given url, optionally filtered by the conditions in body, and resolves to an IProductsCount.
.getProductsCountByPageUrl(
,
);
Parameters schema
Schema
url(required): string
Page URL.
body: any[]
Filter objects with search conditions. Default: [].
example:
[
{
"attributeMarker": "price",
"conditionMarker": "in",
"statusMarker": "status_1",
"conditionValue": {},
"pageUrls": [
"23-laminat-floorwood-maxima"
],
"title": "Iphone 17 Pro"
}
]
Examples
Minimal example
const response = await Products.getProductsCountByPageUrl('catalog');
Example with filters
const response = await Products.getProductsCountByPageUrl('catalog', [
{ attributeMarker: 'price', conditionMarker: 'mth', conditionValue: 100 },
]);
Use filters to find specific products:
attributeMarker: The text identifier of the indexed attribute by which values are filtered. conditionMarker: The type of condition to apply to the attribute value.
| Marker | Meaning | Example |
|---|---|---|
| eq | Equal | color = "red" |
| neq | Not equal | category ≠ "archived" |
| in | Contains (case-insensitive substring match) | brand contains "app" |
| nin | Does not contain (case-insensitive substring match) | brand does not contain "fake" |
| mth | Greater than | price > 100 |
| lth | Less than | price < 50 |
| exs | Exists (has value) | Has description |
| nexs | Does not exist | No image |
| pat | Matches a regular-expression pattern where each * stands for exactly one character and _ for a space. With search indexing on, the pattern must match the whole value | currency matches "s" (finds "usd") |
| same | Has the same value as at least one other product. conditionValue is ignored | products that share a price |
| same_part | Has the same value as another product once the last segments are cut off. conditionValue is delimiter|count (default -|2); a value with count or fewer segments is compared whole | SKUs "ABC-1-S" and "ABC-1-M" share "ABC" |
conditionValue: The value to compare against.
Example response
{
"totalAll": 6,
"totalInCategory": 6,
"totalInCategoryWithNested": 6
}
Response schema
Schema: IProductsCount
totalAll: number
Number of matching visible products in the whole catalog, on any page.
example: 100
totalInCategory: number
Number of matching products on the catalog page itself. Always 0 for getProductsCount, which has no page.
example: 50
totalInCategoryWithNested: number
Number of matching products on the catalog page and its nested categories. Always 0 for getProductsCount, which has no page.
example: 10
Usage examples
Step-by-step walkthrough in the documentation:
- Get products count by page: get the total product count on a specific catalog page, useful for pagination.
Try it live
Run this method in the JS SDK sandbox. On your first visit, connect your Project URL and App Token, then open:
- Get products count by page: get the total product count on a specific catalog page, useful for pagination.