You are here

function uc_dropdown_attributes_dependency_type in Dropdown Attributes 6

Same name and namespace in other branches
  1. 8 uc_dropdown_attributes.module \uc_dropdown_attributes_dependency_type()
  2. 7 uc_dropdown_attributes.module \uc_dropdown_attributes_dependency_type()

Retrieve whether dependencies are defined by node or class.

5 calls to uc_dropdown_attributes_dependency_type()
DropdownAttributeTestCase::testClassAttributeDependency in tests/uc_dropdown_attributes.test
Tests for dropdown attributes in product classes.
DropdownAttributeTestCase::testProductAttributeDependency in tests/uc_dropdown_attributes.test
Tests for dropdown attributes in products.
uc_dropdown_attributes_dependency in ./uc_dropdown_attributes.module
Retrieves the attribute dependencies.
uc_dropdown_attributes_form_alter in ./uc_dropdown_attributes.module
Implements hook_form_alter().
uc_dropdown_attributes_product in ./dependent_dropdown.inc
Specify the attribute dependencies.

File

./uc_dropdown_attributes.module, line 408
Show/hide attributes based on the values of other attributes.

Code

function uc_dropdown_attributes_dependency_type($nid) {
  $sql = 'SELECT COUNT(*) FROM {uc_dropdown_attributes} WHERE nid=%d';
  $count = db_result(db_query($sql, $nid));
  if ($count > 0) {
    return 'node';
  }
  $pcid = uc_dropdown_attributes_get_type($nid);
  $sql = 'SELECT COUNT(*) FROM {uc_dropdown_classes} WHERE pcid="%s"';
  $count = db_result(db_query($sql, $pcid));
  if ($count > 0) {
    return 'class';
  }
  return NULL;
}