Related product fix when no categories are set

This commit is contained in:
Mike Jolley 2011-11-18 01:07:05 +00:00
parent d16638f738
commit ec50a48f81
2 changed files with 5 additions and 0 deletions

View File

@ -670,9 +670,13 @@ class woocommerce_product {
$terms = wp_get_post_terms($this->id, 'product_tag'); $terms = wp_get_post_terms($this->id, 'product_tag');
foreach ($terms as $term) $tags_array[] = $term->term_id; foreach ($terms as $term) $tags_array[] = $term->term_id;
// Get categories
$terms = wp_get_post_terms($this->id, 'product_cat'); $terms = wp_get_post_terms($this->id, 'product_cat');
foreach ($terms as $term) $cats_array[] = $term->term_id; foreach ($terms as $term) $cats_array[] = $term->term_id;
// Don't bother if none are set
if ( sizeof($cats_array)==1 && sizeof($tags_array)==1 ) return array();
// Meta query // Meta query
$meta_query = array(); $meta_query = array();
$meta_query[] = $woocommerce->query->visibility_meta_query(); $meta_query[] = $woocommerce->query->visibility_meta_query();

View File

@ -85,6 +85,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
= 1.2.4 - 18/11/2011 = = 1.2.4 - 18/11/2011 =
* More sale price logic fixes for variations. Now correctly compares variation's prices. * More sale price logic fixes for variations. Now correctly compares variation's prices.
* Clear cache on upgrade/install * Clear cache on upgrade/install
* Related product fix when no categories are set
= 1.2.3 - 17/11/2011 = = 1.2.3 - 17/11/2011 =
* Fix for sale price logic * Fix for sale price logic