--- uc_option_image.module 2011-07-01 08:55:40.000000000 -0700 +++ uc_option_image.corrected.module 2011-07-11 11:09:10.111888400 -0700 @@ -152,6 +152,11 @@ function uc_option_image_form_alter(&$fo '#size' => 8, '#default_value' => $file->filename, ); + if ($file->filename != 'option_image_0_0_0') { + $form['attributes'][$aid]['options'][$oid]['remove'] = array( + '#type' => 'checkbox', + ); + } } } } @@ -522,7 +527,12 @@ function uc_option_image_uc_object_optio foreach ($aids as $aid) { if ($oids = element_children($form_state['values']['attributes'][$aid]['options'])) { foreach ($oids as $oid) { - uc_option_image_save($form_state['values']['id'], $aid, $oid); + if ($form_state['values']['attributes'][$aid]['options'][$oid]['remove']) { + uc_option_image_delete($form_state['values']['id'], $aid, $oid); + } + else { + uc_option_image_save($form_state['values']['id'], $aid, $oid); + } } } } @@ -730,7 +740,7 @@ function uc_option_image_get_cart_pictur * Add our image fields to the table. */ function phptemplate_uc_object_options_form($form) { - $header = array(t('Attribute'), t('Options'), t('Default'), t('Cost'), t('Price'), t('Weight'), t('Order'), t('Image'), t('Preview')); + $header = array(t('Attribute'), t('Options'), t('Default'), t('Cost'), t('Price'), t('Weight'), t('Order'), t('Image'), t('Preview'), t('Remove')); foreach (element_children($form['attributes']) as $key) { $row = array(); @@ -748,10 +758,11 @@ function phptemplate_uc_object_options_f // MOD: added the image field and preview $row[] = drupal_render($form['attributes'][$key]['options'][$oid][uc_option_image_id(arg(1), $key, $oid)]); $row[] = drupal_render($form['attributes'][$key]['options'][$oid]['option_image_preview']); + $row[] = drupal_render($form['attributes'][$key]['options'][$oid]['remove']); if (!$first) { - // MOD: changed from -7 to -9 to accomidate the new columns - $row = array_pad($row, -9, ''); + // MOD: changed from -7 to -10 to accomidate the new columns + $row = array_pad($row, -10, ''); } else { $first = FALSE;