Sort default category response by category ID (https://github.com/woocommerce/woocommerce-admin/pull/1201)

This commit is contained in:
Joshua T Flowers 2018-12-29 01:50:58 +08:00 committed by Timmy Crawford
parent 268182e75f
commit 3f388028ac
2 changed files with 2 additions and 16 deletions

View File

@ -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',

View File

@ -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.
*