I need to sort products in category by 2 parameters, for example, by availability in stock (~amount) and by price, in order to display not-in-stock products on last pages, but sort all by price simultaneously. How to do it?
It is not possible to make it via an add-on, but you can do it by modifying the app/functions/fn.catalog.php file.
Find this function: fn_get_products There is "sorting" code:
$sorting = db_sort($params, $sortings);
The sorting variable after processing looks like
ORDER BY products.price DESC
You can extend it by your code. For example:
if (!empty($sorting)) {
$sorting .= ', my_field ASC';
}
You will get something like this
ORDER BY products.price DESC, my_field ASC