getPages
Lấy tất cả các đối tượng trang với thông tin sản phẩm dưới dạng một mảng.
Mô tả
Phương thức này truy xuất tất cả các trang đã tạo dưới dạng một mảng 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 IPagesEntity.
Pages.getPages(
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.getPages();
Ví dụ với các thuộc tính
const response = await Pages.getPages('en_US');
Ví dụ phản hồi
[
{
"id": 10,
"config": {},
"depth": 0,
"parentId": null,
"pageUrl": "catalog",
"attributeSetIdentifier": "page",
"total": "3",
"localizeInfos": {
"title": "Catalog",
"menuTitle": "Catalog",
"htmlContent": "",
"plainContent": ""
},
"isVisible": true,
"products": 3,
"childrenCount": "0",
"type": "catalog_page",
"position": 5,
"templateIdentifier": "template",
"isSync": true,
"categoryPath": "catalog",
"rating": {},
"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": {}
}
},
"moduleFormConfigs": [],
"template": {
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
},
{
"id": 8,
"config": {},
"depth": 0,
"parentId": null,
"pageUrl": "blog",
"attributeSetIdentifier": "page",
"total": "3",
"localizeInfos": {
"title": "Blog",
"menuTitle": "Blog",
"htmlContent": "",
"plainContent": ""
},
"isVisible": true,
"products": 0,
"childrenCount": "1",
"type": "common_page",
"position": 3,
"templateIdentifier": "template",
"isSync": true,
"categoryPath": "blog",
"rating": {},
"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": {}
}
},
"moduleFormConfigs": [
{
"id": 9,
"formIdentifier": "full_form",
"moduleIdentifier": "content",
"isGlobal": false,
"isClosed": false,
"isModerate": true,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"entityIdentifiers": [
{
"id": "blog",
"isNested": false
}
],
"formDataCount": 3902,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 3902
},
"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": 479,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 479
},
"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": 688,
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null,
"entityFormDataCount": {
"blog": 688
},
"nestedEntityIdentifiers": [],
"exceptionIds": []
}
],
"template": {
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
},
{
"id": 9,
"config": {},
"depth": 1,
"parentId": 8,
"pageUrl": "blog1",
"attributeSetIdentifier": null,
"total": "3",
"localizeInfos": {
"title": "Blog 1",
"menuTitle": "Blog 1",
"htmlContent": "",
"plainContent": ""
},
"isVisible": true,
"products": 0,
"childrenCount": "0",
"type": "common_page",
"position": 1,
"templateIdentifier": null,
"isSync": false,
"categoryPath": "blog/blog1",
"rating": {},
"attributeValues": {},
"moduleFormConfigs": []
}
]
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
Dấu hiệu của sự hiển thị 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: IAttributeValues
Bản đồ các giá trị thuộc tính được đánh chỉ mục theo dấu hiệu; đối tượng rỗng khi không có.
ví dụ:
{
"text": {
"type": "string",
"value": "some text",
"position": 0,
"additionalFields": []
}
}
isSync: boolean
Chỉ báo về việc lập chỉ mục trang.
ví dụ: true
template: object
Đối tượng mẫu.
ví dụ:
position: number
Số thứ tự mục (để sắp xếp).
ví dụ: 2
config: Record<string, number>
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: string
Số lượng trẻ em.
ví dụ: 1
blocks: IBlockEntity[] | string[]
các khối.
ví dụ:
{
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
blocks.attributeValues: IAttributeValues
Bản đồ các giá trị thuộc tính được đánh chỉ mục theo dấu hiệu; đối tượng rỗng khi không có.
ví dụ:
{
"block-text": {
"type": "string",
"value": "some text",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
}
}
blocks.id: number
Định danh duy nhất của khối.
ví dụ: 1234
blocks.localizeInfos: ILocalizeInfo
Thông tin địa phương hóa cho khối.
ví dụ:
{
"key": "value"
}
blocks.version: number
Phiên bản của thực thể khối.
ví dụ: 1
blocks.identifier: string
Định danh chuỗi duy nhất cho khối.
ví dụ: "block1"
blocks.type: BlockType
Loại của khối.
ví dụ: "product"
blocks.position: number
Vị trí của khối để sắp xếp.
ví dụ: 1
blocks.templateIdentifier: string | null
Định danh cho mẫu được sử dụng bởi khối, hoặc null nếu không áp dụng.
ví dụ: "template1"
blocks.isVisible: boolean
Chỉ ra liệu khối có hiển thị hay không.
ví dụ: true
blocks.countElementsPerRow: number
Số lượng phần tử hiển thị trên mỗi hàng trong khối, nếu có.
ví dụ: 3
blocks.quantity: number
Số lượng mục trong khối, nếu có.
ví dụ: 5
blocks.similarProducts: IProductsResponse
Phản hồi chứa các sản phẩm tương tự liên kết với khối.
ví dụ:
{
"total": 10,
"items": []
}
similarProducts.total: number
Tổng số sản phẩm được tìm thấy.
ví dụ: 100
similarProducts.items: IProductsEntity[]
Một mảng các thực thể sản phẩm.
ví dụ:
[
{
"id": 12345,
"title": "Product 1"
},
{
"id": 67890,
"title": "Product 2"
}
]
items.id: number
Định danh duy nhất.
ví dụ: 12345
items.localizeInfos: ILocalizeInfo
Tên của các sản phẩm, tính đến việc địa phương hóa.
ví dụ:
items.statusIdentifier: string | null
Định danh trạng thái trang sản phẩm (có thể là null).
ví dụ: "in_stock"
items.statusLocalizeInfos: ILocalizeInfo
Tên trạng thái đã địa phương hóa cho sản phẩm.
ví dụ: { "title": "Sale" }
items.attributeSetIdentifier: string | null
Tập hợp các id thuộc tính.
ví dụ: "set_12345"
items.position: number
Số thứ tự mục (để sắp xếp).
ví dụ: 1
items.price: number | null
Giá trị của giá trang sản phẩm lấy từ chỉ mục.
ví dụ: 150.00
items.additional: object
Giá trị bổ sung từ chỉ mục.
ví dụ: { prices: { min: 5 max: 150 } }
items.sku: string | null
SKU sản phẩm (Đơn vị giữ hàng), có thể là null.
ví dụ: "SKU_12345"
items.isSync: boolean
Chỉ báo về việc lập chỉ mục trang.
ví dụ: true
items.attributeValues: AttributeType
Mảng các giá trị thuộc tính từ chỉ mục, được biểu diễn.
ví dụ:
[
{
"id": "color",
"value": "red"
}
]
items.categories: string[]
Các danh mục sản phẩm.
ví dụ:
[
1,
2,
3
]
items.isVisible: boolean
Dấu hiệu của sự hiển thị trang.
ví dụ: true
items.moduleFormConfigs: Array<IFormConfig>
Cấu hình biểu mẫu mô-đun (tùy chọn).
items.rating: IRating
Dữ liệu đánh giá.
items.isPositionLocked: boolean
Chỉ báo khóa vị trí sắp xếp (tùy chọn).
ví dụ: false
items.relatedIds: number[]
Id của các trang sản phẩm liên quan.
ví dụ:
[
12345,
67890
]
items.paymentStages: unknown
Dữ liệu các giai đoạn thanh toán (có thể là null).
ví dụ: null
items.discountConfig: Record<string, unknown>
Đối tượng cấu hình giảm giá.
ví dụ:
items.templateIdentifier: string | null
Id người dùng của mẫu liên kết.
ví dụ: "template_12345"
items.shortDescTemplateIdentifier: string | null
Id người dùng của mẫu liên kết cho mô tả ngắn.
ví dụ: "short_desc_template_12345"
items.signedPrice: string
Dấu hiệu giá.
items.productPages: IProductPageRef[]
Mảng các tham chiếu trang sản phẩm liên kết sản phẩm với các trang của nó.
ví dụ:
[
{
"id": 16,
"pageId": 4,
"productId": 15,
"positionId": 244,
"categoryPath": "products"
}
]
productPages.id: number
Định danh duy nhất của bản ghi liên kết sản phẩm với trang.
ví dụ: 16
productPages.pageId: number
Định danh của trang mà sản phẩm được liên kết.
ví dụ: 4
productPages.productId: number
Định danh của sản phẩm.
ví dụ: 15
productPages.positionId: number
Định danh vị trí sắp xếp trong trang.
ví dụ: 244
productPages.categoryPath: string
Đường dẫn danh mục của trang mà sản phẩm thuộc về.
ví dụ: "products"
items.blocks: string[]
Mảng các định danh khối.
ví dụ:
[
"block_12345",
"block_67890"
]
blocks.products: IProductsEntity[]
Mảng các thực thể sản phẩm liên kết với khối.
ví dụ:
[
{
"id": 1,
"name": "Product 1"
},
{
"id": 2,
"name": "Product 2"
}
]
moduleFormConfigs: Array<IFormConfig>
Cấu hình biểu mẫu mô-đun liên kết với trang.
rating: IRating
Dữ liệu đánh giá.
total: string
Tổng số sản phẩm liên kết với trang.
ví dụ: "10"
categoryPath: string
Chuỗi đường dẫn danh mục.
ví dụ: "catalog"