You are here

function uc_attribute_subject_option_exists in Ubercart 7.3

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.module \uc_attribute_subject_option_exists()

Checks if a product/class attribute option exists.

Parameters

int $oid: The base attribute option ID.

int $id: The product/class attribute option's ID.

string $type: Is this a product or a class?

Return value

bool TRUE if the attribute option exists.

1 call to uc_attribute_subject_option_exists()
uc_attribute_subject_option_save in uc_attribute/uc_attribute.module
Saves a product/class attribute option.

File

uc_attribute/uc_attribute.module, line 1119
Ubercart Attribute module.

Code

function uc_attribute_subject_option_exists($oid, $type, $id) {
  $sql = uc_attribute_type_info($type);
  $query = db_select($sql['opt_table'], 'o')
    ->fields('o', array(
    'oid',
  ))
    ->condition('oid', $oid)
    ->condition($sql['id'], $id);
  return FALSE !== $query
    ->execute()
    ->fetchField();
}