parent
01b5f5afec
commit
a1b78ec918
|
@ -178,7 +178,7 @@ class WC_Query {
|
|||
$q->set( 'page_id', get_option('page_on_front') );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// When orderby is set, WordPress shows posts. Get around that here.
|
||||
if ( $q->is_home() && 'page' == get_option('show_on_front') && get_option('page_on_front') == wc_get_page_id('shop') ) {
|
||||
$_query = wp_parse_args( $q->query );
|
||||
|
@ -501,6 +501,8 @@ class WC_Query {
|
|||
* @return array
|
||||
*/
|
||||
public function get_catalog_ordering_args( $orderby = '', $order = '' ) {
|
||||
global $wpdb;
|
||||
|
||||
// Get ordering from query string unless defined
|
||||
if ( ! $orderby ) {
|
||||
$orderby_value = isset( $_GET['orderby'] ) ? wc_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
|
||||
|
@ -513,8 +515,7 @@ class WC_Query {
|
|||
|
||||
$orderby = strtolower( $orderby );
|
||||
$order = strtoupper( $order );
|
||||
|
||||
$args = array();
|
||||
$args = array();
|
||||
|
||||
// default - menu_order
|
||||
$args['orderby'] = 'menu_order title';
|
||||
|
@ -530,7 +531,7 @@ class WC_Query {
|
|||
$args['order'] = $order == 'ASC' ? 'ASC' : 'DESC';
|
||||
break;
|
||||
case 'price' :
|
||||
$args['orderby'] = 'meta_value_num';
|
||||
$args['orderby'] = "meta_value_num {$wpdb->posts}.ID";
|
||||
$args['order'] = $order == 'DESC' ? 'DESC' : 'ASC';
|
||||
$args['meta_key'] = '_price';
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue