getRelatedProductsById
Search for all related product objects by page id.
Description
This method retrieves all related product page objects for a specific product based on its identifier (id) from the API. It accepts an optional userQuery parameter for additional query parameters such as offset, limit, sortOrder, and sortKey. It returns a Promise that resolves to an object IProductsResponse.
Products.getRelatedProductsById(
id,
langCode,
userQuery
);
Parameters schema
Schema
id: number
Product page identifier for which to find relationship
example: 12345
langCode: string
Language code. Default: "en_US"
example: "en_US"
userQuery: IProductsQuery
Optional set query parameters
example:
{
"limit": 30,
"offset": 0,
"sortOrder": "DESC",
"sortKey": "id",
"signPrice": "orders",
"templateMarker": "template_12345",
"statusMarker": "in_stock",
"conditionValue": "new",
"conditionMarker": "eq",
"attributeMarker": "color"
}
userQuery.offset(required): number
Parameter for pagination. Default: 0.
userQuery.limit(required): number
Parameter for pagination. Default: 30.
userQuery.sortOrder(required): string
Sort order "DESC" | "ASC". Default: "DESC".
userQuery.sortKey(required): string
Field for sorting (default - null). Possible values: "id", "position", "title", "date", "price". Default: null.
userQuery.signPrice: string
Price sign. Default: null.
userQuery.templateMarker: string | null
Product page template marker, default null.
example: "template_12345"
userQuery.statusMarker: string | null
Product page status marker, default null.
example: "in_stock"
userQuery.conditionValue: string | null
The value that is being searched for, default null.
example: "new"
userQuery.attributeMarker: string | null
The text identifier of the indexed attribute by which values are filtered, default null.
example: "color"
userQuery.conditionMarker: string | null
Marker of the filter condition by which the values are filtered, default null.
example: "equals"
userQuery.langCode: string
Language code. Default: "en_US".
userQuery.ids: string
Comma-separated list of product ids — used by getProductsByIds.
example: "1,2,3"
By default, you can retrieve 10 objects. This is due to the record limit in the module's permissions settings.
For pagination to work correctly, you need to configure Module permissions according to your needs in the corresponding section.
Examples
Minimal example
const response = await Products.getRelatedProductsById(1);
Example with attributes
const userQuery = { "offset": 0, "limit": 30, "sortOrder": "DESC", "sortKey": "id"};
const response = await Products.getRelatedProductsById(1, 'en_US', userQuery);
Use conditions to find specific products data:
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 | statusId = 1 (active only) |
| neq | Not equal | role ≠ "Viewer" |
| in | Contains (one of) | role in ["Editor", "Manager"] |
| nin | Not contains | email not in ["@temp.com"] |
| exs | Exists (has value) | Has lastLogin |
| nexs | Does not exist | Never logged in |
conditionValue: The value to compare against.
Example response
{
"total": 15,
"items": [
{
"localizeInfos": {
"title": "Товар"
},
"paymentStages": [
{
"title": "Part A",
"marker": "part_a",
"value": 100
},
{
"title": "Part B",
"marker": "part_b",
"value": 200
}
],
"id": 1764,
"isVisible": true,
"isSync": true,
"price": 0,
"additional": {
"prices": {
"min": 0,
"max": 100
}
},
"blocks": [],
"sku": "0-123",
"productPages": [
{
"id": 8997,
"pageId": 1176,
"productId": 8872
}
],
"rating": {
"votes": 42,
"value": 4.5,
"like": 10,
"dislike": 2,
"method": "weighted"
},
"statusLocalizeInfos": {
"title": "Товар"
},
"templateIdentifier": "my-template",
"shortDescTemplateIdentifier": "my-template-short",
"attributeValues": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"additionalFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
},
"attributeSetIdentifier": "my-set",
"statusIdentifier": "my-status",
"position": 1,
"signedPrice": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"formModuleConfigs": [
{
"id": 1,
"formIdentifier": "reg",
"moduleIdentifier": "user",
"entityIdentifiers": [],
"isGlobal": true,
"isClosed": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"formDataCount": 0,
"entityFormDataCount": {},
"exceptionIds": [
"shop"
],
"nestedEntityIdentifiers": [
"avto-aksessuary",
"fm-moduliatory",
"avtomobilnye-derzhateli",
"videoregistratory-radiolokatory"
],
"ratingCalculation": "average",
"allowHalfRatings": true,
"maxRatingScale": 5,
"isAnonymous": true,
"allowRerating": true,
"isRating": true
}
],
"discountConfig": {
"discounts": [
{
"id": 5,
"identifier": "summer-sale",
"type": "DISCOUNT",
"localizeInfos": {
"title": "Summer Sale"
},
"startDate": "2026-01-01T06:32:19.736Z",
"endDate": "2026-01-28T06:32:22.632Z",
"discountValue": {
"value": 30,
"maxAmount": 0,
"discountType": "FIXED_PRICE",
"applicability": "TO_PRODUCT"
},
"exclusions": [
{
"id": 2
}
],
"position": 3,
"conditionLogic": "OR",
"gifts": [
{
"id": 3,
"localizeInfos": {
"title": "hhh222"
},
"attributeSetIdentifier": "attr-set-1",
"statusIdentifier": null,
"statusLocalizeInfos": {},
"templateIdentifier": null,
"price": 90,
"sku": null,
"attributeValues": {
"price1": {
"type": "integer",
"value": "90",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
}
},
"isVisible": true
}
],
"conditions": [
{
"conditionType": "PRODUCT",
"entityIds": [
{
"id": 4,
"isNested": false
},
{
"isNested": false
}
],
"value": null
},
{
"conditionType": "ATTRIBUTE",
"entityIds": [
{
"isNested": false
}
],
"value": {
"value": "100",
"condition": "eq"
}
}
]
}
],
"discountPrice": 90,
"settings": {
"allowStacking": true,
"maxDiscountValue": 30,
"allowGiftStacking": false
}
}
},
{
"localizeInfos": {
"title": "Товар"
},
"paymentStages": [
{
"title": "Part A",
"marker": "part_a",
"value": 100
},
{
"title": "Part B",
"marker": "part_b",
"value": 200
}
],
"id": 1764,
"isVisible": true,
"isSync": true,
"price": 0,
"additional": {
"prices": {
"min": 0,
"max": 100
}
},
"blocks": [],
"sku": "0-123",
"productPages": [
{
"id": 8997,
"pageId": 1176,
"productId": 8872
}
],
"rating": {
"votes": 42,
"value": 4.5,
"like": 10,
"dislike": 2,
"method": "weighted"
},
"statusLocalizeInfos": {
"title": "Товар"
},
"templateIdentifier": "my-template",
"shortDescTemplateIdentifier": "my-template-short",
"attributeValues": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"additionalFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
},
"attributeSetIdentifier": "my-set",
"statusIdentifier": "my-status",
"position": 1,
"signedPrice": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"formModuleConfigs": [
{
"id": 1,
"formIdentifier": "reg",
"moduleIdentifier": "user",
"entityIdentifiers": [],
"isGlobal": true,
"isClosed": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"formDataCount": 0,
"entityFormDataCount": {},
"exceptionIds": [
"shop"
],
"nestedEntityIdentifiers": [
"avto-aksessuary",
"fm-moduliatory",
"avtomobilnye-derzhateli",
"videoregistratory-radiolokatory"
],
"ratingCalculation": "average",
"allowHalfRatings": true,
"maxRatingScale": 5,
"isAnonymous": true,
"allowRerating": true,
"isRating": true
}
],
"discountConfig": {
"discounts": [
{
"id": 5,
"identifier": "summer-sale",
"type": "DISCOUNT",
"localizeInfos": {
"title": "Summer Sale"
},
"startDate": "2026-01-01T06:32:19.736Z",
"endDate": "2026-01-28T06:32:22.632Z",
"discountValue": {
"value": 30,
"maxAmount": 0,
"discountType": "FIXED_PRICE",
"applicability": "TO_PRODUCT"
},
"exclusions": [
{
"id": 2
}
],
"position": 3,
"conditionLogic": "OR",
"gifts": [
{
"id": 3,
"localizeInfos": {
"title": "hhh222"
},
"attributeSetIdentifier": "attr-set-1",
"statusIdentifier": null,
"statusLocalizeInfos": {},
"templateIdentifier": null,
"price": 90,
"sku": null,
"attributeValues": {
"price1": {
"type": "integer",
"value": "90",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
}
},
"isVisible": true
}
],
"conditions": [
{
"conditionType": "PRODUCT",
"entityIds": [
{
"id": 4,
"isNested": false
},
{
"isNested": false
}
],
"value": null
},
{
"conditionType": "ATTRIBUTE",
"entityIds": [
{
"isNested": false
}
],
"value": {
"value": "100",
"condition": "eq"
}
}
]
}
],
"discountPrice": 90,
"settings": {
"allowStacking": true,
"maxDiscountValue": 30,
"allowGiftStacking": false
}
}
}
]
}
Response schema
Schema: IProductsResponse
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"
}
]
items.id: number
The unique identifier.
example: 12345
items.localizeInfos: ILocalizeInfo
The name of the products, taking into account localization.
example:
items.statusIdentifier: string | null
Product page status identifiers (may be null).
example: "in_stock"
items.statusLocalizeInfos: ILocalizeInfo
Localized status name for the product.
example: { "title": "Sale" }
items.attributeSetIdentifier: string | null
Set of attributes id.
example: "set_12345"
items.position: number
Item number (for sorting).
example: 1
items.price: number | null
The value of the product page price taken from the index.
example: 150.00
items.additional: object
Additional value from the index.
example: { prices: { min: 5 max: 150 } }
items.sku: string | null
Product SKU (Stock Keeping Unit), may be null.
example: "SKU_12345"
items.isSync: boolean
Indication of page indexing.
example: true
items.attributeValues: AttributeType
Array of attribute values from the index, represented.
example:
[
{
"id": "color",
"value": "red"
}
]
items.categories: string[]
Product categories.
example:
[
1,
2,
3
]
items.isVisible: boolean
A sign of page visibility.
example: true
items.moduleFormConfigs: Array<IFormConfig>
Module form configurations (optional).
items.rating: IRating
Rating data.
items.isPositionLocked: boolean
Sorting position lock indicator (optional).
example: false
items.relatedIds: number[]
Ids of related product pages.
example:
[
12345,
67890
]
items.paymentStages: unknown
Payment stages data (may be null).
example: null
items.discountConfig: Record<string, unknown>
Discount configuration object.
example:
items.templateIdentifier: string | null
User id of the linked template.
example: "template_12345"
items.shortDescTemplateIdentifier: string | null
User id of the linked template for a short description.
example: "short_desc_template_12345"
items.signedPrice: string
Price sign.
items.productPages: IProductPageRef[]
Array of product page references linking the product to its pages.
example:
[
{
"id": 16,
"pageId": 4,
"productId": 15,
"positionId": 244,
"categoryPath": "products"
}
]
productPages.id: number
Unique identifier of the product-to-page link record.
example: 16
productPages.pageId: number
Identifier of the page the product is linked to.
example: 4
productPages.productId: number
Identifier of the product.
example: 15
productPages.positionId: number
Sorting position identifier within the page.
example: 244
productPages.categoryPath: string
Category path of the page the product belongs to.
example: "products"
items.blocks: string[]
Array of block identifiers.
example:
[
"block_12345",
"block_67890"
]