function uc_attribute_subject_option_save in Ubercart 7.3
Same name and namespace in other branches
- 8.4 uc_attribute/uc_attribute.module \uc_attribute_subject_option_save()
- 6.2 uc_attribute/uc_attribute.module \uc_attribute_subject_option_save()
Saves a product/class attribute option.
Parameters
&$option: The product/class attribute option.
string $type: Is this a product or a class?
int $id: The product/class ID.
Return value
int The integer result from drupal_write_record().
1 call to uc_attribute_subject_option_save()
- uc_attribute_subject_save in uc_attribute/
uc_attribute.module - Saves a product/class attribute.
File
- uc_attribute/
uc_attribute.module, line 991 - Ubercart Attribute module.
Code
function uc_attribute_subject_option_save(&$option, $type, $id) {
$sql = uc_attribute_type_info($type);
// Insert or update?
$key = uc_attribute_subject_option_exists($option->oid, $type, $id) ? array(
'oid',
$sql['id'],
) : array();
// Merge in the product/class attribute option's ID, and save.
$option->{$type == 'product' ? 'nid' : 'pcid'} = $id;
$result = drupal_write_record($sql['opt_table'], $option, $key);
return $result;
}