Add support for order as well to the shortcode
This commit is contained in:
parent
2596796de3
commit
a250b0044f
|
@ -39,7 +39,7 @@ jQuery( function( $ ) {
|
||||||
this.$checkout_form.on( 'update', this.trigger_update_checkout );
|
this.$checkout_form.on( 'update', this.trigger_update_checkout );
|
||||||
|
|
||||||
// Inputs/selects which update totals
|
// Inputs/selects which update totals
|
||||||
this.$checkout_form.on( 'change', 'select.shipping_method, input[name^="shipping_method"], #ship-to-different-address input, .update_totals_on_change select, .update_totals_on_change input[type="radio"], .update_totals_on_change input[type="checkbox"]', this.trigger_update_checkout );
|
this.$checkout_form.on( 'change', 'select.shipping_method, input[name^="shipping_method"], #ship-to-different-address-checkbox input, .update_totals_on_change select, .update_totals_on_change input[type="radio"], .update_totals_on_change input[type="checkbox"]', this.trigger_update_checkout );
|
||||||
this.$checkout_form.on( 'change', '.address-field select', this.input_changed );
|
this.$checkout_form.on( 'change', '.address-field select', this.input_changed );
|
||||||
this.$checkout_form.on( 'change', '.address-field input.input-text, .update_totals_on_change input.input-text', this.maybe_input_changed );
|
this.$checkout_form.on( 'change', '.address-field input.input-text, .update_totals_on_change input.input-text', this.maybe_input_changed );
|
||||||
this.$checkout_form.on( 'keydown', '.address-field input.input-text, .update_totals_on_change input.input-text', this.queue_update_checkout );
|
this.$checkout_form.on( 'keydown', '.address-field input.input-text, .update_totals_on_change input.input-text', this.queue_update_checkout );
|
||||||
|
|
|
@ -177,9 +177,14 @@ class WC_Shortcode_Products {
|
||||||
'ignore_sticky_posts' => true,
|
'ignore_sticky_posts' => true,
|
||||||
'no_found_rows' => false === wc_string_to_bool( $this->attributes['paginate'] ),
|
'no_found_rows' => false === wc_string_to_bool( $this->attributes['paginate'] ),
|
||||||
'orderby' => empty( $_GET['orderby'] ) ? $this->attributes['orderby'] : wc_clean( wp_unslash( $_GET['orderby'] ) ),
|
'orderby' => empty( $_GET['orderby'] ) ? $this->attributes['orderby'] : wc_clean( wp_unslash( $_GET['orderby'] ) ),
|
||||||
'order' => strtoupper( $this->attributes['order'] ),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$orderby_value = explode( '-', $query_args['orderby'] );
|
||||||
|
$orderby = esc_attr( $orderby_value[0] );
|
||||||
|
$order = ! empty( $orderby_value[1] ) ? $orderby_value[1] : strtoupper( $this->attributes['order'] );
|
||||||
|
$query_args['orderby'] = $orderby;
|
||||||
|
$query_args['order'] = $order;
|
||||||
|
|
||||||
if ( wc_string_to_bool( $this->attributes['paginate'] ) ) {
|
if ( wc_string_to_bool( $this->attributes['paginate'] ) ) {
|
||||||
$this->attributes['page'] = absint( empty( $_GET['product-page'] ) ? 1 : $_GET['product-page'] ); // WPCS: input var ok, CSRF ok.
|
$this->attributes['page'] = absint( empty( $_GET['product-page'] ) ? 1 : $_GET['product-page'] ); // WPCS: input var ok, CSRF ok.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue