Nhảy đến nội dung

getRootPages

Lấy tất cả các đối tượng trang cấp cao nhất (parentId = null).

Mô tả

Phương thức này truy xuất tất cả các đối tượng trang cấp cao nhất từ API. Nó trả về một Promise mà khi hoàn thành sẽ trả về một mảng các đối tượng trang cấp cao nhất hoặc một mảng rỗng [] nếu không có dữ liệu.

Pages.getRootPages(langCode);

Sơ đồ tham số

Sơ đồ

langCode: string
Mã ngôn ngữ. Mặc định: "en_US"
ví dụ: "en_US"

Ví dụ

Ví dụ tối thiểu

const response = await Pages.getRootPages();

Ví dụ phản hồi

[
{
"id": 8,
"config": {},
"depth": 0,
"parentId": null,
"pageUrl": "blog",
"attributeSetIdentifier": "page",
"localizeInfos": {
"title": "Blog",
"menuTitle": "Blog",
"htmlContent": "",
"plainContent": ""
},
"position": 1,
"isVisible": true,
"products": 0,
"childrenCount": 1,
"type": "common_page",
"templateIdentifier": "template",
"isSync": true,
"attributeValues": {
"text": {
"type": "string",
"value": "some text",
"position": 0,
"additionalFields": []
},
"number": {
"type": "integer",
"value": 0,
"position": 1,
"additionalFields": []
},
"real": {
"type": "real",
"value": "",
"position": 2,
"additionalFields": []
},
"float": {
"type": "float",
"value": 0,
"position": 3,
"additionalFields": []
}
},
"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",
"menuTitle": "Catalog",
"htmlContent": "",
"plainContent": ""
},
"position": 2,
"isVisible": true,
"products": 3,
"childrenCount": 0,
"type": "catalog_page",
"templateIdentifier": "template",
"isSync": true,
"attributeValues": {
"text": {
"type": "string",
"value": "catalog text",
"position": 0,
"additionalFields": []
},
"number": {
"type": "integer",
"value": 0,
"position": 1,
"additionalFields": []
},
"real": {
"type": "real",
"value": "",
"position": 2,
"additionalFields": []
},
"float": {
"type": "float",
"value": 0,
"position": 3,
"additionalFields": []
}
},
"template": {
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
}
]

Sơ đồ phản hồi

Sơ đồ: IPagesEntity[]

id: number
Định danh của đối tượng.
ví dụ: 8

parentId: number | null
Id của trang cha, nếu nó chứa null, thì đó là trang cấp cao nhất.
ví dụ: 10

pageUrl: string
Url trang duy nhất.
ví dụ: "blog"

depth: number
Độ sâu lồng ghép của trang so với parentId.
ví dụ: 10

localizeInfos: ILocalizeInfo
Tên của trang, tính đến việc địa phương hóa.
ví dụ:

{
"title": "Blog",
"menuTitle": "Blog",
"htmlContent": "",
"plainContent": ""
}

isVisible: boolean
Một dấu hiệu về tính khả thi của trang.
ví dụ: true

type: Types
Loại trang.
ví dụ:

"common_page"

templateIdentifier: string | null
Id người dùng của mẫu liên kết.
ví dụ: "template"

attributeSetIdentifier: string | null
Tập hợp các id thuộc tính.
ví dụ: "page"

attributeValues: AttributeType
Mảng các giá trị thuộc tính từ chỉ mục (được biểu diễn dưới dạng cặp id thuộc tính người dùng: giá trị thuộc tính).
ví dụ:

{
"text": {
"type": "string",
"value": "some text",
"position": 0,
"additionalFields": []
}
}

isSync: boolean
Chỉ định việc lập chỉ mục trang.
ví dụ: true

template: any
Đối tượng mẫu.

position: number
Số thứ tự mục (để sắp xếp).
ví dụ: 2

config: any
Cài đặt đầu ra cho các trang danh mục.
ví dụ:

{
"rowsPerPage": 1,
"productsPerRow": 1
}

products: number
Số lượng sản phẩm liên kết với trang.
ví dụ: 0

childrenCount: number
Số lượng trẻ em.
ví dụ: 1