function commerce_registration_product_has_registration_field in Commerce Registration 7.3
Same name and namespace in other branches
- 7.2 commerce_registration.module \commerce_registration_product_has_registration_field()
Checks if a product has a registration field attached.
Parameters
int $product_id The product id.:
Return value
boolean Whether a product has a registration field attached.
5 calls to commerce_registration_product_has_registration_field()
- commerce_registration_commerce_checkout_complete in ./
commerce_registration.module - Implements hook_commerce_checkout_complete().
- commerce_registration_information_checkout_form in includes/
commerce_registration.checkout_pane.inc - Commerce checkout pane form builder callback. @TODO: don't create registration objects if the host entity isn't allowing registrations.
- commerce_registration_line_item_is_registration in ./
commerce_registration.rules.inc - Condition callback.
- commerce_registration_product_title in ./
commerce_registration.module - Product title line item callback.
- commerce_registration_update_line_item_registrations in ./
commerce_registration.module - Delete any 'unused' registrations on all line items on the order. An 'unused' registration is any registration data that doesn't belong to a specific product quantity, ie: if there are 5 registrations, but the line item only…
File
- ./
commerce_registration.module, line 326 - Commerce Registration module code.
Code
function commerce_registration_product_has_registration_field($product_id) {
$product = commerce_product_load($product_id);
$fields = field_read_fields(array(
'type' => 'registration',
));
foreach ($fields as $field) {
if (isset($product->{$field['field_name']}) && !empty($product->{$field['field_name']}[LANGUAGE_NONE]['0']['registration_type'])) {
return TRUE;
}
}
return FALSE;
}