Skip to main content

getSingleAttributeByMarkerSet

Getting one attribute with data from the attribute set.

Description

This method return a single attribute with data from the attribute sets.

AttributesSets.getSingleAttributeByMarkerSet( attributeMarker, setMarker, langCode );

Parameters schema

Schema

setMarker(required): string
Text identifier (marker) of the attribute set
example: "productAttributes"

attributeMarker(required): string
Text identifier (marker) of the attribute in the set
example: "color"

langCode: string
Language code. Default: "en_US"
example: "en_US"

Examples

Minimal example

const value = await AttributesSets.getSingleAttributeByMarkerSet('list1', 'list1')

Example with attributes

const value = await AttributesSets.getSingleAttributeByMarkerSet('list1', 'list1', 'en_US')

Example response

{
"type": "string",
"value": {},
"marker": "admin-text",
"position": 1,
"listTitles": [],
"validators": {},
"localizeInfos": {
"title": "Admins text"
},
"additionalFields": []
}

Response schema

Schema: IAttributesSetsEntity

type: AttributeType
Attribute type.
example: "string", "text", "integer", "etc"

value: any
Value of the attribute, which can be of any type.

marker: string
Textual identifier of the attribute (marker).
example: "color", "size", "etc"

position: number
Position number for sorting.
example: 1

listTitles: IListTitle[] | Record<string, any>
Array of values (with extended data) for list and radioButton attributes.
example:

[
{
"title": "red",
"value": 1,
"position": 1,
"extendedValue": null,
"extendedValueType": null
},
{
"title": "yellow",
"value": 2,
"position": 2,
"extendedValue": null,
"extendedValueType": null
}
]

validators: Record<string, any>
Set of validators for validation.
example:

{
"requiredValidator": {
"strict": true
},
"defaultValueValidator": {
"fieldDefaultValue": 11
}
}

localizeInfos: ILocalizeInfo
The name of the template, taking into account localization.
example:

{
"title": "My attribute"
}

additionalFields: Record<string, any>
Additional fields for the attribute (optional).

settings: Record<string, any>
Additional attribute settings (optional).