Category pages, article lists and custom sort order

Hi,

our shop is an EE 4.2.0.

We use an extra field in the oxarticle table that indicates that an article is temporarily not available / out of sale. On our category pages we sort the articles by price. So far so good, but in the article list you may find non-available articles among the first matches.

I would like to sort the article list by availability first, then by price, to push the non-available articles to the end of the list.

Now my question is: where (file & function) do i modify the standard sort order? I browsed the source code, but finally lost overview :confused:
Or is it easy to add an extra sort criteria to the list of sort criteria in the category section of the backend?

Thanks in advance
Peter

There is oxArticleList::setCustomSorting. Could mod this to always set the field you want and then have it [I]add[/I] any custom fields instead of overwriting your default. I think the custom field can be set in the backend under Category details.

Or, less elegant, just override oxArticleList::_getCategorySelect where the actual SQL query is generated. This will, however, only affect article listings because the CustomString var is used elsewhere, such as in search results.