Ana içeriğe geç

getBlocks

Tüm blok nesnelerini alma

Blocks.getBlocks(type, langCode, offset, limit)

const value = await Blocks.getBlocks('forTextBlock')
Şema

type:* BlockType
Mevcut değerler: forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, forOrder, service
örnek: forTextBlock

langCode: string
Dil kodu
örnek: en_US

offset: number
Sayfalama için parametre. Varsayılan 0
örnek: 0

limit: number
Sayfalama için parametre. Varsayılan 30
örnek: 30

Bu yöntem, tüm blok nesnelerinin ve toplamın bir dizisini döndürür.

Örnek dönüş:

{
"items": [
{
"id": 3,
"localizeInfos": {
"title": "Blok"
},
"version": 0,
"position": 1,
"identifier": "block",
"type": "common_block",
"templateIdentifier": null,
"isVisible": true,
"attributeValues": {}
},
{
"id": 4,
"localizeInfos": {
"title": "test"
},
"version": 8,
"position": 2,
"identifier": "test",
"type": "common_block",
"templateIdentifier": null,
"isVisible": true,
"attributeValues": {
"block-text": {
"type": "string",
"value": "bazı metin",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
},
"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,
"timeIntervals": [
[
"2025-04-07T09:00:00.000Z",
"2025-04-07T10:00:00.000Z"
],
[
"2025-04-07T10:00:00.000Z",
"2025-04-07T11:00:00.000Z"
],
[
"2025-04-07T11:00:00.000Z",
"2025-04-07T12:00:00.000Z"
],
"..."
]
}
],
"intervalId": "c6466cd8-c55d-4583-97c5-42b684210f12"
}
],
"isIcon": false,
"position": 1,
"additionalFields": [],
"isProductPreview": false
}
}
}
],
"total": 2
}
Şema

total: number
bulunan kayıtların toplam sayısı
örnek: 100

id: number
nesne tanımlayıcısı
örnek: 1764

attributeSetId: number
kullanılan özellik setinin tanımlayıcısı
örnek: 7

localizeInfos: CommonLocalizeInfos
yerelleştirilmiş blok adı
örnek:

{
"en_US": {
"title": "Benim blokum"
}
}

customSettings: BlockCustomSettings
farklı blok türleri için özel ayarlar
örnek:

{
"sliderDelay": 0,
"sliderDelayType": "",
"productQuantity": 4,
"productSortType": "By_ID",
"productSortOrder": "Descending",
"productCountElementsPerRow": 10,
"similarProductRules": [
{
"property": "Descending",
"includes": "",
"keywords": "",
"strict": ""
}
]
}

version: number
nesne sürüm numarası
örnek: 10

identifier: string
alan kaydı için metinsel tanımlayıcı
örnek: catalog
varsayılan: marker

position: number
sıralama için pozisyon numarası
örnek: 192

attributeValues: Record<string, string>
indeksten gelen özellik değerleri dizisi (özel özellik tanımlayıcısı: özellik değeri çifti olarak sunulmuştur)
örnek:

{
"en_US": {
"marker": {
"value": "",
"type": "string"
}
}
}

type: string
blok türü
örnek: forNewsPage

templateIdentifier: string
blok tarafından kullanılan şablon işareti (null olabilir)
Enum: [ forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, service ]
örnek: null