Skip to main content

getProductsByPageUrl

Search for all product objects with pagination for the selected category (by its URL).

Products?.getProductsByPageUrl( url?, body?, langCode?, userQuery? );

Minimal example

const body `= [
{
"attributeMarker": "price",?
"conditionMarker": "mth",?
"statusMarker": "waiting",?
"conditionValue": 1,?
"pageUrls": [?
"23-laminat-floorwood-maxima"?
],
"isNested": false,?
"title": ""?
},
{
"attributeMarker": "price",?
"conditionMarker": "lth",?
"conditionValue": 3,?
"pageUrls": [?
"23-laminat-floorwood-maxima"?
],
"isNested": false,?
"title": ""?
}
]

const value = await Products.getProductsByPageUrl('catalog', body)
Schema

url(required): string
Page url
example: "catalog"

body: IFilterParams[]
Request body. Default: []
example:

[
{
"attributeMarker": "price",
"conditionMarker": "mth",
"statusMarker": "waiting",
"conditionValue": 1,
"pageUrls": [
"23-laminat-floorwood-maxima"
],
"isNested": false,
"title": ""
},
{
"attributeMarker": "price",
"conditionMarker": "lth",
"conditionValue": 3,
"pageUrls": [
"23-laminat-floorwood-maxima"
],
"isNested": false,
"title": ""
}
]

langCode: string
Language code. Default: "en_US"
example: "en_US"

userQuery: IProductsQuery
Optional set query parameters

offset(required): number
Parameter for pagination. Default: 0.

limit(required): number
Parameter for pagination. Default: 30.

sortOrder(required): string
Sort order "DESC" | "ASC". Default: "DESC".

sortKey(required): string
Field for sorting (default - null). Possible values: "id", "position", "title", "date", "price". Default: null.

templateMarker: string | null
Product page template marker, default null.
example: "template_12345"

statusMarker: string | null
Product page status marker, default null.
example: "in_stock"

conditionValue: string | null
The value that is being searched for, default null.
example: "new"

attributeMarker: string | null
The text identifier of the indexed attribute by which values are filtered, default null.
example: "color"

conditionMarker: string | null
Marker of the filter condition by which the values are filtered, default null.
example: "equals"

This method searches for all products objects with pagination for the selected category, based on the provided query parameters (userQuery). It returns a Promise that resolves to an array of items, where each item is a object.

Example response

{
"items": [
{
"id": 2954,
"localizeInfos": {
"title": "Box"
},
"statusIdentifier": "sale",
"statusLocalizeInfos": {
"title": "Sale"
},
"attributeSetIdentifier": "products",
"position": 3,
"templateIdentifier": null,
"shortDescTemplateIdentifier": "product_preview",
"price": 50,
"additional": {
"prices": {
"min": 50,
"max": 150
}
},
"sku": null,
"isSync": true,
"attributeValues": {
"product-name": {
"type": "string",
"value": "product-name",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
},
"price": {
"type": "integer",
"value": 50,
"isIcon": false,
"position": 1,
"additionalFields": [],
"isProductPreview": false
},
"currency_products": {
"type": "string",
"value": "usd",
"isIcon": false,
"position": 2,
"additionalFields": [],
"isProductPreview": false
},
"img": {
"type": "image",
"value": [],
"isIcon": false,
"position": 3,
"additionalFields": [],
"isProductPreview": false
}
},
"categories": [
"catalog"
],
"isVisible": true,
"isPositionLocked": false
},
{
"id": 2955,
"localizeInfos": {
"title": "Product"
},
"statusIdentifier": "sale",
"statusLocalizeInfos": {
"title": "Sale"
},
"attributeSetIdentifier": null,
"position": 2,
"templateIdentifier": null,
"shortDescTemplateIdentifier": null,
"price": null,
"additional": {
"prices": {
"min": 50,
"max": 150
}
},
"sku": null,
"isSync": false,
"attributeValues": {},
"categories": [
"catalog"
],
"isVisible": true,
"isPositionLocked": false
},
{
"id": 2957,
"localizeInfos": {
"title": "Cosmo"
},
"statusIdentifier": "sale",
"statusLocalizeInfos": {
"title": "Sale"
},
"attributeSetIdentifier": "products",
"position": 1,
"templateIdentifier": null,
"shortDescTemplateIdentifier": null,
"price": 150,
"additional": {
"prices": {
"min": 50,
"max": 150
}
},
"sku": null,
"isSync": true,
"attributeValues": {
"product-name": {
"type": "string",
"value": "Cosmo",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
},
"price": {
"type": "integer",
"value": 150,
"isIcon": false,
"position": 1,
"additionalFields": [],
"isProductPreview": false
},
"currency_products": {
"type": "string",
"value": "",
"isIcon": false,
"position": 2,
"additionalFields": [],
"isProductPreview": false
},
"img": {
"type": "image",
"value": [],
"isIcon": false,
"position": 3,
"additionalFields": [],
"isProductPreview": false
}
},
"categories": [
"catalog"
],
"isVisible": true,
"isPositionLocked": false
}
],
"total": 3
}
Schema

total: number
The total number of products found.
example: 100

items: IProductsEntity[]
An array of product entities.
example:

[
{
"id": 12345,
"title": "Product 1"
},
{
"id": 67890,
"title": "Product 2"
}
]