product_list_sections
The product_list_sections
API retrieves a list of configuration objects that allows clients to display section-based information in the left-side dropdown of a product list.
Parameters
- api_key (string) Required - The API key for the account
Response
The product_list_sections
API returns a JSON array of configuration objects. Each object has attributes:
- asc (boolean) - Whether or not we should sort the displayed items in ascending order. Assumed true if not provided
- attribute (int) - An attribute flag representing the attribute on which to derive sections from. See the "Attribute Flags" section below.
- id (int) - A unique identifier for this section description
- icon (int) - An identifier from the icons API telling the client which icon to display on the toplevel button. May be null.
- ordinal (int) - The relative order (displayed from left-to-right) of this section
- product_list_id (int) - The ID of the product_list to which this configuration applies
- preset (object) - an object specifying use of a preset sectioning algorithm. If this is set to a non-null value, the "sections" attribute above is ignored.
- title (string) - The text to display on the toplevel button. This must be defined, and must be 12 characters or less.
Product List Section Contraints
There can be at most 4 product_sections to a single product_list, giving a total of 5 sections (1 default "house list" section and 4 configured sections).
Atribute Flags
These flags map to a single attribute of a product retrieved via the product_list_groups API.
The sectioning behaviour is as follows:
- the product list is broken into sections by wine_color
- for each wine_color section, the product list is arranged in lexicographic order if the attribute value is a string, and by the "ordinal" property if the attribute value is an object
The defined flags are:
- 1 - title
- 2 - subtitle_1
- 3 - subtitle_2
- 4 - subtitle_3
- 5 - subtitle_4
- 6 - price
- 7 - rating_source
- 8 - rating_value
- 9 - units (ordered by lowest ordinal in units array)
Section Presets
Each preset is represented by an object with attributes:
- id (int) - the unique of the preset sectioning algorithm to use
- values (array) - an array of threshold values representing boundaries to break the sections into
Preset Flags and Associated Values (Examples only. The values below are meant to illustrate the idea)
- 1 - Sort by price. The threshold values represent the price bands.
The display format will always be: "
" Where will be a series of concatenated "$" strings. ie: "$$" for price band 2, "$$$" for price band 3.
Sample Request
https://dashboard.onpremisewine.com/product_list_sections?api_key=ABCDEF123456
Sample Response
The following generates 2 buttons in the dropdown: * one that sorts the beverages "by price", having subsections which are clearly defined. * one that represents a single section, where items are draw from the beverage region, and sorted by the beverage region names as well.
{
"product_list_sections": [
{
"product_list_id": 12,
"id": 1,
"icon": 3,
"ordinal": 1,
"title": "by price",
"preset": {
"id": 1,
"values": [ 10,20,30,50 ]
}
},
{
"product_list_id": 12,
"icon": 5,
"title": "by region",
"asc": true,
"ordinal": 2,
"items": 4,
"attribute": 2
}
]
}