getProductsPriceByPageUrl
Search information about products and prices for selected category.
Description
This method searches for information about products and prices for the selected category, based on the provided query parameters (userQuery). It returns a Promise that resolves to an object IProductsInfo.
Products.getProductsPriceByPageUrl(
url,
langCode,
userQuery
);
Parameters schema
Schema
url: string
Page url
example: "23-laminat-floorwood-maxima"
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.getProductsPriceByPageUrl('catalog');
Example with attributes
const userQuery = {
"offset": 0,
"limit": 30,
"statusMarker": "in_stock",
"conditionValue": "new",
"conditionMarker": "equals",
"attributeMarker": "color",
"sortOrder": "DESC",
"sortKey": "id",
};
const response = await Products.getProductsPriceByPageUrl('catalog', 'en_US', userQuery);
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 | role ≠ "Viewer" |
| in | Contains (one of) | role in ["Editor", "Manager"] |
| nin | Not contains | email not in ["@temp.com"] |
| exs | Exists (has value) | Has lastLogin |
| nexs | Does not exist | Never logged in |
conditionValue: The value to compare against.
Example response
{
"items": [
{
"id": 2957,
"price": 150
},
{
"id": 2954,
"price": 51
},
{
"id": 2955,
"price": 0
}
],
"total": 3
}
Response schema
Schema: IProductsInfo
total: number
The total number of products found.
example: 100
items: IProductInfo[]
An array of product information objects.
example:
[
{
"id": 12345,
"price": 150
},
{
"id": 67890,
"price": 200
}
]
items.id: number
The unique identifier of the product.
example: 12345
items.price: number
The price of the product.
example: 150