=== modified file 'uc_order/uc_order.ca.inc'
--- uc_order/uc_order.ca.inc	2009-09-09 23:01:34 +0000
+++ uc_order/uc_order.ca.inc	2009-09-16 18:04:44 +0000
@@ -587,7 +587,7 @@
 function uc_order_condition_has_products($order, $settings) {
   $products = array();
   foreach ($order->products as $product) {
-    $products[] = $product->nid;
+    $products[] = $product->model;
   }
   $required = array_intersect($settings['products'], $products);
   if ($settings['required']) {
@@ -609,14 +609,14 @@
 /**
  * @see uc_order_condition_has_products()
  */
-function uc_order_condition_has_products_form($form_state, $settings = array('required' => 0, 'forbidden' => 0)) {
+function uc_order_condition_has_products_form($form_state, $settings) {
   $form['required'] = array('#type' => 'radios',
     '#title' => t('Require selected products'),
     '#options' => array(
       0 => t('Order has any of these products.'),
       1 => t('Order has all of these products.'),
     ),
-    '#default_value' => $settings['required'],
+    '#default_value' => isset($settings['required']) ? $settings['required'] : 0,
   );
   $form['forbidden'] = array('#type' => 'radios',
     '#title' => t('Forbid other products'),
@@ -624,15 +624,17 @@
       0 => t('Order may have other products.'),
       1 => t('Order has only these products.'),
     ),
-    '#default_value' => $settings['forbidden'],
+    '#default_value' => isset($settings['forbidden']) ? $settings['forbidden'] : 0,
   );
+
   $options = array();
-  $result = db_query("SELECT nid, model FROM {uc_products}");
+  $result = db_query("SELECT nid FROM {uc_products}");
   while ($product = db_fetch_object($result)) {
-    $options[$product->nid] = $product->model;
+    $options += uc_product_get_models(node_load($product->nid), FALSE);
   }
+
   $form['products'] = array('#type' => 'select',
-    '#title' => t('Products'),
+    '#title' => t('Product models'),
     '#options' => $options,
     '#default_value' => $settings['products'],
     '#multiple' => TRUE,

=== modified file 'uc_order/uc_order.install'
--- uc_order/uc_order.install	2009-08-18 16:18:33 +0000
+++ uc_order/uc_order.install	2009-09-16 18:04:44 +0000
@@ -1065,3 +1065,63 @@
   return $ret;
 }
 
+/**
+ * Convert the settings for the uc_order_condition_has_products to models.
+ */
+function uc_order_update_6013() {
+  $ret = array();
+
+  $models = array();
+  $count = 0;
+
+  $result = db_query("SELECT pid, conditions FROM {ca_predicates} WHERE conditions LIKE '%%uc_order_condition_has_products%%'");
+  while ($predicate = db_fetch_object($result)) {
+    $conditions = unserialize($predicate->conditions);
+
+    $save = uc_order_6013_condition_helper($conditions['#conditions'], $predicate->pid);
+
+    if ($save) {
+      db_query("UPDATE {ca_predicates} SET conditions = '%s' WHERE pid = '%s'", serialize($conditions), $predicate->pid);
+      $count++;
+    }
+  }
+
+  $t = get_t();
+  $ret[] = array('success' => TRUE, 'query' => $t('Fixed %count predicates with the condition "uc_order_condition_has_products".', array('%count' => $count)));
+
+  return $ret;
+}
+
+function uc_order_6013_condition_helper(&$conditions, $pid, $save = FALSE) {
+  foreach ($conditions as $key => &$condition) {
+    if (isset($condition['#conditions'])) {
+      $save = uc_order_6013_condition_helper($condition['#conditions'], $pid, $save);
+    }
+    else {
+      if ($condition['#name'] == 'uc_order_condition_has_products' && isset($condition['#settings']['products'])) {
+        $save = TRUE;
+        $products = array();
+
+        foreach ($condition['#settings']['products'] as $x => $nid) {
+          // The "Any" setting will be an empty string.
+          if (is_numeric($nid)) {
+            if (!isset($models[$nid])) {
+              // Get the latest revision's model.
+              $models[$nid] = db_result(db_query("SELECT p.model FROM {uc_products} AS p LEFT JOIN {node} AS n ON n.vid = p.vid WHERE n.nid = %d", $nid));
+            }
+
+            $model = $models[$nid];
+          }
+          else {
+            $model = $nid;
+          }
+
+          $condition['#settings']['products'][$x] = $model;
+        }
+      }
+    }
+  }
+
+  return $save;
+}
+

=== modified file 'uc_product/uc_product.module'
--- uc_product/uc_product.module	2009-09-16 15:37:14 +0000
+++ uc_product/uc_product.module	2009-09-16 18:04:45 +0000
@@ -1687,13 +1687,19 @@
 /**
  * Get all models of a product (node).
  *
+ * Gather any modules' models on this node, then add the node's SKU and the
+ * optional 'Any' option.
+ *
  * @param $nid
  *   The node ID of the product.
- *
- * Add the generic 'Any' option and the node SKU, then gather any modules'
- * models on this node.
+ * @param $add_blank
+ *   String to use for the initial blank entry. If not desired, set to NULL
+ *   or FALSE. Make sure to localize the string first. Defaults to '- Any -'.
+ * @return
+ *   An associative array of model numbers. The key for '- Any -' is the empty
+ *   string.
  */
-function uc_product_get_models($node) {
+function uc_product_get_models($node, $add_blank = TRUE) {
   // Get any modules' SKUs on this node.
   $models = module_invoke_all('uc_product_models', $node);
   // Add the base SKU of the node.
@@ -1705,7 +1711,14 @@
   asort($models);
 
   // And finally, we prepend 'Any' so it's the first option.
-  return array(NULL => 'Any') + $models;
+  if (!empty($add_blank) || $add_blank === '') {
+    if ($add_blank === TRUE) {
+      $add_blank = t('- Any -');
+    }
+    return array('' => $add_blank) + $models;
+  }
+
+  return $models;
 }
 
 /**

