getAllTemplates
Получение всех объектов шаблонов определенного типа.
Описание
Этот метод извлекает все объекты шаблонов, сгруппированные по типам, из API. Он возвращает Promise, который разрешается в объект GroupedTemplatesObject, содержащий массив объектов шаблонов.
Templates.getAllTemplates(
langCode);
Схема параметров
Схема
langCode: string
Код языка. По умолчанию: "en_US"
пример: "en_US"
Примеры
Минимальный пример
const response = await Templates.getAllTemplates();
Пример с атрибутами
const response = await Templates.getAllTemplates('en_US');
Пример ответа
{
"catalog_page": [
{
"id": 4,
"attributeSetIdentifier": null,
"title": "Шаблон",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 2
}
],
"product_preview": [
{
"id": 5,
"attributeSetIdentifier": null,
"title": "Предпросмотр продукта",
"generalTypeId": 5,
"identifier": "product_preview",
"version": 0,
"generalTypeName": "product_preview",
"attributeValues": {},
"position": 1
}
],
"product_block": [
{
"id": 6,
"attributeSetIdentifier": null,
"title": "шаблон блока",
"generalTypeId": 10,
"identifier": "block-template",
"version": 0,
"generalTypeName": "product_block",
"attributeValues": {},
"position": 3
}
]
}