Sort (Product Listing Engine)

Methods

isSortedBy

Checks whether the specified sort criterion matches the value in state.

Parameters

  • criterion: SortByRelevance | SortByFields

    The criterion to compare.

Returns boolean: true if the passed sort criterion matches the value in state, and false otherwise.

sortBy

Updates the sort criterion and executes a new query.

Parameters

  • criterion: SortByRelevance | SortByFields

    The new sort criterion.

subscribe

Adds a callback that’s invoked on state change.

Parameters

  • listener: () => void

    A callback that’s invoked on state change.

Returns Unsubscribe: A function to remove the listener.

Attributes

state

A scoped and simplified part of the headless state that is relevant to the Sort controller.

Properties

  • sort: SortByRelevance | SortByFields

    The current sort criterion.

Initialize

buildSort

Creates a Sort controller instance for the product listing.

Parameters

  • engine: ProductListingEngine

    The headless engine.

  • props: ProductListingSortProps

    The configurable Sort controller properties.

Returns ProductListingSort

ProductListingSortProps

The configurable Sort controller properties.

Properties

ProductListingSortInitialState

The initial state that should be applied to this Sort controller.

Properties

  • criterion?: SortByRelevance | SortByFields

    The initial sort criterion to register in state.

Unsubscribe

Call signatures

  • (): void

What's next for me?