function uc_attribute_subject_option_load in Ubercart 7.3
Same name and namespace in other branches
- 8.4 uc_attribute/uc_attribute.module \uc_attribute_subject_option_load()
- 6.2 uc_attribute/uc_attribute.module \uc_attribute_subject_option_load()
Loads a product/class attribute option.
Parameters
int $oid: The product/class attribute option ID.
string $type: Is this a product or a class?
int $id: The product/class ID.
Return value
object An object containing the product/class attribute option.
1 call to uc_attribute_subject_option_load()
- UbercartAttributeTestCase::testAttributeUIClassAttributeOptionOverview in uc_attribute/
tests/ uc_attribute.test - Tests the product class attribute option user interface.
File
- uc_attribute/
uc_attribute.module, line 963 - Ubercart Attribute module.
Code
function uc_attribute_subject_option_load($oid, $type, $id) {
$sql = uc_attribute_type_info($type);
$query = db_select($sql['opt_table'], 'po');
$query
->leftJoin('uc_attribute_options', 'ao', 'po.oid = ao.oid');
$query
->fields('po', array(
$sql['id'],
'oid',
'cost',
'price',
'weight',
'ordering',
))
->fields('ao', array(
'name',
'aid',
))
->condition('po.oid', $oid)
->condition("po.{$sql['id']}", $id)
->orderBy('po.ordering')
->orderBy('ao.name');
return $query
->execute()
->fetchObject();
}