انتقل إلى المحتوى الرئيسي

getBlockByMarker

استرجاع كائن كتلة واحدة بواسطة علامتها

Blocks.getBlockByMarker(marker, langCode, offset, limit)

const value = await Blocks.getBlockByMarker('my-marker')
Schema

marker:* string
علامة الكتلة
مثال: my-marker

langCode: string
رمز اللغة
مثال: en_US

offset: number
معامل للتصفح. القيمة الافتراضية هي 0
مثال: 0

limit: number
معامل للتصفح. القيمة الافتراضية هي 30
مثال: 30

تُرجع هذه الطريقة كائن كتلة واحدة بناءً على العلامة.

مثال على الإرجاع:

{
"id": 3,
"localizeInfos": {
"title": "Block"
},
"version": 0,
"position": 1,
"identifier": "block",
"type": "common_block",
"templateIdentifier": null,
"isVisible": true,
"attributeValues": {}
}
Schema

id: number
معرف الكائن
مثال: 1764

localizeInfos: CommonLocalizeInfos
اسم الكتلة مع مراعاة الترجمة
مثال:

{
"en_US": {
"title": "My block"
}
}

customSettings: BlockCustomSettings
إعدادات فردية لأنواع مختلفة من الكتل
BlockCustomSettings مثال:

{
"sliderDelay": 0,
"sliderDelayType": "",
"productConfig": {
"quantity": 2,
"sortType": "By_ID",
"sortOrder": "DESC",
"countElementsPerRow": 10
},
"similarProductRules": [
{
"property": "Descending",
"includes": "",
"keywords": "",
"strict": ""
}
],
"condition": {
"name": "title"
}
}

version: number
رقم إصدار تغيير الكائن
مثال: 10

identifier: string
معرف نصي لحقل التسجيل
مثال: catalog
القيمة الافتراضية: marker

position: number
رقم الموضع (للتصنيف)
مثال: 192

productPageUrls: any
مصفوفة من الأجزاء الفريدة لصفحة URL (بعد آخر "/") - الفئات التي يمكن الحصول على المنتجات منها (اختياري)
مثال:

[ "23-laminat-floorwood-maxima" ]

isVisible: boolean
مؤشر الرؤية (التوفر) للكتلة
مثال: true

attributeValues: Record<string, string>
مصفوفة من قيم السمات من الفهرس (النوع، القيمة، مصفوفة من الحقول الإضافية للصفة)
مثال:

{
"en_US": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"attributeFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
}
}

type: string
نوع الكتلة
مثال: forNewsPage
Enum: [ forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, forOrder, service ]

attributeSetId: number
معرف مجموعة السمات المستخدمة
مثال: 7

position: number
رقم الموضع (للتصنيف)
مثال: 192

templateIdentifier: string
علامة القالب المستخدمة بواسطة الكتلة (يمكن أن تكون null)
مثال: null