Sort default category response by category ID (https://github.com/woocommerce/woocommerce-admin/pull/1201)
This commit is contained in:
parent
268182e75f
commit
3f388028ac
|
@ -252,9 +252,9 @@ class WC_Admin_REST_Reports_Categories_Controller extends WC_REST_Reports_Contro
|
|||
$params['orderby'] = array(
|
||||
'description' => __( 'Sort collection by object attribute.', 'wc-admin' ),
|
||||
'type' => 'string',
|
||||
'default' => 'date',
|
||||
'default' => 'category_id',
|
||||
'enum' => array(
|
||||
'date',
|
||||
'category_id',
|
||||
'items_sold',
|
||||
'net_revenue',
|
||||
'orders_count',
|
||||
|
|
|
@ -115,20 +115,6 @@ class WC_Admin_Reports_Categories_Data_Store extends WC_Admin_Reports_Data_Store
|
|||
return $included_categories_str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps ordering specified by the user to columns in the database/fields in the data.
|
||||
*
|
||||
* @param string $order_by Sorting criterion.
|
||||
* @return string
|
||||
*/
|
||||
protected function normalize_order_by( $order_by ) {
|
||||
if ( 'date' === $order_by ) {
|
||||
return 'date_created';
|
||||
}
|
||||
|
||||
return $order_by;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares values in 2 arrays based on criterion specified when called via sort_records.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue