function commerce_option_load_by_line_item in Commerce Product Option 7
Same name and namespace in other branches
- 7.2 commerce_option.module \commerce_option_load_by_line_item()
Load all options associated with the line item.
Parameters
$line_item_id: Line item id.
Return value
Array of options
2 calls to commerce_option_load_by_line_item()
- commerce_option_attribute_field in ./
commerce_option.module - Implements hook_attribute_field()
- commerce_option_set_reference_form_alter in option_set_reference/
commerce_option_set_reference.module - Implementation of hook_form_alter()
File
- ./
commerce_option.module, line 180
Code
function commerce_option_load_by_line_item($line_item_id) {
$options = db_select('commerce_option', 'o')
->fields('o', array(
'option_id',
))
->condition('line_item_id', $line_item_id, '=')
->execute();
$option_ids = array();
foreach ($options as $option) {
$option_ids[] = $option->option_id;
}
return commerce_option_load_multiple($option_ids);
}