Ana içeriğe geç

getBlockByMarker

Bir işaretçi ile tek bir blok nesnesi almak.

Açıklama

Bu yöntem, bir işaretçi ile bir blok nesnesi döndürür. Bir IBlockEntity nesnesine çözülmekte olan bir Promise döndürür.

Blocks.getBlockByMarker(

marker, langCode, offset, limit

);

Parametreler şeması

Şema

marker(zorunlu): string
Blokun işaretçisi
örnek: "product_block"

langCode: string
Dil kodu. Varsayılan: "en_US"
ö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

Örnekler

Minimal örnek

const response = await Blocks.getBlockByMarker('my-marker');

Özelliklerle örnek

const response = await Blocks.getBlockByMarker('my-marker', 'en_US', 0, 30);

Örnek yanıt

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

Yanıt şeması

Şema: IBlockEntity

attributeValues: AttributeType
Blokta kullanılan özelliklerin türü.
örnek:

{
"block-text": {
"type": "string",
"value": "bazı metin",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
}
}

id: number
Blokun benzersiz tanımlayıcısı.
örnek: 1234

localizeInfos: ILocalizeInfo
Blok için yerelleştirme bilgileri.
örnek:

{
"key": "value"
}

version: number
Blok varlığının sürümü.
örnek: 1

identifier: string
Blok için benzersiz dize tanımlayıcısı.
örnek: "block1"

type: string
Blokun türü, örneğin 'product', 'error_page' vb.
örnek: "product"

templateIdentifier: string | null
Blok tarafından kullanılan şablonun tanımlayıcısı veya geçerli değilse null.
örnek: "template1"

isVisible: boolean
Blokun görünür olup olmadığını gösterir.
örnek: true

countElementsPerRow: number
Blokta her satırda görüntülenen öğe sayısı, geçerliyse.
örnek: 3

quantity: number
Blokta bulunan öğe sayısı, geçerliyse.
örnek: 5

similarProducts: IProductsResponse
Blok ile ilişkili benzer ürünleri içeren yanıt.
örnek:

{
"total": 10,
"items": []
}

products: IProductsEntity[]
Blok ile ilişkili ürün varlıklarının dizisi.
örnek:

[
{
"id": 1,
"name": "Ürün 1"
},
{
"id": 2,
"name": "Ürün 2"
}
]