Skip to main content

getBlocks

Getting all block objects

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

const value = await Blocks.getBlocks('forTextBlock')
Schema

type:* BlockType
Available values: forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, forOrder, service
example: forTextBlock

langCode: string
Language code
example: en_US

offset: number
Parameter for pagination. Default 0
example: 0

limit: number
Parameter for pagination. Default 30
example: 30

This method return array of all blocks object and total.

Example return:

{
"total": 100,
"items": [
{
"id": 1,
"localizeInfos": {
"title": "Block"
},
"version": 0,
"position": 1,
"identifier": "block",
"type": "forTextBlock",
"templateIdentifier": null,
"isVisible": true,
"attributeValues": {}
}
]
}
Schema

total: number
total number of found records
example: 100

id: number
object identifier example: 1764

attributeSetId: number
identifier for the used attribute set
example: 7

localizeInfos: CommonLocalizeInfos
block name with localization
example:

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

customSettings: BlockCustomSettings
custom settings for different block types
example:

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

version: number
object version number
example: 10

identifier: string
textual identifier for the field record
example: catalog
default: marker

position: number
position number (for sorting)
example: 192

attributeValues: Record<string, string>
array of attribute values from the index (presented as a pair of custom attribute identifier: attribute value)
example:

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

type: string
block type
example: forNewsPage

templateIdentifier: string
template marker used by the block (can be null)
Enum: [ forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, service ]
example: null