انتقل إلى المحتوى الرئيسي

getAttributes

الحصول على جميع مجموعات السمات وعددها الإجمالي.

الوصف​

يُعيد IAttributesSetsResponse: مجموعات السمات مع عددها الإجمالي، الذي يمكنك استخدامه للترقيم. قد يحتفظ متجر إلكتروني مثلًا بمجموعة سمات للملابس (المقاس، اللون، الخامة) وأخرى للإلكترونيات.

لا تتضمن مجموعة السمات قيم السمات؛ فهذه موجودة في كيانات محددة مثل الصفحات والمنتجات. الاستثناء الوحيد هو نوع السمة timeInterval، الذي يمكن أن يحمل قيمًا عند تحديد المربع المقابل في لوحة الإدارة (يفتح في علامة تبويب جديدة).

.getAttributes(

, , , ,

);

مخطط المعلمات​

المخطط

langCode: string
رمز اللغة. الافتراضي: langCode المُمرَّر إلى defineOneEntry ("en_US" إذا لم يُمرَّر).
مثال: "en_US"

offset: number
عدد السجلات المراد تخطيها. الافتراضي: 0. يجب ألا يتجاوز offset + limit القيمة 200؛ وتُرفض النافذة الأكبر بالخطأ 400.
مثال: 0

limit: number
الحد الأقصى لعدد السجلات المراد إرجاعها. الافتراضي: 30.
مثال: 30

typeId: number
معرّف نوع مجموعة السمات للتصفية. الافتراضي: null.

sortBy: string
حقل الفرز: id أو position. الافتراضي: "id".
مثال: "id"

حد السجلات. إذا كانت صلاحية مجموعة المستخدمين لهذه الطريقة تسمح بالقراءة المقيدة فقط، تُرجع واجهة API عددًا من السجلات لا يتجاوز العدد المحدد في إعدادات المشروع (10 افتراضيًا)، أيًّا كانت قيمة limit التي تمررها. مع صلاحية القراءة الكاملة يعمل limit كالمعتاد. راجع Module permissions (يفتح في علامة تبويب جديدة).
ما دام هذا الحد ساريًا، تتجاهل واجهة API حاليًا offset: يُعيد كل طلب السجلات الأولى مجددًا.

أمثلة​

مثال بسيط​

const response = await AttributesSets.getAttributes();

مثال مع جميع المعلمات​

const response = await AttributesSets.getAttributes('en_US', 0, 30, null, 'id');

مثال على الاستجابة​

{
"total": 21,
"items": [
{
"id": 38,
"createdDate": "2026-06-09T06:06:13.667Z",
"updatedDate": "2026-06-09T06:12:00.790Z",
"version": 0,
"identifier": "subscription",
"title": "Subscription",
"schema": {
"price": {
"id": 2,
"type": "integer",
"isPrice": true,
"original": true,
"isVisible": true,
"splitUnit": "percent",
"identifier": "price",
"isCurrency": false,
"splitPrice": false,
"initialValue": null,
"localizeInfos": {
"title": "price"
},
"value": null
},
"currency_products": {
"id": 4,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"splitUnit": false,
"identifier": "currency_products",
"isCurrency": true,
"splitPrice": false,
"validators": {
"defaultValueValidator": {
"customErrorText": "Custom error",
"fieldDefaultValue": "usd",
"fieldDefaultValue2": ""
}
},
"initialValue": null,
"localizeInfos": {
"title": "Currency"
}
}
},
"isVisible": true,
"type": {
"id": 5,
"type": "forProducts"
},
"position": 1
},
{
"id": 33,
"createdDate": "2026-04-22T16:28:05.346Z",
"updatedDate": "2026-04-23T10:57:26.245Z",
"version": 1,
"identifier": "percent_split",
"title": "Percent split",
"schema": {
"s0": {
"id": 1,
"type": "float",
"isPrice": true,
"original": true,
"isVisible": true,
"splitUnit": "percent",
"identifier": "s0",
"splitParts": [
2,
3
],
"splitPrice": true,
"localizeInfos": {
"title": "s0"
},
"value": null
},
"s1": {
"id": 2,
"type": "float",
"isPrice": false,
"original": true,
"isVisible": true,
"splitUnit": false,
"identifier": "s1",
"splitParts": false,
"splitPrice": false,
"localizeInfos": {
"title": "s1"
},
"value": null
},
"s2": {
"id": 3,
"type": "float",
"isPrice": false,
"original": true,
"isVisible": true,
"splitUnit": false,
"identifier": "s2",
"splitParts": false,
"localizeInfos": {
"title": "s2"
},
"value": null
},
"currency": {
"id": 4,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"splitUnit": false,
"identifier": "currency",
"isCurrency": true,
"validators": {
"defaultValueValidator": {
"fieldDefaultValue": "usd",
"fieldDefaultValue2": ""
}
},
"localizeInfos": {
"title": "currency"
}
}
},
"isVisible": true,
"type": {
"id": 5,
"type": "forProducts"
},
"position": 2
},
{
"id": 31,
"createdDate": "2026-03-14T14:53:28.721Z",
"updatedDate": "2026-03-14T14:53:52.760Z",
"version": 0,
"identifier": "discounts",
"title": "Discounts",
"schema": {
"example_discount": {
"id": 1,
"type": "string",
"original": true,
"isVisible": true,
"identifier": "example_discount",
"localizeInfos": {
"title": "example_discount"
}
}
},
"isVisible": true,
"type": {
"id": 11,
"type": "forDiscounts"
},
"position": 3
}
]
}

مخطط الاستجابة​

المخطط: IAttributesSetsResponse

total: number
العدد الإجمالي لمجموعات السمات.
مثال: 100

items: IAttributeSetsEntity[]
مجموعات السمات في هذه الاستجابة.
مثال:

[
{
"id": 1,
"identifier": "set1"
},
{
"id": 2,
"identifier": "set2"
}
]

items.id: number
معرّف مجموعة السمات.
مثال: 123

items.createdDate: string
تاريخ إنشاء مجموعة السمات.
مثال: "2023-10-01T12:00:00Z"

items.updatedDate: string
تاريخ آخر تحديث لمجموعة السمات.
مثال: "2023-10-01T12:00:00Z"

items.version: number
رقم إصدار مجموعة السمات؛ يتغير مع كل تحديث.
مثال: 1

items.identifier: string
علامة مجموعة السمات.
مثال: "attributeSet1"

items.title: string
اسم مجموعة السمات.
مثال: "سمات المنتج"

items.schema: Record<string, IAttributeSchemaItem>
حقول المخطط مفاتيحها بواسطة العلامة.
مثال:

{
"attribute1": {
"id": 1,
"type": "string",
"isPrice": false,
"original": true,
"identifier": "string",
"localizeInfos": {
"en_US": {
"title": "String"
}
}
}
}

items.isVisible: boolean
هل مجموعة السمات ظاهرة.
مثال: true

items.type: string
نوع مجموعة السمات.
example: "product"

items.position: number
فهرس المجموعة في الاستجابة بدءًا من 1 (1 لمجموعة واحدة).
مثال: 1