Allow for changing the default sorting option in the product list component
Related SO question: https://stackoverflow.com/questions/61344955/change-the-default-sort-option-in-product-listing-page
The list of the available sorting options is data-driven (from backend). See: https://github.com/SAP/spartacus/blob/develop/projects/storefrontlib/src/cms-components/product/product-list/container/product-list.component.html#L13
For more, see models: ProductSearchPage and PaginationModel.
But the placeholder text for the dropdown is a hardcoded i18n key for 'Relevance'. It's not data-driven - which is an issue.
We should check if we can safely remove the placeholder and the Relevance option will remain as the first data-driven pre-selected option. If not, we should fix that.
It looks like a functional and DOM-related breaking change, so we should sort (😉) it out in a major version or using a feature-level flag in a minor version.
Note: without fixing this, a customer has to re-write whole product listing component
If not addressed now, it should be fixed during the future refactor of PLP https://github.com/SAP/spartacus/issues/6424
Normally in the old accelerator, the sort option ordering is taken from the configuration/setup of the Solr index & that ordering remains unchanged. The backend then also strips off the Relevance sort type if the search does not include a free text element (there is no relevance without a text search term to be relevant to). Typically you setup Commerce with Relevance as the first sort type, and then the second sort type is the one that becomes the default for the PLP (i.e. no free text search)
@Platonn @Xymmer @neilhubertprice @ccmehil @SomeKay
I have changed the query value in like this
in search api, but the faceList$ is not populating facet array for this page, what might be the issue, the sort array should be changed or how can i do, could you please help me with this FYI, when im passing manually the same json to facetList$ array then im able to see facets coming on the UI,