Ana içeriğe geç

getProductById

Bir ürün nesnesini id ile al.

Açıklama

Bu yöntem, API'den tanımlayıcısına (id) dayalı olarak tek bir ürün nesnesini alır. Ürün için bir IProductsEntity nesnesine çözümlenen bir Promise döner.

Products.getProductById(

id*, langCode, isNormalized

);

Parametreler şeması

Şema

id(zorunlu): number
Ürün id'si
örnek: 12345

langCode: string
Dil kodu. Varsayılan: "en_US"
örnek: "en_US"

isNormalized: boolean
Eğer true ise, ürün nesnesi normalize edilecektir

Örnekler

Minimal örnek

const response = await Products.getProductById(1);

Özelliklerle örnek

const response = await Products.getProductById(1, 'en_US');

Örnek yanıt

{
"id": 2954,
"attributeSetIdentifier": "products",
"localizeInfos": {
"title": "Box"
},
"statusLocalizeInfos": {
"title": "Sale"
},
"isVisible": true,
"statusIdentifier": "sale",
"position": 1,
"templateIdentifier": null,
"shortDescTemplateIdentifier": "product_preview",
"price": 51,
"additional": {
"prices": {
"min": 51,
"max": 150
}
},
"sku": null,
"isSync": true,
"categories": [
"catalog"
],
"paymentStages": null,
"rating": {},
"attributeValues": {
"product-name": {
"type": "string",
"value": "product-name",
"isIcon": false,
"position": 0,
"additionalFields": {},
"isProductPreview": false
},
"price": {
"type": "integer",
"value": 51,
"isIcon": false,
"position": 1,
"additionalFields": {},
"isProductPreview": false
},
"currency_products": {
"type": "string",
"value": "usd",
"isIcon": false,
"position": 2,
"additionalFields": {},
"isProductPreview": false
},
"img": {
"type": "image",
"value": {
"size": 241636,
"filename": "files/project/product/2954/image/7e0a6a70-a23d-410f-8b6a-f8b4f7483244.png",
"contentType": "image/png",
"downloadLink": "https://your-project.oneentry.cloud/cloud-static/files/project/product/2954/image/7e0a6a70-a23d-410f-8b6a-f8b4f7483244.png"
},
"isIcon": false,
"position": 3,
"additionalFields": {},
"isProductPreview": false
}
},
"productPages": [
{
"id": 2847,
"pageId": 10,
"productId": 2954,
"positionId": 3190,
"categoryPath": "catalog"
}
],
"blocks": [
"product_block"
],
"moduleFormConfigs": [
{
"id": 12,
"formIdentifier": "review",
"moduleIdentifier": "catalog",
"isGlobal": false,
"isClosed": false,
"isModerate": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "catalog",
"isNested": true
}
],
"formDataCount": 428,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"2954": 428
},
"nestedEntityIdentifiers": [
"catalog"
],
"exceptionIds": []
}
],
"discountConfig": {}
}

Yanıt şeması

Şema: IProductsEntity

id: number
Benzersiz tanımlayıcı.
örnek: 12345

localizeInfos: ILocalizeInfo
Yerelleştirmeyi dikkate alarak ürünlerin adı.
örnek:

statusIdentifier: string | null
Ürün sayfası durum tanımlayıcıları (null olabilir).
örnek: "in_stock"

statusLocalizeInfos: ILocalizeInfo
Ürün için yerelleştirilmiş durum adı.
örnek: { "title": "İndirim" }

attributeSetIdentifier: string | null
Özellikler setinin id'si.
örnek: "set_12345"

position: number
Öğe numarası (sıralama için).
örnek: 1

price: number | null
İndeksten alınan ürün sayfası fiyatının değeri.
örnek: 150.00

additional: object
İndeksten alınan ek değer.
örnek: { prices: { min: 5 max: 150 } }

sku: string | null
Ürün SKU'su (Stok Tutma Birimi), null olabilir.
örnek: "SKU_12345"

isSync: boolean
Sayfa indeksleme göstergesi.
örnek: true

attributeValues: AttributeType
İndeksten temsil edilen özellik değerleri dizisi.
örnek:

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

categories: string[]
Ürün kategorileri.
örnek:

[
1,
2,
3
]

isVisible: boolean
Sayfa görünürlüğü göstergesi.
örnek: true

moduleFormConfigs: Array<IFormConfig>
Modül form yapılandırmaları (isteğe bağlı).

rating: IRating
Değerlendirme verileri.

isPositionLocked: boolean
Sıralama pozisyonu kilit göstergesi (isteğe bağlı).
örnek: false

relatedIds: number[]
İlgili ürün sayfalarının id'leri.
örnek:

[
12345,
67890
]

paymentStages: unknown
Ödeme aşamaları verileri (null olabilir).
örnek: null

discountConfig: Record<string, unknown>
İndirim yapılandırma nesnesi.
örnek:

templateIdentifier: string | null
Bağlı şablonun kullanıcı id'si.
örnek: "template_12345"

shortDescTemplateIdentifier: string | null
Kısa açıklama için bağlı şablonun kullanıcı id'si.
örnek: "short_desc_template_12345"

signedPrice: string
Fiyat işareti.

productPages: IProductPageRef[]
Ürünü sayfalarına bağlayan ürün sayfası referansları 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ğlı olduğu sayfanın tanımlayıcısı.
örnek: 4

productPages.productId: number
Ürünü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"

blocks: string[]
Blok tanımlayıcılarının dizisi.
örnek:

[
"block_12345",
"block_67890"
]