Automattic\WooCommerce\Admin\API\Reports
DataStore::add_order_by_clause()
Add order by SQL clause if included in query.
Method of the class: DataStore{}
No Hooks.
Return
String
. Order by clause.
Usage
// protected - for code of main (parent) or child class $result = $this->add_order_by_clause( $query_args, $sql_query );
- $query_args(array) (required)
- Parameters supplied by the user.
- $sql_query(SqlQuery) (required) (passed by reference — &)
- Query object.
DataStore::add_order_by_clause() DataStore::add order by clause code WC 9.3.3
protected function add_order_by_clause( $query_args, &$sql_query ) { $order_by_clause = ''; $sql_query->clear_sql_clause( array( 'order_by' ) ); if ( isset( $query_args['orderby'] ) ) { $order_by_clause = $this->normalize_order_by( esc_sql( $query_args['orderby'] ) ); $sql_query->add_sql_clause( 'order_by', $order_by_clause ); } // Return ORDER BY clause to allow adding the sort field(s) to query via a JOIN. return $order_by_clause; }