Skip to main content

searchProduct

Quick search for page objects with limited output.

Products?.searchProduct( name?, langCode? );

Minimal example

const value = await Products.searchProduct('cup')
Schema

name(required): string
Text to search product page objects (search is based on the title field of the localizeInfos object with language consideration)
example: "laminat"

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

This method performs a quick search for product page objects based on a text query name. The search is performed on the title field of the localizeInfos object, taking the specified lang language code into consideration. It returns a Promise that resolves to an array of indexed Product objects.

Example response

[
{
"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,
"productPages": [
{
"id": 2850,
"pageId": 10,
"productId": 2957,
"positionId": 3193,
"categoryPath": "catalog"
}
],
"blocks": [
"product_block"
]
}
]
Schema

id: number
The unique identifier.
example: 12345

localizeInfos: ILocalizeInfo
The name of the products, taking into account localization.

statusIdentifier: string | null
Product page status identifiers (may be null).
example: "in_stock"

statusLocalizeInfos: any
JSON description of the item status object, taking into account the language.

attributeSetIdentifier: string | null
Set of attributes id.
example: "set_12345"

position: number
Item number (for sorting).
example: 1

templateIdentifier: string | null
User id of the linked template.
example: "template_12345"

shortDescTemplateIdentifier: string | null
User id of the linked template for a short description.
example: "short_desc_template_12345"

price: number
The value of the product page price taken from the index.
example: 150

additional: object
Additional value from the index.

sku: string | null
Product SKU (Stock Keeping Unit), may be null.
example: "SKU_12345"

isSync: boolean
Indication of page indexing.
example: true

attributeValues: AttributeType
Array of attribute values from the index, represented.
example:

[
{
"id": "color",
"value": "red"
}
]

categories: string[]
Product categories.
example:

[
1,
2,
3
]

isVisible: boolean
A sign of page visibility.
example: true

productPages: any[]
Array of product pages or a single product page object.

blocks: string[]
Array of block identifiers.

isPositionLocked: boolean
Sorting position lock indicator (optional).
example: false

relatedIds: number[]
Ids of related product pages.
example:

[
12345,
67890
]