getProductBlockById
الحصول على كتل منتج حسب معرّفه.
الوصف
يجلب الكتل المرفقة بالمنتج ذي id المحدد ويُعيد مصفوفة من كائنات IProductBlock.
.getProductBlockById(
);
مخطط المعلمات
المخطط
id(مطلوب): number
معرّف المنتج.
مثال: 12345
أمثلة
مثال بسيط
const response = await Products.getProductBlockById(2954);
مثال على الاستجابة
[
{
"id": 1,
"attributeSetIdentifier": null,
"localizeInfos": {
"title": "Product Block"
},
"version": 0,
"position": 1,
"identifier": "product_block",
"type": "product_block",
"customSettings": {
"productConfig": {
"quantity": "1",
"sortType": 0,
"sortOrder": 0,
"countElementsPerRow": "1"
},
"similarProductRules": [],
"condition": {
"name": "cost",
"costTo": 130,
"costFrom": 0
},
"sliderDelay": null,
"sliderDelayType": null
},
"templateIdentifier": null,
"isVisible": true,
"isSync": false,
"attributeValues": {}
},
{
"id": 4,
"attributeSetIdentifier": "block",
"localizeInfos": {
"title": "test"
},
"version": 31,
"position": 2,
"identifier": "test",
"type": "common_block",
"customSettings": {
"productConfig": {},
"similarProductRules": [],
"condition": {},
"sliderDelay": null,
"sliderDelayType": null
},
"templateIdentifier": null,
"isVisible": true,
"isSync": true,
"attributeValues": {
"block-text": {
"type": "string",
"value": "some text",
"position": 0,
"additionalFields": {}
},
"interval": {
"type": "timeInterval",
"value": [
{
"values": [
{
"id": "bbc82c9f-1bc4-4c86-b83c-c062016eb7cb",
"dates": [
"2025-04-14T00:00:00.000Z",
"2025-04-14T00:00:00.000Z"
],
"times": [
[
{
"hours": 9,
"minutes": 0
},
{
"hours": 10,
"minutes": 0
}
],
[
{
"hours": 10,
"minutes": 0
},
{
"hours": 11,
"minutes": 0
}
],
[
{
"hours": 11,
"minutes": 0
},
{
"hours": 12,
"minutes": 0
}
]
],
"intervals": [],
"exceptions": [],
"intervalId": "c6466cd8-c55d-4583-97c5-42b684210f12",
"inEveryWeek": true,
"inEveryMonth": true
}
],
"intervalId": "c6466cd8-c55d-4583-97c5-42b684210f12"
}
],
"position": 1,
"additionalFields": {}
}
}
},
{
"id": 2,
"attributeSetIdentifier": "block",
"localizeInfos": {
"title": "similar"
},
"version": 31,
"position": 3,
"identifier": "similar",
"type": "similar_products_block",
"customSettings": {
"productConfig": {
"countElementsPerRow": "1"
},
"similarProductRules": [
{
"id": "812ee2bb-a90f-4743-9643-663f87acedf5",
"title": "",
"pageUrls": [],
"statusMarker": "",
"conditionValue": "Blue",
"attributeMarker": "nameofproduct_3",
"conditionMarker": "in"
}
],
"condition": {},
"sliderDelay": null,
"sliderDelayType": null
},
"templateIdentifier": "block-template",
"isVisible": true,
"isSync": true,
"attributeValues": {
"block-text": {
"type": "string",
"value": "",
"position": 0,
"additionalFields": {}
},
"interval": {
"type": "timeInterval",
"value": "",
"position": 1,
"additionalFields": {}
}
}
}
]
مخطط الاستجابة
Schema: IProductBlock[]
id: number
معرّف كتلة المنتجات.
مثال: 3289
attributeSetIdentifier: string | null
علامة مجموعة السمات المستخدمة في كتلة المنتجات، أو null إذا لم توجد.
مثال: "product_block"
localizeInfos: ILocalizeInfo
البيانات المترجمة لكتلة المنتجات.
مثال:
{
"title": "Box"
}
version: number
رقم إصدار كتلة المنتجات.
مثال: 1
position: number
موضع كتلة المنتج في قائمة أو تخطيط.
مثال: 1
identifier: string
علامة كتلة المنتجات.
مثال: "product_block_12345"
type: BlockType
نوع الكتلة.
مثال: "product"
customSettings: object
إعدادات مخصصة لكتلة المنتجات: تأخير الشرائح، وإعدادات المنتجات، وقواعد المنتجات المشابهة وشروطها.
مثال:
{}
templateIdentifier: string | null
علامة القالب الذي تستخدمه كتلة المنتجات، أو null.
مثال: "template_12345"
isVisible: boolean
هل كتلة المنتجات ظاهرة.
مثال: true
isSync: boolean
هل كتلة المنتجات متزامنة.
مثال: false
attributeValues: IAttributeValues
قيم السمات مفهرسة حسب علامة السمة.
مثال:
{
"color": {
"type": "string",
"value": "red",
"isIcon": false,
"position": 0,
"additionalFields": {}
}
}