getRelatedProductsById
Sayfa kimliğine göre tüm ilgili ürün nesnelerini arayın.
Açıklama
Bu yöntem, belirli bir ürün için API'den tanımlayıcısına (id) dayalı olarak tüm ilgili ürün sayfası nesnelerini alır. Ek sorgu parametreleri için isteğe bağlı bir userQuery parametresi kabul eder; bu parametreler arasında offset, limit, sortOrder ve sortKey bulunur. Bir Promise döner ve bu Promise, IProductsResponse nesnesi ile çözülür.
Products.getRelatedProductsById(
id,
langCode,
userQuery
);
Parametreler şeması
Şema
id: number
İlişki bulmak için ürün sayfası tanımlayıcısı
örnek: 12345
langCode: string
Dil kodu. Varsayılan: "en_US"
örnek: "en_US"
userQuery: IProductsQuery
İsteğe bağlı sorgu parametrelerini ayarlayın
örnek:
{
"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
Sayfalandırma için parametre. Varsayılan: 0.
userQuery.limit(required): number
Sayfalandırma için parametre. Varsayılan: 30.
userQuery.sortOrder(required): string
Sıralama düzeni "DESC" | "ASC". Varsayılan: "DESC".
userQuery.sortKey(required): string
Sıralama için alan (varsayılan - null). Olası değerler: "id", "position", "title", "date", "price". Varsayılan: null.
userQuery.signPrice: string
Fiyat işareti. Varsayılan: null.
userQuery.templateMarker: string | null
Ürün sayfası şablon işareti, varsayılan null.
örnek: "template_12345"
userQuery.statusMarker: string | null
Ürün sayfası durum işareti, varsayılan null.
örnek: "in_stock"
userQuery.conditionValue: string | null
Aranan değer, varsayılan null.
örnek: "new"
userQuery.attributeMarker: string | null
Değerlerin filtrelendiği dizinlenmiş niteliğin metin tanımlayıcısı, varsayılan null.
örnek: "color"
userQuery.conditionMarker: string | null
Değerlerin filtrelendiği filtre koşulunun işareti, varsayılan null.
örnek: "equals"
userQuery.langCode: string
Dil kodu. Varsayılan: "en_US".
userQuery.ids: string
Virgülle ayrılmış ürün id'leri listesi — getProductsByIds tarafından kullanılır.
örnek: "1,2,3"
Varsayılan olarak, 10 nesne alabilirsiniz. Bu, modülün izin ayarlarında kayıt limitinden kaynaklanmaktadır.
Sayfalandırmanın doğru çalışması için, ihtiyaçlarınıza göre Modül izinlerini ilgili bölümde yapılandırmanız gerekir.
Örnekler
Minimal örnek
const response = await Products.getRelatedProductsById(1);
Nitelikler ile örnek
const userQuery = { "offset": 0, "limit": 30, "sortOrder": "DESC", "sortKey": "id"};
const response = await Products.getRelatedProductsById(1, 'en_US', userQuery);
Belirli ürün verilerini bulmak için koşulları kullanın:
attributeMarker: Değerlerin filtrelendiği dizinlenmiş niteliğin metin tanımlayıcısı. conditionMarker: Nitelik değerine uygulanacak koşul türü.
| İşaret | Anlamı | Örnek |
|---|---|---|
| eq | Eşit | statusId = 1 (sadece aktif) |
| neq | Eşit değil | role ≠ "Viewer" |
| in | İçerir (birinden) | role in ["Editor", "Manager"] |
| nin | İçermez | email not in ["@temp.com"] |
| exs | Vardır (değeri var) | Has lastLogin |
| nexs | Yoktur | Hiç giriş yapmadı |
conditionValue: Karşılaştırılacak değer.
Örnek yanıt
{
"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
}
}
}
]
}
Yanıt şeması
Şema: IProductsResponse
total: number
Bulunan toplam ürün sayısı.
örnek: 100
items: IProductsEntity[]
Ürün varlıklarının bir dizisi.
örnek:
[
{
"id": 12345,
"title": "Product 1"
},
{
"id": 67890,
"title": "Product 2"
}
]
items.id: number
Benzersiz tanımlayıcı.
örnek: 12345
items.localizeInfos: ILocalizeInfo
Yerelleştirmeyi dikkate alarak ürünlerin adı.
örnek:
items.statusIdentifier: string | null
Ürün sayfası durum tanımlayıcıları (null olabilir).
örnek: "in_stock"
items.statusLocalizeInfos: ILocalizeInfo
Ürün için yerelleştirilmiş durum adı.
örnek: { "title": "Sale" }
items.attributeSetIdentifier: string | null
Nitelik seti id'si.
örnek: "set_12345"
items.position: number
Sıralama için öğe numarası.
örnek: 1
items.price: number | null
İndeksten alınan ürün sayfası fiyatı değeri.
örnek: 150.00
items.additional: object
İndeksten alınan ek değer.
örnek: { prices: { min: 5 max: 150 } }
items.sku: string | null
Ürün SKU'su (Stok Tutma Birimi), null olabilir.
örnek: "SKU_12345"
items.isSync: boolean
Sayfa indeksleme durumu.
örnek: true
items.attributeValues: AttributeType
İndeksten temsil edilen nitelik değerleri dizisi.
örnek:
[
{
"id": "color",
"value": "red"
}
]
items.categories: string[]
Ürün kategorileri.
örnek:
[
1,
2,
3
]
items.isVisible: boolean
Sayfa görünürlük durumu.
örnek: true
items.moduleFormConfigs: Array<IFormConfig>
Modül form yapılandırmaları (isteğe bağlı).
items.rating: IRating
Değerlendirme verileri.
items.isPositionLocked: boolean
Sıralama pozisyonu kilit durumu (isteğe bağlı).
örnek: false
items.relatedIds: number[]
İlgili ürün sayfalarının id'leri.
örnek:
[
12345,
67890
]
items.paymentStages: unknown
Ödeme aşamaları verileri (null olabilir).
örnek: null
items.discountConfig: Record<string, unknown>
İndirim yapılandırma nesnesi.
örnek:
items.templateIdentifier: string | null
Bağlı şablonun kullanıcı id'si.
örnek: "template_12345"
items.shortDescTemplateIdentifier: string | null
Kısa açıklama için bağlı şablonun kullanıcı id'si.
örnek: "short_desc_template_12345"
items.signedPrice: string
Fiyat işareti.
items.productPages: IProductPageRef[]
Ürünü sayfalarına bağlayan ürün sayfası referanslarının dizisi.
örnek:
[
{
"id": 16,
"pageId": 4,
"productId": 15,
"positionId": 244,
"categoryPath": "products"
}
]
productPages.id: number
Ürün-sayfa bağlantı kaydının benzersiz tanımlayıcısı.
örnek: 16
productPages.pageId: number
Ürünün bağlandığı sayfanın tanımlayıcısı.
örnek: 4
productPages.productId: number
Ürün tanımlayıcısı.
örnek: 15
productPages.positionId: number
Sayfa içindeki sıralama pozisyonu tanımlayıcısı.
örnek: 244
productPages.categoryPath: string
Ürünün ait olduğu sayfanın kategori yolu.
örnek: "products"
items.blocks: string[]
Blok tanımlayıcılarının dizisi.
örnek:
[
"block_12345",
"block_67890"
]