How to add new sorting methods?

Hello!

I am trying to add a new sorting method to the products sortin menu.

I want to sort the items by sales.

in the backend:
     Basic settings > Frontend > Filter / Sorting

there is only some default sorting methods

Is there a possible way to define new ones?

Thank you!

Custom sorting is limited to the predifined fields in standard. It is possible to create new sortings (click: “Add Item” - Shopware 5.3+).

We created this plugin for using individual fields & SQL-Queries: http://store.shopware.com/colo328219905291/individuelle-kategoriesortierung-datenbankfelder-sql-queries.html

:slight_smile:

Thank you!
But isn’t there any programmatic way to do it or any guide?

Sure! You can find the standard sortings here: shopware/engine/Shopware/Bundle/SearchBundleDBAL/SortingHandler at 56df57575909854d2dec7fcba07500e27a3361ee · shopware/shopware · GitHub

You can use the logic to implement a custom one. :slight_smile:

1 „Gefällt mir“