^ "IF(sa.quantity > 0, 1, 0) DESC, pas.quantity DESC, IFNULL(p.quantity, 0) <= 0, IFNULL(p.quantity, 0) <= 0 AND FIELD(sa.out_of_stock, 1) DESC, p.position DESC"