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
}
]