getRootPages
الحصول على جميع كائنات الصفحات من المستوى الأعلى (parentId = null).
الوصف
تسترجع هذه الطريقة جميع كائنات الصفحات من المستوى الأعلى من واجهة برمجة التطبيقات. تعيد Promise التي تحل إلى مصفوفة من كائنات الصفحات من المستوى الأعلى IPagesEntity أو مصفوفة فارغة [] إذا لم يكن هناك بيانات.
Pages.getRootPages(langCode);
مخطط المعلمات
المخطط
langCode: string
رمز اللغة. الافتراضي: "en_US"
مثال: "en_US"
أمثلة
مثال بسيط
const response = await Pages.getRootPages();
مثال على الاستجابة
[
{
"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": 1,
"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": 4827,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 4827
},
"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": 556,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 556
},
"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": 775,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 775
},
"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": 3,
"templateIdentifier": null,
"isSync": false,
"categoryPath": "test",
"rating": {},
"attributeValues": {},
"moduleFormConfigs": []
}
]
مخطط الاستجابة
المخطط: IPagesEntity[]
id: number
معرف الكائن.
مثال: 8
parentId: number | null
معرف الصفحة الأم، إذا كان يحتوي على null، فإنه يمثل الصفحة من المستوى الأعلى.
مثال: 10
pageUrl: string
رابط الصفحة الفريد.
مثال: "blog"
depth: number
عمق تعشيش الصفحة بالنسبة إلى parentId.
مثال: 10
localizeInfos: ILocalizeInfo
اسم الصفحة، مع الأخذ في الاعتبار التوطين.
مثال:
{
"title": "Blog",
"menuTitle": "Blog",
"htmlContent": "",
"plainContent": ""
}
isVisible: boolean
علامة رؤية الصفحة.
مثال: true
type: PageType
نوع الصفحة.
مثال: "common_page"
templateIdentifier: string | null
معرف المستخدم للقالب المرتبط.
مثال: "template"
attributeSetIdentifier: string | 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[]
الكتل.
مثال:
{
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
blocks.attributeValues: IAttributeValues
خريطة لقيم السمات مفاتيحها بواسطة العلامة؛ كائن فارغ عند عدم وجودها.
مثال:
{
"block-text": {
"type": "string",
"value": "some text",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
}
}
blocks.id: number
معرف فريد للكتلة.
مثال: 1234
blocks.localizeInfos: ILocalizeInfo
معلومات التوطين للكتلة.
مثال:
{
"key": "value"
}
blocks.version: number
إصدار كائن الكتلة.
مثال: 1
blocks.identifier: string
معرف سلسلة فريد للكتلة.
مثال: "block1"
blocks.type: BlockType
نوع الكتلة.
مثال: "product"
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": 10,
"items": []
}
blocks.products: IProductsEntity[]
مصفوفة من كائنات المنتجات المرتبطة بالكتلة.
مثال:
[
{
"id": 1,
"name": "Product 1"
},
{
"id": 2,
"name": "Product 2"
}
]
moduleFormConfigs: Array<IFormConfig>
تكوينات نموذج الوحدة المرتبطة بالصفحة.
rating: IRating
بيانات التقييم.
total: string
إجمالي عدد المنتجات المرتبطة بالصفحة.
مثال: "10"
categoryPath: string | null
سلسلة مسار الفئة؛ null للصفحات المتداخلة التي ليس لديها مسار فئة خاص بها.
مثال: "catalog"
أمثلة الاستخدام
خطوة بخطوة في الوثائق:
- احصل على الصفحات الجذرية — استرجع جميع الصفحات من المستوى الأعلى بدون والد.
جربها مباشرة
قم بتشغيل هذه الطريقة بشكل تفاعلي في JS SDK sandbox — قم بتوصيل عنوان URL لمشروعك ورمز التطبيق عند الزيارة الأولى، ثم افتح:
- احصل على الصفحات الجذرية — استرجع جميع الصفحات من المستوى الأعلى بدون والد.