getRootPages
الحصول على جميع الصفحات من المستوى الأعلى (parentId = null).
الوصف
يجلب الصفحات من المستوى الأعلى ويُعيد مصفوفة من كائنات IPagesEntity، أو [] إذا لم توجد.
.getRootPages(
);
مخطط المعلمات
المخطط
langCode: string
رمز اللغة. الافتراضي: langCode المُمرَّر إلى defineOneEntry ("en_US" إذا لم يُمرَّر).
مثال: "en_US"
أمثلة
مثال بسيط
const response = await Pages.getRootPages();
مثال مع langCode
const response = await Pages.getRootPages('en_US');
مثال على الاستجابة
[
{
"id": 8,
"config": {},
"depth": 0,
"parentId": null,
"pageUrl": "blog",
"attributeSetIdentifier": "page",
"localizeInfos": {
"title": "Blog",
"htmlContent": "",
"plainContent": "",
"menuTitle": "Blog"
},
"isVisible": true,
"products": 0,
"childrenCount": 2,
"type": "common_page",
"position": 3,
"templateIdentifier": "template",
"isSync": true,
"categoryPath": "blog",
"rating": {},
"attributeValues": {
"text": {
"type": "string",
"value": "some text",
"isIcon": false,
"position": 0,
"additionalFields": {},
"isProductPreview": false
},
"number": {
"type": "integer",
"value": 5,
"isIcon": false,
"position": 1,
"additionalFields": {},
"isProductPreview": false
},
"real": {
"type": "real",
"value": 10,
"isIcon": false,
"position": 2,
"additionalFields": {},
"isProductPreview": false
},
"float": {
"type": "float",
"value": 12,
"isIcon": false,
"position": 3,
"additionalFields": {},
"isProductPreview": false
}
},
"moduleFormConfigs": [
{
"id": 9,
"formIdentifier": "full_form",
"moduleIdentifier": "content",
"isGlobal": false,
"isClosed": false,
"isModerate": true,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "blog",
"isNested": false
}
],
"formDataCount": 6281,
"ratingCalculation": "average",
"allowHalfRatings": null,
"showAggregatedRating": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 6281
},
"nestedEntityIdentifiers": [],
"exceptionIds": []
},
{
"id": 3,
"formIdentifier": "file_form",
"moduleIdentifier": "content",
"isGlobal": false,
"isClosed": false,
"isModerate": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "blog",
"isNested": false
}
],
"formDataCount": 691,
"ratingCalculation": "average",
"allowHalfRatings": null,
"showAggregatedRating": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 691
},
"nestedEntityIdentifiers": [],
"exceptionIds": []
},
{
"id": 2,
"formIdentifier": "test-form",
"moduleIdentifier": "content",
"isGlobal": false,
"isClosed": false,
"isModerate": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "blog",
"isNested": false
}
],
"formDataCount": 909,
"ratingCalculation": "average",
"allowHalfRatings": null,
"showAggregatedRating": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 909
},
"nestedEntityIdentifiers": [],
"exceptionIds": []
}
],
"template": {
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
},
{
"id": 10,
"config": {},
"depth": 0,
"parentId": null,
"pageUrl": "catalog",
"attributeSetIdentifier": "page",
"localizeInfos": {
"title": "Catalog",
"htmlContent": "",
"plainContent": "",
"menuTitle": "Catalog"
},
"isVisible": true,
"products": 6,
"childrenCount": 0,
"type": "catalog_page",
"position": 2,
"templateIdentifier": "template",
"isSync": true,
"categoryPath": "catalog",
"rating": {},
"attributeValues": {
"text": {
"type": "string",
"value": "catalog text",
"isIcon": false,
"position": 0,
"additionalFields": {},
"isProductPreview": false
},
"number": {
"type": "integer",
"value": 10,
"isIcon": false,
"position": 1,
"additionalFields": {},
"isProductPreview": false
},
"real": {
"type": "real",
"value": 5,
"isIcon": false,
"position": 2,
"additionalFields": {},
"isProductPreview": false
},
"float": {
"type": "float",
"value": 15,
"isIcon": false,
"position": 3,
"additionalFields": {},
"isProductPreview": false
}
},
"moduleFormConfigs": [],
"template": {
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
},
{
"id": 50,
"config": {},
"depth": 0,
"parentId": null,
"pageUrl": "test",
"attributeSetIdentifier": null,
"localizeInfos": {
"title": "Test",
"htmlContent": "",
"plainContent": "",
"menuTitle": "Test"
},
"isVisible": true,
"products": 0,
"childrenCount": 0,
"type": "common_page",
"position": 1,
"templateIdentifier": null,
"isSync": false,
"categoryPath": "test",
"rating": {},
"attributeValues": {},
"moduleFormConfigs": []
}
]
مخطط الاستجابة
المخطط: IPagesEntity[]
id: number
معرّف الكائن.
مثال: 8
parentId: number | null
معرّف الصفحة الأصل؛ null للصفحة في المستوى الأعلى.
مثال: 10
pageUrl: string
رابط الصفحة.
مثال: "blog"
depth: number
مستوى تداخل الصفحة: 0 للصفحة في المستوى الأعلى، و1 لصفحاتها الفرعية، وهكذا.
مثال: 10
localizeInfos: ILocalizeInfo
محتوى الصفحة المترجم: title وmenuTitle وhtmlContent وplainContent.
مثال:
{
"title": "Blog",
"menuTitle": "Blog",
"htmlContent": "",
"plainContent": ""
}
isVisible: boolean
هل الصفحة ظاهرة.
مثال: true
type: PageType
نوع الصفحة.
مثال: "common_page"
templateIdentifier: string | null
علامة القالب المرتبط.
مثال: "template"
attributeSetIdentifier: string | null
علامة مجموعة السمات، أو null إذا لم تُعيَّن.
مثال: "page"
attributeValues: IAttributeValues
قيم السمات مفهرسة حسب العلامة؛ كائن فارغ عند عدم وجودها.
مثال:
{
"text": {
"type": "string",
"value": "some text",
"position": 0,
"additionalFields": {}
}
}
isSync: boolean
ما إذا كان فهرس سمات الصفحة محدّثًا للغة المطلوبة.
مثال: true
template: object
القالب المرتبط بالصفحة.
مثال:
{}
position: number
الموضع المستخدم للفرز.
مثال: 2
config: Record<string, number>
إعدادات الإخراج لصفحات الكتالوج.
مثال:
{
"rowsPerPage": 1,
"productsPerRow": 1
}
products: number
عدد المنتجات المرتبطة بالصفحة.
مثال: 0
childrenCount: number
عدد الصفحات الفرعية.
مثال: 1
blocks: IBlockEntity[] | string[]
الكتل المرتبطة بالصفحة: كائنات الكتل أو علاماتها.
مثال:
[
"product_block"
]
blocks.attributeValues: IAttributeValues
قيم السمات مفهرسة حسب العلامة؛ كائن فارغ عند عدم وجودها.
مثال:
{
"block-text": {
"type": "string",
"value": "some text",
"isIcon": false,
"position": 0,
"additionalFields": {},
"isProductPreview": false
}
}
blocks.id: number
معرّف الكتلة.
مثال: 1234
blocks.localizeInfos: ILocalizeInfo
البيانات المترجمة للكتلة.
مثال:
{
"title": "Example title"
}
blocks.version: number
رقم إصدار الكتلة.
مثال: 1
blocks.identifier: string
علامة الكتلة.
مثال: "block1"
blocks.type: BlockType
نوع الكتلة.
مثال: "product_block"
blocks.position: number
موضع الكتلة، يُستخدم للفرز.
مثال: 1
blocks.templateIdentifier: string | null
علامة القالب الذي تستخدمه الكتلة، أو null.
مثال: "template1"
blocks.isVisible: boolean
هل الكتلة ظاهرة.
مثال: true
blocks.countElementsPerRow: number
عدد العناصر في كل صف من الكتلة، إن كان معيّنًا.
مثال: 3
blocks.quantity: number
كمية العناصر في الكتلة، إذا كان ذلك مناسبًا.
مثال: 5
blocks.similarProducts: IProductsResponse
المنتجات المشابهة للكتلة، على شكل total وitems.
مثال:
{
"total": 10,
"items": []
}
blocks.products: IProductsEntity[]
المنتجات المرتبطة بالكتلة.
مثال:
[
{
"id": 1,
"localizeInfos": {
"title": "Product 1"
}
},
{
"id": 2,
"localizeInfos": {
"title": "Product 2"
}
}
]
nestedBlocks: IBlockEntity[] | string[]
الكتل المرفقة بالكيانات المتداخلة للصفحة (معاينة منتج الكتالوج، وما إلى ذلك): كائنات الكتل أو علاماتها. تُرجعها استجابات البحث الدلالي (المتجهي) / الصفحات المفهرسة، كقائمة علامات.
مثال:
[
"product_block",
"similar"
]
moduleFormConfigs: Array<IFormConfig>
إعدادات نماذج الوحدة المرتبطة بالصفحة.
rating: IRating
بيانات التقييم: القيمة المتوسطة، والإعجابات وعدمها، وطريقة الحساب.
categoryPath: string | null
مسار الفئة؛ null للصفحات المتداخلة التي ليس لها مسار فئة خاص بها.
مثال: "catalog"
distance: number
مسافة جيب التمام إلى الاستعلام. تُرجعها نقطة نهاية البحث الدلالي (المتجهي) في كل عنصر (بغض النظر عن علامة debug).
مثال: 0.12
أمثلة الاستخدام
شرح تفصيلي خطوة بخطوة في الوثائق:
- الحصول على الصفحات الجذرية: استرداد جميع الصفحات من المستوى الأعلى التي ليس لها أصل.
جربها مباشرة
شغّل هذه الطريقة في JS SDK sandbox. في زيارتك الأولى، اربط عنوان URL لمشروعك ورمز التطبيق، ثم افتح:
- الحصول على الصفحات الجذرية: استرداد جميع الصفحات من المستوى الأعلى التي ليس لها أصل.