Index: uc_advanced_catalog.filters.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_advanced_catalog/uc_advanced_catalog.filters.inc,v
retrieving revision 1.1.4.2
diff -u -r1.1.4.2 uc_advanced_catalog.filters.inc
--- uc_advanced_catalog.filters.inc	4 Jan 2011 11:01:38 -0000	1.1.4.2
+++ uc_advanced_catalog.filters.inc	28 Jan 2011 17:59:08 -0000
@@ -13,8 +13,8 @@
 /**
  * Advanced catalog core filters
  *
- * The uc_advanced catalog module comes with a filter manager found at Administer »
- * Store administration » Settings » Advanced Catalog settings.
+ * The uc_advanced catalog module comes with a filter manager found at Administer ï¿½
+ * Store administration ï¿½ Settings ï¿½ Advanced Catalog settings.
  *
  * @param $defaults
  *   Array of defaults or current user settings as $key => $value.
@@ -463,14 +463,26 @@
 /*
  * code from http://api.drupal.org/node/10372#comment-1623
  */
-function uc_advanced_catalog_taxonomy_get_tree($vocabulary_id) {
-  $tree = taxonomy_get_tree($vocabulary_id);
+function uc_advanced_catalog_taxonomy_get_tree($vocabulary_id) {  
   $options['all'] = t('All');
-  if ($tree) {
-    foreach ($tree as $term) {
-      $options[$term->tid] = str_repeat('-', $term->depth) . $term->name;
-    }
+  
+  // Get list of NID for catalog category    
+  $result = db_query("
+    SELECT DISTINCT(n.nid)
+    FROM node n 
+    INNER JOIN term_node tn 
+    ON n.vid = tn.vid 
+    WHERE tn.tid = %d AND n.status = 1", arg(1));
+
+  // Build option list for filter using nodes contained in the current catalog page
+  while ($data = db_fetch_object($result)){
+    $node = node_load($data->nid);
+    $terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary_id, 'tid');
+    $terms = current($terms);
+    $options[$terms->tid] = $terms->name;
   }
+  asort($options); 
+  
   return $options;
 }
 
Index: uc_advanced_catalog.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_advanced_catalog/uc_advanced_catalog.pages.inc,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 uc_advanced_catalog.pages.inc
--- uc_advanced_catalog.pages.inc	10 Jan 2011 10:29:06 -0000	1.1.2.5
+++ uc_advanced_catalog.pages.inc	28 Jan 2011 17:59:09 -0000
@@ -95,6 +95,23 @@
 
   // Get products list
   $products = uc_advanced_catalog_products($catalog, $defaults, $types, $links);
+  
+  // If Product page is empty then reset taxonomy filters 
+  if (!$products)
+  {
+    $type = 'product';
+    // get taxonomy list
+    $vocabularies = taxonomy_get_vocabularies($type);
+    // remove main vocabulary (used as navigation !)
+    $catalog_vid = variable_get('uc_catalog_vid', NULL);
+    unset($vocabularies[$catalog_vid]);
+    foreach ($vocabularies as $vocabulary) {
+      $defaults['taxonomy_'. $vocabulary->vid] = 'All';
+    }    
+    // Now try again to Get products list
+    $products = uc_advanced_catalog_products($catalog, $defaults, $types, $links);    
+  }
+  
   if ($products) {
     $output .= $products;
   }
