getProductsByIds
Getting multiple products by its ids
Products.getProductsByIds(ids, langCode, userQuery)
const value = await Products.getProductsByIds('1, 5, 8', 'en_US')
Schema
ids:* string
Product page identifiers for which to find relationships
example: 1,3,5,15
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.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
This method retrieves a products objects based on its identifiers (ids) from the API. It returns a Promise that resolves to a IProductsEntity objects for the product.
Example return:
[
{
"id": 1764,
"localizeInfos": {
"en_US": {
"title": "Product"
}
},
"isVisible": true,
"isSync": true,
"price": 0,
"additional": {
"prices": {
"min": 0,
"max": 100
}
},
"blocks": [
null
],
"sku": "0-123",
"productPages": [
{
"id": 8997,
"pageId": 1176,
"productId": 8872
}
],
"statusLocalizeInfos": {
"en_US": {
"title": "Product"
}
},
"templateIdentifier": "my-template",
"shortDescTemplateIdentifier": "my-template-short",
"attributeValues": {
"en_US": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"attributeFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
}
},
"attributeSetIdentifier": "my-set",
"statusIdentifier": "my-status",
"position": 1
}
]
Schema
id: number
object identifier
example: 1764
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
isSync: boolean
indicator of page indexing (true or false)
example: false
price: number
price value of the product page taken from the index
example: 0
additional: Record<string, any>
additional value from the index
example:
{
"prices": {
"min": 0,
"max": 100
}
}
blocks: array
product blocks
example:
["product_block"]
sku: string
product SKU value taken from the index
example: 1
productPages: array
ProductPageEntity objects linked to the product page (optional)
example:
[
{
"id": 8997,
"pageId": 1176,
"productId": 8872
}
]
statusLocalizeInfos: CommonLocalizeInfos
json description of the item status object, taking into account the language
example:
{ "title": "Product" }
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
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"
}
}
}
attributeSetIdentifier: string
textual identifier of the attribute set used
example: 'my-set'
statusIdentifier: string
textual identifier of the product status
example: 'my-status'
position: number
position number (for sorting)
example: 1