You are here

function uc_attribute_delete in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 uc_attribute/uc_attribute.module \uc_attribute_delete()
  2. 7.3 uc_attribute/uc_attribute.module \uc_attribute_delete()

Deletes an attribute from the database.

Parameters

$aid: Attribute ID to delete.

Return value

The Drupal SAVED_DELETED flag.

1 call to uc_attribute_delete()
UbercartAttributeTestCase::testAttributeAPI in uc_attribute/uc_attribute.test
Tests the basic attribute API.

File

uc_attribute/uc_attribute.module, line 824

Code

function uc_attribute_delete($aid) {

  // Delete the class attributes and their options.
  uc_attribute_subject_delete($aid, 'class');

  // Delete the product attributes and their options.
  uc_attribute_subject_delete($aid, 'product');

  // Delete base attributes and their options.
  db_query("DELETE FROM {uc_attribute_options} WHERE aid = %d", $aid);
  db_query("DELETE FROM {uc_attributes} WHERE aid = %d", $aid);
  return SAVED_DELETED;
}