To get information about all sorting options on the PLP page

Description

Gets information about all sorting options on the page. This method works only when the current view is the search page, otherwise it returns undefined. To get the current sorting option on the page, use getSorting.

getAllSorting() → {Array.<Sorting>}

var plp = container.getComponent('PLP');
plp.getAllSorting();

// Example of the array of objects returned with getAllSorting()
[
  {
    active: true,
    id: relevance:desc,
    name: Relevance,
    isDefault: true
  },
  {
    id: onlinecustomerprice:asc",
    name: "Price, low to high",
    isDefault: false
  }
]

Leave a comment

Your email address will not be published. Required fields are marked *