WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Admin\API\Reports\Coupons

DataStore::add_order_by_params() protected WC 1.0

Fills ORDER BY clause of SQL request based on user supplied parameters.

{} It's a method of the class: DataStore{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->add_order_by_params( $query_args, $from_arg, $id_cell );
$query_args(array) (required)
Parameters supplied by the user.
$from_arg(string) (required)
Target of the JOIN sql param.
$id_cell(string) (required)
ID cell identifier, like table_name.id_column_name.

Code of DataStore::add_order_by_params() WC 6.1.1

protected function add_order_by_params( $query_args, $from_arg, $id_cell ) {
	global $wpdb;
	$lookup_table    = self::get_db_table_name();
	$order_by_clause = $this->add_order_by_clause( $query_args, $this );
	$join            = "JOIN {$wpdb->posts} AS _coupons ON {$id_cell} = _coupons.ID";
	$this->add_orderby_order_clause( $query_args, $this );

	if ( 'inner' === $from_arg ) {
		$this->subquery->clear_sql_clause( 'join' );
		if ( false !== strpos( $order_by_clause, '_coupons' ) ) {
			$this->subquery->add_sql_clause( 'join', $join );
		}
	} else {
		$this->clear_sql_clause( 'join' );
		if ( false !== strpos( $order_by_clause, '_coupons' ) ) {
			$this->add_sql_clause( 'join', $join );
		}
	}
}