Sale widget fix

This commit is contained in:
Mike Jolley 2011-12-07 18:22:03 +00:00
parent 9d116bb839
commit e0a0065abb
2 changed files with 9 additions and 3 deletions

View File

@ -97,6 +97,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
* % coupon fix
* Tax rates based on shipping address
* Helpers for outputting JS in the footer
* Fixed sale widget
= 1.3 - 01/12/2011 =
* Minor bug fixes + localisations

View File

@ -63,8 +63,6 @@ class WooCommerce_Widget_On_Sale extends WP_Widget {
if ( false === ( $product_ids_on_sale = get_transient( 'woocommerce_products_onsale' ) ) ) :
$meta_query = array();
$meta_query[] = $woocommerce->query->visibility_meta_query();
$meta_query[] = $woocommerce->query->stock_status_meta_query();
$meta_query[] = array(
'key' => 'sale_price',
'value' => 0,
@ -85,13 +83,20 @@ class WooCommerce_Widget_On_Sale extends WP_Widget {
set_transient( 'woocommerce_products_onsale', $product_ids_on_sale );
endif;
$product_ids_on_sale[] = 0;
$meta_query = array();
$meta_query[] = $woocommerce->query->visibility_meta_query();
$meta_query[] = $woocommerce->query->stock_status_meta_query();
$query_args = array(
'showposts' => $number,
'nopaging' => 0,
'post_status' => 'publish',
'post_type' => 'product',
'orderby' => 'rand',
'meta_query' => $meta_query,
'post__in' => $product_ids_on_sale
);