getFilterByMarker
Get a filter by its marker (tree of items).
Description
This method retrieves a single content filter by its marker, localized to the requested language. It returns a Promise that resolves to an IContentFilter object containing the filter's localized info and its items tree.
Filters.getFilterByMarker(
marker*,
langCode
);
Parameters schema
Schema
marker(required): string
Filter marker
example: "main"
langCode: string
Language code. Default: "en_US"
example: "en_US"
Examples
Minimal example
const response = await Filters.getFilterByMarker('main');
Example with attributes
const response = await Filters.getFilterByMarker('main', 'en_US');
Example response
{
"localizeInfos": {
"title": "Main filter"
},
"items": [
{
"type": "page",
"marker": null,
"url": "about",
"localizeInfos": {
"title": "About"
},
"value": null,
"position": 1,
"children": []
},
{
"type": "attribute",
"marker": "color",
"url": null,
"localizeInfos": {
"title": "Color"
},
"value": null,
"position": 2,
"children": [
{
"type": "custom",
"marker": "color_red",
"url": null,
"localizeInfos": {
"title": "Red"
},
"value": "red",
"position": 1,
"children": []
}
]
}
]
}
Response schema
Schema: IContentFilter
localizeInfos: ILocalizeInfo
Localized info of the filter in the requested locale.
example: { "title": "Main filter" }
items: IContentFilterItem[]
Filter items tree (regular items + custom items in a single array).
items.type: TContentFilterItemType
Tree node type. One of: "page", "product", "admin", "attribute", "discount", "personal-discount", "bonus", "payment-method", "custom".
example: "page"
items.marker: string | null
Marker of the linked entity, or null for type=page.
example: "about"
items.url: string | null
Page URL (only for type=page; null otherwise).
example: "about"
items.localizeInfos: ILocalizeInfo
Localized info of the linked entity in the requested locale.
example: { "title": "About" }
items.value: string | null
Unified node value (e.g. discount value, attribute title); null otherwise.
example: "10"
items.position: number
Numeric position (per-level).
example: 1
items.children: IContentFilterItem[]
Nested tree nodes (regular and custom items in a single array).