Aller au contenu principal

getProductBlockById

Obtenir des objets ContentPageBlock par identifiant de produit

Products.getProductBlockById(id)

const value = await Products.getProductBlockById(1764)
Schéma

id:* nombre
Identifiant du produit
exemple : 1764

Cette méthode permet d'obtenir un objet de bloc de produit par identifiant de produit.

Exemple de retour :

[
{
"id": 3,
"attributeSetIdentifier": null,
"localizeInfos": {
"title": "Bloc de produit"
},
"version": 0,
"position": 1,
"identifier": "product_block",
"type": "forProductBlock",
"customSettings": {
"productConfig": {
"quantity": "1",
"countElementsPerRow": "1"
},
"similarProductRules": [],
"condition": {
"name": "cost",
"costTo": 130,
"costFrom": 0
},
"sliderDelay": null,
"sliderDelayType": null
},
"templateIdentifier": null,
"isVisible": true,
"isSync": false,
"attributeValues": {}
}
]
Schéma

id: nombre
identifiant de l'objet
exemple : 1764

attributeSetId: nombre
identifiant de 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: nombre
numéro de version de l'objet
exemple : 10

identifier: chaîne
identifiant textuel pour l'enregistrement de champ
exemple : catalog
par défaut : marker

position: nombre
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: chaîne
type de bloc
exemple : forNewsPage

templateIdentifier: chaîne
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