getProductsByPageUrl
Search for all product objects with pagination for the selected category (by its URL).
Description
This method searches for all products objects with pagination for the selected category, based on the provided query parameters (userQuery). It returns a Promise that resolves to an object IProductsResponse.
Products.getProductsByPageUrl(
url,
body,
langCode,
userQuery
);
Parameters schema
Schema
url(required): string
Page url
example: "catalog"
body: IFilterParams[]
Request body. Default: []
example:
[
{
"attributeMarker": "price",
"conditionMarker": "mth",
"statusMarker": "waiting",
"conditionValue": 1,
"pageUrls": [
"23-laminat-floorwood-maxima"
],
"isNested": false,
"title": ""
},
{
"attributeMarker": "price",
"conditionMarker": "lth",
"conditionValue": 3,
"pageUrls": [
"23-laminat-floorwood-maxima"
],
"isNested": false,
"title": ""
}
]
body.attributeMarker(required): string | null
The text identifier of the indexed attribute by which values are filtered. Default: null.
example: "color"
body.conditionMarker: string | null
Id of the filter condition by which the values are filtered. Default: null.
example: "equals"
body.conditionValue(required): number | null
The value that is being searched for, default null.
example: "new"
body.pageUrl: string | null
Url of the category page object.
example: ["23-laminat-floorwood-maxima"]
body.statusMarker: string | null
Text identifier of the product page status (default not set).
example: "in_stock"
body.title: string | null
Product name.
example: "Laminatboden Maxima"
body.isNested: boolean
Flag for nested attributes, default false.
example: true
langCode: string
Language code. Default: "en_US"
example: "en_US"
userQuery: IProductsQuery
Optional set query parameters
example:
{
"limit": 30,
"offset": 0,
"sortOrder": "DESC",
"sortKey": "id",
"statusId": 123,
"statusMarker": "in_stock",
"conditionValue": "new",
"conditionMarker": "equals",
"attributeMarker": "color"
}
userQuery.offset(required): number
Parameter for pagination. Default: 0.
userQuery.limit(required): number
Parameter for pagination. Default: 30.
userQuery.sortOrder(required): string
Sort order "DESC" | "ASC". Default: "DESC".
userQuery.sortKey(required): string
Field for sorting (default - null). Possible values: "id", "position", "title", "date", "price". Default: null.
userQuery.templateMarker: string | null
Product page template marker, default null.
example: "template_12345"
userQuery.statusMarker: string | null
Product page status marker, default null.
example: "in_stock"
userQuery.conditionValue: string | null
The value that is being searched for, default null.
example: "new"
userQuery.attributeMarker: string | null
The text identifier of the indexed attribute by which values are filtered, default null.
example: "color"
userQuery.conditionMarker: string | null
Marker of the filter condition by which the values are filtered, default null.
example: "equals"
By default, you can retrieve 10 objects. This is due to the record limit in the module's permissions settings.
For pagination to work correctly, you need to configure Module permissions according to your needs in the corresponding section.
Examples
Minimal example
const response = await Products.getProductsByPageUrl('catalog');
Example with body parameter
const body = [ { "attributeMarker": "price", "conditionMarker": "mth", "conditionValue": 1, "statusMarker": "waiting", "pageUrls": [ "23-laminat-floorwood-maxima" ], "isNested": false, "title": "" }, { "attributeMarker": "price", "conditionMarker": "lth", "conditionValue": 3, "pageUrls": [ "23-laminat-floorwood-maxima" ], "isNested": false, "title": "" }];
const response = await Products.getProductsByPageUrl('catalog', body);
Use filters to find specific products:
attributeMarker: The text identifier of the indexed attribute by which values are filtered. conditionMarker: The type of condition to apply to the attribute value.
| Marker | Meaning | Example |
|---|---|---|
| eq | Equal | statusId = 1 (active only) |
| neq | Not equal | category ≠ "archived" |
| in | Contains (one of) | category in ["electronics", "books"] |
| nin | Not contains | brand not in ["fake_brand"] |
| exs | Exists (has value) | Has description |
| nexs | Does not exist | No image |
conditionValue: The value to compare against.
Example response
{
"items": [
{
"id": 2954,
"attributeSetIdentifier": "products",
"localizeInfos": {
"title": "Box"
},
"statusLocalizeInfos": {
"title": "Sale"
},
"isVisible": true,
"statusIdentifier": "sale",
"position": 1,
"templateIdentifier": null,
"shortDescTemplateIdentifier": "product_preview",
"price": 51,
"additional": {
"prices": {
"min": 51,
"max": 150
}
},
"sku": null,
"isSync": true,
"categories": [
"catalog"
],
"isPositionLocked": false,
"attributeValues": {
"product-name": {
"type": "string",
"value": "product-name",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
},
"price": {
"type": "integer",
"value": 51,
"isIcon": false,
"position": 1,
"additionalFields": [],
"isProductPreview": false
},
"currency_products": {
"type": "string",
"value": "usd",
"isIcon": false,
"position": 2,
"additionalFields": [],
"isProductPreview": false
},
"img": {
"type": "image",
"value": {
"size": 241636,
"filename": "files/project/product/2954/image/7e0a6a70-a23d-410f-8b6a-f8b4f7483244.png",
"downloadLink": "https://js-sdk-tests.oneentry.cloud/cloud-static/files/project/product/2954/image/7e0a6a70-a23d-410f-8b6a-f8b4f7483244.png"
},
"isIcon": false,
"position": 3,
"additionalFields": [],
"isProductPreview": false
}
}
},
{
"id": 2955,
"attributeSetIdentifier": null,
"localizeInfos": {
"title": "Product"
},
"statusLocalizeInfos": {
"title": "Sale"
},
"isVisible": true,
"statusIdentifier": "sale",
"position": 2,
"templateIdentifier": null,
"shortDescTemplateIdentifier": null,
"price": null,
"additional": {
"prices": {
"min": 51,
"max": 150
}
},
"sku": null,
"isSync": false,
"categories": [
"catalog"
],
"isPositionLocked": false,
"attributeValues": {}
},
{
"id": 2957,
"attributeSetIdentifier": "products",
"localizeInfos": {
"title": "Cosmo"
},
"statusLocalizeInfos": {
"title": "Sale"
},
"isVisible": true,
"statusIdentifier": "sale",
"position": 3,
"templateIdentifier": null,
"shortDescTemplateIdentifier": null,
"price": 150,
"additional": {
"prices": {
"min": 51,
"max": 150
}
},
"sku": null,
"isSync": true,
"categories": [
"catalog"
],
"isPositionLocked": false,
"attributeValues": {
"product-name": {
"type": "string",
"value": "Cosmo",
"isIcon": false,
"position": 0,
"additionalFields": [],
"isProductPreview": false
},
"price": {
"type": "integer",
"value": 150,
"isIcon": false,
"position": 1,
"additionalFields": [],
"isProductPreview": false
},
"currency_products": {
"type": "string",
"value": "",
"isIcon": false,
"position": 2,
"additionalFields": [],
"isProductPreview": false
},
"img": {
"type": "image",
"value": [],
"isIcon": false,
"position": 3,
"additionalFields": [],
"isProductPreview": false
}
}
}
],
"total": 3
}
Response schema
Schema: IProductsResponse
total: number
The total number of products found.
example: 100
items: IProductsEntity[]
An array of product entities.
example:
[
{
"id": 12345,
"title": "Product 1"
},
{
"id": 67890,
"title": "Product 2"
}
]
items.id: number
The unique identifier.
example: 12345
items.localizeInfos: ILocalizeInfo
The name of the products, taking into account localization.
example:
items.statusIdentifier: string | null
Product page status identifiers (may be null).
example: "in_stock"
items.statusLocalizeInfos: any
JSON description of the item status object, taking into account the language.
example:
items.attributeSetIdentifier: string | null
Set of attributes id.
example: "set_12345"
items.position: number
Item number (for sorting).
example: 1
items.templateIdentifier: string | null
User id of the linked template.
example: "template_12345"
items.shortDescTemplateIdentifier: string | null
User id of the linked template for a short description.
example: "short_desc_template_12345"
items.price: number
The value of the product page price taken from the index.
example: 150
items.additional: object
Additional value from the index.
example:
{
"en": "In Stock",
"de": "Auf Lager"
}
items.sku: string | null
Product SKU (Stock Keeping Unit), may be null.
example: "SKU_12345"
items.isSync: boolean
Indication of page indexing.
example: true
items.attributeValues: AttributeType
Array of attribute values from the index, represented.
example:
[
{
"id": "color",
"value": "red"
}
]
items.categories: string[]
Product categories.
example:
[
1,
2,
3
]
items.isVisible: boolean
A sign of page visibility.
example: true
items.productPages: any
Array of product pages or a single product page object.
example: []
items.blocks: string[]
Array of block identifiers.
example:
[
"block_12345",
"block_67890"
]
items.isPositionLocked: boolean
Sorting position lock indicator (optional).
example: false
items.relatedIds: number[]
Ids of related product pages.
example:
[
12345,
67890
]