You are here

function uc_attribute_delete_confirm_submit in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.admin.inc \uc_attribute_delete_confirm_submit()
  2. 7.3 uc_attribute/uc_attribute.admin.inc \uc_attribute_delete_confirm_submit()

File

uc_attribute/uc_attribute.module, line 537

Code

function uc_attribute_delete_confirm_submit($form_id, $form_values) {
  if ($form_values['confirm']) {
    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.aid = %d)", $form_values['aid']);
    db_query("DELETE FROM {uc_class_attributes} WHERE aid = %d", $form_values['aid']);
    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.aid = %d)", $form_values['aid']);
    db_query("DELETE FROM {uc_product_adjustments} WHERE EXISTS (SELECT * FROM {uc_product_attributes} AS pa WHERE {uc_product_adjustments}.nid = pa.nid AND pa.aid = %d)", $form_values['aid']);
    db_query("DELETE FROM {uc_product_attributes} WHERE aid = %d", $form_values['aid']);
    db_query("DELETE FROM {uc_attribute_options} WHERE aid = %d", $form_values['aid']);
    db_query("DELETE FROM {uc_attributes} WHERE aid = %d", $form_values['aid']);
    drupal_set_message(t('Product attribute deleted.'));
  }
}