- if ( $this->sortDescending() ) {
- $options['ORDER BY'] = 'qc_value DESC';
- } else {
- $options['ORDER BY'] = 'qc_value ASC';
+
+ $orderFields = $this->getOrderFields();
+ $order = [];
+ $DESC = $this->sortDescending() ? ' DESC' : '';
+ foreach ( $orderFields as $field ) {
+ $order[] = "qc_${field}${DESC}";
+ }
+ if ( $order ) {
+ $options['ORDER BY'] = $order;