Skip to main content

getProductsByPageId

Search all product objects with pagination for selected category

Products.getProductsByPageId(id, body, langCode, userQuery)

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.getProductsByPageId(1764, body);
Schema

id:* number
Page id
example: 1

body: IFilterParams[]
Request body
example: []

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

userQuery: IProductsQuery
Optional set query parameters.
example:

userQuery.offset: number
Optional parameter for pagination, default is 0
example: 0

userQuery.limit: number
Optional parameter for pagination, default is 30
example: 30

userQuery.statusMarker: string
Optional identifier of the product page status
example: waiting

userQuery.conditionValue: string
Optional value that is being searched
example: 1

userQuery.conditionMarker: string
Optional identifier of the filter condition by which values are filtered
example: mth

userQuery.attributeMarker: string
Optional text identifier of the indexed attribute by which values are filtered
example: price

userQuery.sortOrder: string
Optional sorting order DESC | ASC
example: DESC

userQuery.sortKey: string
Optional field to sort by (id, title, date, price, position, status)
example: id


Schema (body)

attributeMarker: string
textual identifier of the attribute
example: price

conditionMarker: string
textual identifier of the condition
example: in

statusMarker: string
textual identifier of the product page status (default not set)
example: status_1

conditionValue: number
condition value
example: 1

pageUrls: Array<string>
unique part of the page URL (after the last "/")

title: string
example: Iphone 17 Pro
product name

isNested: boolean
search indicator for all nested categories (pageUrls)
example: false

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 return:

{
"total": 100,
"items": [
{
"id": 2,
"localizeInfos": {
"title": "Box"
},
"statusIdentifier": "sold",
"statusLocalizeInfos": {
"title": "Sold"
},
"attributeSetIdentifier": "products",
"position": 3,
"templateIdentifier": null,
"isPositionLocked": false,
"shortDescTemplateIdentifier": null,
"price": 148,
"additional": {
"prices": {
"min": 120,
"max": 150
}
},
"sku": null,
"isSync": true,
"attributeValues": {
"price": {
"type": "integer",
"value": 148,
"position": 1,
"isProductPreview": false
},
"product-name": {
"type": "string",
"value": "Box text",
"position": 0,
"isProductPreview": false
},
"currency_products": {
"type": "string",
"value": "$",
"position": 2,
"isProductPreview": false
}
},
"isVisible": true,
"isPositionLocked": false
}
]

}
Schema

total: number
total number of found records
example: 100

id: number
object identifier
example: 1764

additional: Record<string, any>
additional value from the index
example:

{
"prices": {
"min": 0,
"max": 100
}
}

statusLocalizeInfos: CommonLocalizeInfos
json description of the item status object, taking into account the language
example:

{ "title": "Product" }

localizeInfos: Record<string, any>
json description of the main page data object taking into account the language "en_US" (for example)
example:

{
"en_US": {
"title": "Catalog",
"plainContent": "Content for catalog",
"htmlContent": "<b>Content for catalog</b>",
"menuTitle": "Catalog"
}
}

isVisible: boolean
Page visibility flag
example: true

position: number
position number (for sorting)
example: 192

templateIdentifier: string
custom identifier of the associated template
example: my-template

attributeSetId: number
attribute set identifier
example: 7

blocks: array
product blocks
example: ['product_block']

isSync: boolean
indicator of page indexing (true or false)
example: false

attributeValues: Record<string, string>
Array of attribute values from the index (presented as a pair of custom attribute identifier: attribute value)
example:

{
"en_US": {
"marker": {
"value": "",
"type": "string"
}
}
}

statusId: number
status identifiers of the product page (can be null)
example: 1

sku: string
product SKU value taken from the index
example: 1

relatedIds: array
identifiers of related product pages
example:

[ 1, 2, 3 ]

price: number
price value of the product page taken from the index
example: 0

templateIdentifier string
custom identifier of the associated template
example: my-template

shortDescTemplateIdentifier string
custom identifier of the associated template for short description
example: my-template-short