Skip to main content

getProductsPriceByPageUrl

Get products and their prices for the selected category.

Description​

Fetches the ID and price of each product on the catalog page with the given url; userQuery sets pagination, sort order, statusMarker and signPrice. Resolves to an IProductsInfo: the records are in items, the total count in total.

.getProductsPriceByPageUrl( , , );

Parameters schema​

Schema

url: string
Page URL.
example: "23-laminat-floorwood-maxima"

langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"

userQuery: IProductsPriceQuery
Optional query parameters.
example:

{
"limit": 30,
"offset": 0,
"sortOrder": "DESC",
"signPrice": "orders",
"statusMarker": "in_stock"
}

userQuery.offset: number
Number of records to skip. Default: 0. offset + limit must not exceed 200; a larger window is rejected with 400.

userQuery.limit: number
Maximum number of records to return. Default: 30.

userQuery.sortOrder: string
Sort order: "DESC" or "ASC". Default: "DESC".

userQuery.signPrice: string
Marker of the order storage to fix prices for. When set, each product comes with a signedPrice that holds the price for a limited time.

userQuery.statusMarker: string | null
Marker of the product status. Default: null.
example: "in_stock"

Record limit. If the user group's permission for this method allows only restricted reading, the API returns at most the number of records set in the project settings (10 by default), whatever limit you pass. With full read access, limit works as usual. See Module permissions (opens in a new tab).

signPrice locks the returned price for a limited time. Set it to your order storage marker. See Fixing the price (signPrice).

Examples​

Minimal example​

const response = await Products.getProductsPriceByPageUrl('catalog');

Example with userQuery​

const userQuery = {
"offset": 0,
"limit": 30,
"statusMarker": "in_stock",
"sortOrder": "DESC",
};

const response = await Products.getProductsPriceByPageUrl('catalog', 'en_US', userQuery);

Example response​

{
"items": [
{
"id": 2960,
"price": 180
},
{
"id": 3445,
"price": 150
},
{
"id": 2957,
"price": 150
}
],
"total": 6
}

Response schema​

Schema: IProductsInfo

total: number
Total number of products found.
example: 100

items: IProductInfo[]
Price records of the products.
example:

[
{
"id": 12345,
"price": 150
},
{
"id": 67890,
"price": 200
}
]

items.id: number
ID of the product.
example: 12345

items.price: number
The price of the product.
example: 150

items.signedPrice: string
Signed token (JWT) that fixes the product price for an order. Returned when signPrice is set.
see: Fixed product price
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."