Merge branch 'master' of github.com:woothemes/woocommerce
This commit is contained in:
commit
dadde1c1cf
|
@ -114,29 +114,23 @@ function wc_clear_cart_after_payment() {
|
||||||
if ( ! empty( $wp->query_vars['order-received'] ) ) {
|
if ( ! empty( $wp->query_vars['order-received'] ) ) {
|
||||||
|
|
||||||
$order_id = absint( $wp->query_vars['order-received'] );
|
$order_id = absint( $wp->query_vars['order-received'] );
|
||||||
|
$order_key = isset( $_GET['key'] ) ? wc_clean( $_GET['key'] ) : '';
|
||||||
if ( isset( $_GET['key'] ) )
|
|
||||||
$order_key = $_GET['key'];
|
|
||||||
else
|
|
||||||
$order_key = '';
|
|
||||||
|
|
||||||
if ( $order_id > 0 ) {
|
if ( $order_id > 0 ) {
|
||||||
$order = wc_get_order( $order_id );
|
$order = wc_get_order( $order_id );
|
||||||
|
|
||||||
if ( $order->order_key == $order_key ) {
|
if ( $order->order_key === $order_key ) {
|
||||||
WC()->cart->empty_cart();
|
WC()->cart->empty_cart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( WC()->session->order_awaiting_payment > 0 ) {
|
if ( WC()->session->order_awaiting_payment > 0 ) {
|
||||||
|
|
||||||
$order = wc_get_order( WC()->session->order_awaiting_payment );
|
$order = wc_get_order( WC()->session->order_awaiting_payment );
|
||||||
|
|
||||||
if ( $order->id > 0 ) {
|
if ( $order->id > 0 ) {
|
||||||
// If the order has not failed, or is not pending, the order must have gone through
|
// If the order has not failed, or is not pending, the order must have gone through
|
||||||
if ( ! $order->has_status( array( 'failed', 'pending' ) ) ) {
|
if ( ! $order->has_status( array( 'failed', 'pending', 'cancelled' ) ) ) {
|
||||||
WC()->cart->empty_cart();
|
WC()->cart->empty_cart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,11 +49,13 @@ class WC_Widget_Price_Filter extends WC_Widget {
|
||||||
|
|
||||||
extract( $args );
|
extract( $args );
|
||||||
|
|
||||||
if ( ! is_post_type_archive( 'product' ) && ! is_tax( get_object_taxonomies( 'product' ) ) )
|
if ( ! is_post_type_archive( 'product' ) && ! is_tax( get_object_taxonomies( 'product' ) ) ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( sizeof( WC()->query->unfiltered_product_ids ) == 0 )
|
if ( sizeof( WC()->query->unfiltered_product_ids ) == 0 ) {
|
||||||
return; // None shown - return
|
return; // None shown - return
|
||||||
|
}
|
||||||
|
|
||||||
$min_price = isset( $_GET['min_price'] ) ? esc_attr( $_GET['min_price'] ) : '';
|
$min_price = isset( $_GET['min_price'] ) ? esc_attr( $_GET['min_price'] ) : '';
|
||||||
$max_price = isset( $_GET['max_price'] ) ? esc_attr( $_GET['max_price'] ) : '';
|
$max_price = isset( $_GET['max_price'] ) ? esc_attr( $_GET['max_price'] ) : '';
|
||||||
|
@ -65,20 +67,25 @@ class WC_Widget_Price_Filter extends WC_Widget {
|
||||||
// Remember current filters/search
|
// Remember current filters/search
|
||||||
$fields = '';
|
$fields = '';
|
||||||
|
|
||||||
if ( get_search_query() )
|
if ( get_search_query() ) {
|
||||||
$fields .= '<input type="hidden" name="s" value="' . get_search_query() . '" />';
|
$fields .= '<input type="hidden" name="s" value="' . get_search_query() . '" />';
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! empty( $_GET['post_type'] ) )
|
if ( ! empty( $_GET['post_type'] ) ) {
|
||||||
$fields .= '<input type="hidden" name="post_type" value="' . esc_attr( $_GET['post_type'] ) . '" />';
|
$fields .= '<input type="hidden" name="post_type" value="' . esc_attr( $_GET['post_type'] ) . '" />';
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! empty ( $_GET['product_cat'] ) )
|
if ( ! empty ( $_GET['product_cat'] ) ) {
|
||||||
$fields .= '<input type="hidden" name="product_cat" value="' . esc_attr( $_GET['product_cat'] ) . '" />';
|
$fields .= '<input type="hidden" name="product_cat" value="' . esc_attr( $_GET['product_cat'] ) . '" />';
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! empty( $_GET['product_tag'] ) )
|
if ( ! empty( $_GET['product_tag'] ) ) {
|
||||||
$fields .= '<input type="hidden" name="product_tag" value="' . esc_attr( $_GET['product_tag'] ) . '" />';
|
$fields .= '<input type="hidden" name="product_tag" value="' . esc_attr( $_GET['product_tag'] ) . '" />';
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! empty( $_GET['orderby'] ) )
|
if ( ! empty( $_GET['orderby'] ) ) {
|
||||||
$fields .= '<input type="hidden" name="orderby" value="' . esc_attr( $_GET['orderby'] ) . '" />';
|
$fields .= '<input type="hidden" name="orderby" value="' . esc_attr( $_GET['orderby'] ) . '" />';
|
||||||
|
}
|
||||||
|
|
||||||
if ( $_chosen_attributes ) foreach ( $_chosen_attributes as $attribute => $data ) {
|
if ( $_chosen_attributes ) foreach ( $_chosen_attributes as $attribute => $data ) {
|
||||||
|
|
||||||
|
@ -86,9 +93,10 @@ class WC_Widget_Price_Filter extends WC_Widget {
|
||||||
|
|
||||||
$fields .= '<input type="hidden" name="' . esc_attr( $taxonomy_filter ) . '" value="' . esc_attr( implode( ',', $data['terms'] ) ) . '" />';
|
$fields .= '<input type="hidden" name="' . esc_attr( $taxonomy_filter ) . '" value="' . esc_attr( implode( ',', $data['terms'] ) ) . '" />';
|
||||||
|
|
||||||
if ( $data['query_type'] == 'or' )
|
if ( $data['query_type'] == 'or' ) {
|
||||||
$fields .= '<input type="hidden" name="' . esc_attr( str_replace( 'pa_', 'query_type_', $attribute ) ) . '" value="or" />';
|
$fields .= '<input type="hidden" name="' . esc_attr( str_replace( 'pa_', 'query_type_', $attribute ) ) . '" value="or" />';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$min = $max = 0;
|
$min = $max = 0;
|
||||||
$post_min = $post_max = '';
|
$post_min = $post_max = '';
|
||||||
|
@ -145,15 +153,17 @@ class WC_Widget_Price_Filter extends WC_Widget {
|
||||||
) ) );
|
) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $min == $max )
|
if ( $min == $max ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
echo $before_widget . $before_title . $title . $after_title;
|
echo $before_widget . $before_title . $title . $after_title;
|
||||||
|
|
||||||
if ( get_option( 'permalink_structure' ) == '' )
|
if ( get_option( 'permalink_structure' ) == '' ) {
|
||||||
$form_action = remove_query_arg( array( 'page', 'paged' ), add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) );
|
$form_action = remove_query_arg( array( 'page', 'paged' ), add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) );
|
||||||
else
|
} else {
|
||||||
$form_action = preg_replace( '%\/page/[0-9]+%', '', home_url( $wp->request ) );
|
$form_action = preg_replace( '%\/page/[0-9]+%', '', home_url( $wp->request ) );
|
||||||
|
}
|
||||||
|
|
||||||
echo '<form method="get" action="' . esc_attr( $form_action ) . '">
|
echo '<form method="get" action="' . esc_attr( $form_action ) . '">
|
||||||
<div class="price_slider_wrapper">
|
<div class="price_slider_wrapper">
|
||||||
|
|
Loading…
Reference in New Issue