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

getProductsByIds

الحصول على عدة منتجات بواسطة معرفاتها

Products.getProductsByIds(ids, langCode, userQuery)

const value = await Products.getProductsByIds('1, 5, 8', 'en_US')
Schema

ids:* string
معرفات صفحات المنتجات التي يجب العثور على العلاقات لها
مثال: 1,3,5,15

langCode: string
معامل رمز اللغة. الافتراضي "en_US"
مثال: en_US

userQuery: IProductsQuery
مجموعة اختيارية من معلمات الاستعلام
مثال: []

userQuery.offset: number
معامل اختياري للتصفح، الافتراضي هو 0
مثال: 0

userQuery.limit: number
معامل اختياري للتصفح، الافتراضي هو 30
مثال: 30

userQuery.sortOrder: string
ترتيب الفرز الاختياري DESC | ASC
مثال: DESC

userQuery.sortKey: string
حقل اختياري للفرز (id، title، date، price، position، status)
مثال: id

تسترجع هذه الطريقة كائنات المنتجات بناءً على معرفاتها (ids) من واجهة برمجة التطبيقات. تعيد Promise التي تحل إلى كائنات IProductsEntity للمنتج.

مثال على الإرجاع:

[
{
"id": 1764,
"localizeInfos": {
"en_US": {
"title": "Product"
}
},
"isVisible": true,
"isSync": true,
"price": 0,
"additional": {
"prices": {
"min": 0,
"max": 100
}
},
"blocks": [
null
],
"sku": "0-123",
"productPages": [
{
"id": 8997,
"pageId": 1176,
"productId": 8872
}
],
"statusLocalizeInfos": {
"en_US": {
"title": "Product"
}
},
"templateIdentifier": "my-template",
"shortDescTemplateIdentifier": "my-template-short",
"attributeValues": {
"en_US": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"attributeFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
}
},
"attributeSetIdentifier": "my-set",
"statusIdentifier": "my-status",
"position": 1
}
]
Schema

id: number
معرف الكائن
مثال: 1764

localizeInfos: Record<string, any>
وصف json لكائن بيانات الصفحة الرئيسية مع الأخذ في الاعتبار اللغة "en_US" (على سبيل المثال)
مثال:

{
"en_US": {
"title": "Catalog",
"plainContent": "Content for catalog",
"htmlContent": "<b>Content for catalog</b>",
"menuTitle": "Catalog"
}
}

isVisible: boolean
علامة رؤية الصفحة
مثال: true

isSync: boolean
مؤشر فهرسة الصفحة (true أو false)
مثال: false

price: number
قيمة سعر صفحة المنتج المأخوذة من الفهرس
مثال: 0

additional: Record<string, any>
قيمة إضافية من الفهرس
مثال:

{
"prices": {
"min": 0,
"max": 100
}
}

blocks: array
كتل المنتج
مثال:

["product_block"]

sku: string
قيمة SKU للمنتج المأخوذة من الفهرس
مثال: 1

productPages: array
كائنات ProductPageEntity المرتبطة بصفحة المنتج (اختياري)
مثال:

[
{
"id": 8997,
"pageId": 1176,
"productId": 8872
}
]

statusLocalizeInfos: CommonLocalizeInfos
وصف json لكائن حالة العنصر، مع الأخذ في الاعتبار اللغة
مثال:

{ "title": "Product" }

templateIdentifier: string
معرف مخصص للقالب المرتبط
مثال: my-template

shortDescTemplateIdentifier string
معرف مخصص للقالب المرتبط للوصف القصير
مثال: my-template-short

attributeValues: Record<string, string>
مصفوفة من قيم السمات من الفهرس (مقدمة كزوج من معرف السمة المخصص: قيمة السمة)
مثال:

{
"en_US": {
"marker": {
"value": "",
"type": "string"
}
}
}

attributeSetIdentifier: string
معرف نصي لمجموعة السمات المستخدمة
مثال: 'my-set'

statusIdentifier: string
معرف نصي لحالة المنتج
مثال: 'my-status'

position: number
رقم الموضع (لترتيب العناصر)
مثال: 1