getBlocks
Récupérer tous les objets de bloc
Blocks.getBlocks(type, langCode, offset, limit)
const value = await Blocks.getBlocks('forTextBlock')
Schéma
type:* BlockType
Valeurs disponibles : forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, forOrder, service
exemple : forTextBlock
langCode: string
Code de langue
exemple : en_US
offset: number
Paramètre pour la pagination. Par défaut 0
exemple : 0
limit: number
Paramètre pour la pagination. Par défaut 30
exemple : 30
Cette méthode retourne un tableau de tous les objets de bloc et le total.
Exemple de retour :
{
"total": 100,
"items": [
{
"id": 1,
"localizeInfos": {
"title": "Bloc"
},
"version": 0,
"position": 1,
"identifier": "block",
"type": "forTextBlock",
"templateIdentifier": null,
"isVisible": true,
"attributeValues": {}
}
]
}
Schéma
total: number
nombre total d'enregistrements trouvés
exemple : 100
id: number
identifiant de l'objet
exemple : 1764
attributeSetId: number
identifiant pour l'ensemble d'attributs utilisé
exemple : 7
localizeInfos: CommonLocalizeInfos
nom du bloc avec localisation
exemple :
{
"en_US": {
"title": "Mon bloc"
}
}
customSettings: BlockCustomSettings
paramètres personnalisés pour différents types de blocs
exemple :
{
"sliderDelay": 0,
"sliderDelayType": "",
"productQuantity": 4,
"productSortType": "By_ID",
"productSortOrder": "Descending",
"productCountElementsPerRow": 10,
"similarProductRules": [
{
"property": "Descending",
"includes": "",
"keywords": "",
"strict": ""
}
]
}
version: number
numéro de version de l'objet
exemple : 10
identifier: string
identifiant textuel pour l'enregistrement de champ
exemple : catalog
par défaut : marker
position: number
numéro de position (pour le tri)
exemple : 192
attributeValues: Record<string, string>
tableau de valeurs d'attributs de l'index (présenté comme une paire d'identifiant d'attribut personnalisé : valeur d'attribut)
exemple :
{
"en_US": {
"marker": {
"value": "",
"type": "string"
}
}
}
type: string
type de bloc
exemple : forNewsPage
templateIdentifier: string
marqueur de modèle utilisé par le bloc (peut être nul)
Enum : [ forCatalogProducts, forBasketPage, forErrorPage, forCatalogPages, forProductPreview, forProductPage, forSimilarProductBlock, forStatisticProductBlock, forProductBlock, forForm, forFormField, forNewsPage, forNewsBlock, forNewsPreview, forOneNewsPage, forUsualPage, forTextBlock, forSlider, service ]
exemple : null