Ana içeriğe geç

getBlockByMarker

Bir işaretçi ile tek bir blok nesnesi alma

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

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

marker:* string
Blok İşaretçisi
örnek: my-marker

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, bir işaretçi ile bir blok nesnesi döndürür.

Örnek dönüş:

{
"id": 1764,
"localizeInfos": {
"en_US": {
"title": "My block"
}
},
"customSettings": {
"sliderDelay": 0,
"sliderDelayType": "",
"productConfig": {
"quantity": 2,
"sortType": "By_ID",
"sortOrder": "DESC",
"countElementsPerRow": 10
},
"similarProductRules": [
{
"property": "Descending",
"includes": "",
"keywords": "",
"strict": ""
}
],
"condition": {
"name": "title"
}
},
"version": 10,
"identifier": "catalog",
"position": 192,
"productPageUrls": [
"23-laminat-floorwood-maxima"
],
"isVisible": true,
"attributeValues": {
"en_US": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"attributeFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
}
},
"type": "forNewsPage",
"templateIdentifier": null,
"attributeSetIdentifier": "my-attributes-sets"
}
Şema

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

localizeInfos: CommonLocalizeInfos
yerelleştirmeyi dikkate alarak blok adı
örnek:

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

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

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

version: number
nesne değişiklik versiyon numarası
örnek: 10

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

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

productPageUrls: any
URL sayfasının benzersiz parçalarının dizisi (son "/" dan sonra) - ürünlerin alınabileceği kategoriler (isteğe bağlı)
örnek:

[ "23-laminat-floorwood-maxima" ]

isVisible: boolean
blokun görünürlük (mevcudiyet) göstergesi
örnek: true

attributeValues: Record<string, string>
indeksten gelen özellik değerleri dizisi (tip, değer, özellik için ek alanlar dizisi)
örnek:

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

type: string
blok türü
örnek: forNewsPage
Enum: [ forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, forOrder, service ]

attributeSetId: number
kullanılan özellik seti için tanımlayıcı
örnek: 7

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

templateIdentifier: string
blok tarafından kullanılan şablon işaretçisi (null olabilir)
örnek: null