getSingleAttributeByMarkerSet
Getting one attribute with data from the attribute set.
Description
This method return a single attribute with data from the attribute sets. It returns a Promise that resolves to an IAttributesSetsEntity object.
AttributesSets.getSingleAttributeByMarkerSet(
setMarker*,
attributeMarker*,
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 response = await AttributesSets.getSingleAttributeByMarkerSet('list1', 'list1');
Example with langCode attribute
const response = await AttributesSets.getSingleAttributeByMarkerSet('list1', 'list1', 'en_US');
Example response
{
"type": "string",
"value": {},
"marker": "admin-text",
"position": 1,
"listTitles": [],
"validators": {},
"initialValue": null,
"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
}
]
listTitles.title: string
The title or name associated with the list item.
example: "Item Name"
listTitles.value: number | string
The value of the list item, which can be either a number or a string depending on the context.
example: 42
listTitles.position: string | number | null
The position of the list item, which can be represented as a string, number, or null if not applicable.
example: 1
listTitles.extended: object
An object containing additional properties or metadata related to the list item. This could include any extra details that extend the basic information.
listTitles.extended.value: string | null
The extended value, which can be a string or null.
example: "extra_value"
listTitles.extended.type: string | null
The type of the extended value, which can be a string or null.
example: "color"
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).