Nhảy đến nội dung

getProductsEmptyPage

Tìm kiếm tất cả các đối tượng sản phẩm với phân trang mà không có danh mục.

Mô tả

Phương thức này tìm kiếm các đối tượng trang sản phẩm với phân trang mà không có danh mục, dựa trên các tham số truy vấn được cung cấp (userQuery). Nó trả về một Promise mà khi hoàn thành sẽ trả về một đối tượng IProductsResponse.

Products.getProductsEmptyPage( langCode, userQuery );

Sơ đồ tham số

Sơ đồ

body: object
Thân yêu cầu. Mặc định:
ví dụ:

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

userQuery: IProductsQuery
Tham số truy vấn tùy chọn
ví dụ:

{
"limit": 30,
"offset": 0,
"sortOrder": "DESC",
"sortKey": "id",
"signPrice": "orders",
"templateMarker": "template_12345",
"statusMarker": "in_stock",
"conditionValue": "new",
"conditionMarker": "eq",
"attributeMarker": "color"
}

userQuery.offset(required): number
Tham số cho phân trang. Mặc định: 0.

userQuery.limit(required): number
Tham số cho phân trang. Mặc định: 30.

userQuery.sortOrder(required): string
Thứ tự sắp xếp "DESC" | "ASC". Mặc định: "DESC".

userQuery.sortKey(required): string
Trường để sắp xếp (mặc định - null). Các giá trị có thể: "id", "position", "title", "date", "price". Mặc định: null.

userQuery.signPrice: string
Dấu giá. Mặc định: null.

userQuery.templateMarker: string | null
Dấu hiệu mẫu trang sản phẩm, mặc định null.
ví dụ: "template_12345"

userQuery.statusMarker: string | null
Dấu hiệu trạng thái trang sản phẩm, mặc định null.
ví dụ: "in_stock"

userQuery.conditionValue: string | null
Giá trị đang được tìm kiếm, mặc định null.
ví dụ: "new"

userQuery.attributeMarker: string | null
Định danh văn bản của thuộc tính đã được lập chỉ mục mà theo đó các giá trị được lọc, mặc định null.
ví dụ: "color"

userQuery.conditionMarker: string | null
Dấu hiệu của điều kiện lọc mà theo đó các giá trị được lọc, mặc định null.
ví dụ: "equals"

userQuery.langCode: string
Mã ngôn ngữ. Mặc định: "en_US".

userQuery.ids: string
Danh sách các id sản phẩm phân cách bằng dấu phẩy — được sử dụng bởi getProductsByIds.
ví dụ: "1,2,3"

Mặc định, bạn có thể lấy 10 đối tượng. Điều này là do giới hạn bản ghi trong cài đặt quyền của module.
Để phân trang hoạt động chính xác, bạn cần cấu hình Quyền module theo nhu cầu của bạn trong phần tương ứng.

Ví dụ

Ví dụ tối thiểu

const response = await Products.getProductsEmptyPage();

Ví dụ với thuộc tính

const userQuery = {
"offset": 0,
"limit": 30,
"sortOrder": "DESC",
"sortKey": "id"
};

const response = await Products.getProductsEmptyPage('en_US', userQuery);
Sử dụng bộ lọc để tìm các sản phẩm cụ thể:

attributeMarker: Định danh văn bản của thuộc tính đã được lập chỉ mục mà theo đó các giá trị được lọc. conditionMarker: Loại điều kiện áp dụng cho giá trị thuộc tính.

Dấu hiệuÝ nghĩaVí dụ
eqBằngstatusId = 1 (chỉ hoạt động)
neqKhông bằngrole ≠ "Viewer"
inChứa (một trong số)role in ["Editor", "Manager"]
ninKhông chứaemail không trong ["@temp.com"]
exsTồn tại (có giá trị)Có lastLogin
nexsKhông tồn tạiChưa bao giờ đăng nhập

conditionValue: Giá trị để so sánh.

Ví dụ phản hồi

{
"total": 15,
"items": [
{
"localizeInfos": {
"title": "Товар"
},
"paymentStages": [
{
"title": "Part A",
"marker": "part_a",
"value": 100
},
{
"title": "Part B",
"marker": "part_b",
"value": 200
}
],
"id": 1764,
"isVisible": true,
"isSync": true,
"price": 0,
"additional": {
"prices": {
"min": 0,
"max": 100
}
},
"blocks": [],
"sku": "0-123",
"productPages": [
{
"id": 8997,
"pageId": 1176,
"productId": 8872
}
],
"rating": {
"votes": 42,
"value": 4.5,
"like": 10,
"dislike": 2,
"method": "weighted"
},
"statusLocalizeInfos": {
"title": "Товар"
},
"templateIdentifier": "my-template",
"shortDescTemplateIdentifier": "my-template-short",
"attributeValues": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"additionalFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
},
"attributeSetIdentifier": "my-set",
"statusIdentifier": "my-status",
"position": 1,
"signedPrice": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"formModuleConfigs": [
{
"id": 1,
"formIdentifier": "reg",
"moduleIdentifier": "user",
"entityIdentifiers": [],
"isGlobal": true,
"isClosed": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"formDataCount": 0,
"entityFormDataCount": {},
"exceptionIds": [
"shop"
],
"nestedEntityIdentifiers": [
"avto-aksessuary",
"fm-moduliatory",
"avtomobilnye-derzhateli",
"videoregistratory-radiolokatory"
],
"ratingCalculation": "average",
"allowHalfRatings": true,
"maxRatingScale": 5,
"isAnonymous": true,
"allowRerating": true,
"isRating": true
}
],
"discountConfig": {
"discounts": [
{
"id": 5,
"identifier": "summer-sale",
"type": "DISCOUNT",
"localizeInfos": {
"title": "Summer Sale"
},
"startDate": "2026-01-01T06:32:19.736Z",
"endDate": "2026-01-28T06:32:22.632Z",
"discountValue": {
"value": 30,
"maxAmount": 0,
"discountType": "FIXED_PRICE",
"applicability": "TO_PRODUCT"
},
"exclusions": [
{
"id": 2
}
],
"position": 3,
"conditionLogic": "OR",
"gifts": [
{
"id": 3,
"localizeInfos": {
"title": "hhh222"
},
"attributeSetIdentifier": "attr-set-1",
"statusIdentifier": null,
"statusLocalizeInfos": {},
"templateIdentifier": null,
"price": 90,
"sku": null,
"attributeValues": {
"price1": {
"type": "integer",
"value": "90",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
}
},
"isVisible": true
}
],
"conditions": [
{
"conditionType": "PRODUCT",
"entityIds": [
{
"id": 4,
"isNested": false
},
{
"isNested": false
}
],
"value": null
},
{
"conditionType": "ATTRIBUTE",
"entityIds": [
{
"isNested": false
}
],
"value": {
"value": "100",
"condition": "eq"
}
}
]
}
],
"discountPrice": 90,
"settings": {
"allowStacking": true,
"maxDiscountValue": 30,
"allowGiftStacking": false
}
}
},
{
"localizeInfos": {
"title": "Товар"
},
"paymentStages": [
{
"title": "Part A",
"marker": "part_a",
"value": 100
},
{
"title": "Part B",
"marker": "part_b",
"value": 200
}
],
"id": 1764,
"isVisible": true,
"isSync": true,
"price": 0,
"additional": {
"prices": {
"min": 0,
"max": 100
}
},
"blocks": [],
"sku": "0-123",
"productPages": [
{
"id": 8997,
"pageId": 1176,
"productId": 8872
}
],
"rating": {
"votes": 42,
"value": 4.5,
"like": 10,
"dislike": 2,
"method": "weighted"
},
"statusLocalizeInfos": {
"title": "Товар"
},
"templateIdentifier": "my-template",
"shortDescTemplateIdentifier": "my-template-short",
"attributeValues": {
"marker": {
"value": "",
"type": "string",
"position": 1,
"isProductPreview": false,
"isIcon": false,
"additionalFields": {
"marker": {
"type": "string",
"value": "test"
}
}
}
},
"attributeSetIdentifier": "my-set",
"statusIdentifier": "my-status",
"position": 1,
"signedPrice": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"formModuleConfigs": [
{
"id": 1,
"formIdentifier": "reg",
"moduleIdentifier": "user",
"entityIdentifiers": [],
"isGlobal": true,
"isClosed": false,
"viewOnlyMyData": false,
"commentOnlyMyData": false,
"formDataCount": 0,
"entityFormDataCount": {},
"exceptionIds": [
"shop"
],
"nestedEntityIdentifiers": [
"avto-aksessuary",
"fm-moduliatory",
"avtomobilnye-derzhateli",
"videoregistratory-radiolokatory"
],
"ratingCalculation": "average",
"allowHalfRatings": true,
"maxRatingScale": 5,
"isAnonymous": true,
"allowRerating": true,
"isRating": true
}
],
"discountConfig": {
"discounts": [
{
"id": 5,
"identifier": "summer-sale",
"type": "DISCOUNT",
"localizeInfos": {
"title": "Summer Sale"
},
"startDate": "2026-01-01T06:32:19.736Z",
"endDate": "2026-01-28T06:32:22.632Z",
"discountValue": {
"value": 30,
"maxAmount": 0,
"discountType": "FIXED_PRICE",
"applicability": "TO_PRODUCT"
},
"exclusions": [
{
"id": 2
}
],
"position": 3,
"conditionLogic": "OR",
"gifts": [
{
"id": 3,
"localizeInfos": {
"title": "hhh222"
},
"attributeSetIdentifier": "attr-set-1",
"statusIdentifier": null,
"statusLocalizeInfos": {},
"templateIdentifier": null,
"price": 90,
"sku": null,
"attributeValues": {
"price1": {
"type": "integer",
"value": "90",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
}
},
"isVisible": true
}
],
"conditions": [
{
"conditionType": "PRODUCT",
"entityIds": [
{
"id": 4,
"isNested": false
},
{
"isNested": false
}
],
"value": null
},
{
"conditionType": "ATTRIBUTE",
"entityIds": [
{
"isNested": false
}
],
"value": {
"value": "100",
"condition": "eq"
}
}
]
}
],
"discountPrice": 90,
"settings": {
"allowStacking": true,
"maxDiscountValue": 30,
"allowGiftStacking": false
}
}
}
]
}

Sơ đồ phản hồi

Sơ đồ: IProductsResponse

attrValue: string
Giá trị thuộc tính.

items: IProductsEntity[]
Mảng các thực thể sản phẩm.

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
Các đị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 đã được đị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ự của 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ị lưu kho), 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 đại 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 về tính khả dụng của trang.
ví dụ: true

items.moduleFormConfigs: Array<IFormConfig>
Cấu hình biểu mẫu module (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[]
Các 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 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 tới.
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"
]

productIds: string[]
Mảng các id sản phẩm.

total: number
Tổng số lượng.