You are here

function uc_attribute_option_delete_confirm_submit in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_attribute/uc_attribute.module \uc_attribute_option_delete_confirm_submit()
  2. 7.3 uc_attribute/uc_attribute.admin.inc \uc_attribute_option_delete_confirm_submit()

Form submission handler for uc_attribute_option_delete_confirm().

See also

uc_attribute_option_delete_confirm()

File

uc_attribute/uc_attribute.admin.inc, line 637
Attribute administration menu items.

Code

function uc_attribute_option_delete_confirm_submit($form, &$form_state) {
  if ($form_state['values']['confirm']) {
    $match = 'i:' . $form_state['values']['aid'] . ';s:' . strlen($form_state['values']['oid']) . ':"' . $form_state['values']['oid'] . '";';
    db_query("DELETE FROM {uc_product_adjustments} WHERE combination LIKE '%%%s%%'", $match);
    db_query("DELETE FROM {uc_class_attribute_options} WHERE EXISTS (SELECT * FROM {uc_attribute_options} AS ao WHERE {uc_class_attribute_options}.oid = ao.oid AND ao.oid = %d)", $form_state['values']['oid']);
    db_query("DELETE FROM {uc_product_options} WHERE EXISTS (SELECT * FROM {uc_attribute_options} AS ao WHERE {uc_product_options}.oid = ao.oid AND ao.oid = %d)", $form_state['values']['oid']);
    db_query("DELETE FROM {uc_attribute_options} WHERE oid = %d", $form_state['values']['oid']);
  }
  $form_state['redirect'] = 'admin/store/attributes/' . $form_state['values']['aid'] . '/options';
}