=== modified file 'uc_product/uc_product.admin.inc'
--- uc_product/uc_product.admin.inc	2009-01-02 16:03:40 +0000
+++ uc_product/uc_product.admin.inc	2009-01-05 22:15:19 +0000
@@ -498,7 +498,7 @@
  *   at least one action.
  * @see uc_product_store_status()
  */
-function uc_product_image_defaults() {
+function uc_product_image_defaults($redirect = TRUE) {
   uc_product_add_default_image_field();
 
   $presets = array('product', 'product_list', 'uc_thumbnail');
@@ -554,7 +554,9 @@
       imagecache_action_save($action);
     }
   }
-  drupal_goto('admin/store');
+  if ($redirect) {
+    drupal_goto('admin/store');
+  }
 }
 
 /**

=== modified file 'uc_product/uc_product.install'
--- uc_product/uc_product.install	2008-12-03 19:11:21 +0000
+++ uc_product/uc_product.install	2009-01-05 20:19:33 +0000
@@ -522,3 +522,56 @@
 
   return $ret;
 }
+
+function uc_product_update_6004() {
+  $ret = array();
+
+  if (!module_exists('filefield') || !module_exists('imagecache')) {
+    $ret = array('success' => TRUE, 'query' => 'FileField or ImageCache not detected, skipping preset update');
+  }
+  else {
+    module_load_include('inc', 'content', 'includes/content.crud');
+    // Check for filefields on products.
+    $instances = content_field_instance_read(array('field_name' => 'field_image_cache', 'type_name' => 'product'));
+    $field_check = (bool) count($instances);
+
+    $presets = array('product', 'product_list', 'uc_thumbnail');
+    if (module_exists('uc_catalog')) {
+      $presets[] = 'uc_category';
+    }
+    if (module_exists('uc_cart')) {
+      $presets[] = 'cart';
+    }
+    if (module_exists('uc_manufacturer')) {
+      $presets[] = 'manufacturer';
+    }
+    sort($presets);
+
+    $preset_check = 1;
+    $action_check = 1;
+    foreach ($presets as $preset_name) {
+      $preset = imagecache_preset_by_name($preset_name);
+      if (empty($preset)) {
+        $preset_check = 0;
+        $action_check = 0;
+        break;
+      }
+      else {
+        $actions = imagecache_preset_actions($preset);
+        if (empty($actions)) {
+          $action_check = 0;
+          break;
+        }
+      }
+    }
+
+    if ($field_check && $preset_check && $action_check) {
+      $ret[] = array('success' => TRUE, 'query' => 'Product image support has previously been automatically configured by Ubercart.');
+    }
+    else {
+      uc_product_image_defaults(array(), FALSE);
+      $ret[] = array('success' => TRUE, 'query' => 'Product image support has been automatically configured by Ubercart.');
+    }
+  }
+  return $ret;
+}

=== modified file 'uc_product/uc_product.module'
--- uc_product/uc_product.module	2009-01-02 15:02:45 +0000
+++ uc_product/uc_product.module	2009-01-05 22:13:49 +0000
@@ -1778,7 +1778,9 @@
   }
   foreach ($types as $type) {
     $field['type_name'] = $type;
-    $instances = content_field_instance_read(array('field_name' => 'field_image_cache', 'type_name' => $type));
+    
+    // Include any inactive instances.
+    $instances = content_field_instance_read(array('field_name' => 'field_image_cache', 'type_name' => $type), TRUE);
     if (sizeof($instances) < 1) {
       // Only add the field if it doesn't exist. Don't overwrite any changes.
       if (content_field_instance_create($field)) {
@@ -1788,6 +1790,18 @@
         drupal_set_message(t('There was a problem creating field %label.', array('%label' => $label)));
       }
     }
+    
+    // Check for any inactive ones, and set them to active.
+    else {
+      if (!$instances[0]['widget_active']) {
+        $instances[0]['widget_active'] = TRUE;
+        
+        // This won't work through the normal content_field_instance_update() call, because
+        // there's no way to propagate the $include_inactive parameter to the content_field_instance_read()
+        // call used internally, as I have caled it above. So, it's internal API time.
+        _content_field_instance_write($instances[0], 'update');
+      }
+    }
   }
 }
 

