From ec50a48f8187dc324c491170c68f074a843b0db3 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 18 Nov 2011 01:07:05 +0000 Subject: [PATCH] Related product fix when no categories are set --- classes/product.class.php | 4 ++++ readme.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/classes/product.class.php b/classes/product.class.php index c57863eccdc..3e4ba20fe7c 100644 --- a/classes/product.class.php +++ b/classes/product.class.php @@ -670,9 +670,13 @@ class woocommerce_product { $terms = wp_get_post_terms($this->id, 'product_tag'); foreach ($terms as $term) $tags_array[] = $term->term_id; + // Get categories $terms = wp_get_post_terms($this->id, 'product_cat'); 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 = array(); $meta_query[] = $woocommerce->query->visibility_meta_query(); diff --git a/readme.txt b/readme.txt index 0f53913c535..63414403c06 100644 --- a/readme.txt +++ b/readme.txt @@ -85,6 +85,7 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo = 1.2.4 - 18/11/2011 = * More sale price logic fixes for variations. Now correctly compares variation's prices. * Clear cache on upgrade/install +* Related product fix when no categories are set = 1.2.3 - 17/11/2011 = * Fix for sale price logic