You are here

function uc_product_update_6005 in Ubercart 6.2

Sets the uc_image setting to field_image_cache for all existing products.

File

uc_product/uc_product.install, line 319
Install, update and uninstall functions for the uc_product module.

Code

function uc_product_update_6005() {
  $ret = array();
  if (db_table_exists('content_node_field_instance')) {
    $result = db_query("SELECT type_name FROM {content_node_field_instance} WHERE field_name = 'field_image_cache'");
    while ($class = db_fetch_object($result)) {
      variable_set('uc_image_' . $class->type_name, 'field_image_cache');
    }
    $t = get_t();
    $ret[] = array(
      'success' => TRUE,
      $t('field_image_cache set as the Ubercart image for products and product classes.'),
    );
  }
  return $ret;
}