You are here

function commerce_registration_order_has_registration in Commerce Registration 7

Same name and namespace in other branches
  1. 7.2 commerce_registration.rules.inc \commerce_registration_order_has_registration()

Condition callback.

Checks the commerce line item to see if the product is register enabled.

Parameters

$line_item: The Commerce Line Item to check for a register enabled product.

Return value

Boolean TRUE if the line item product is register enabled.

Related topics

1 string reference to 'commerce_registration_order_has_registration'
commerce_registration_rules_condition_info in ./commerce_registration.rules.inc
Implements hook_rules_condition_info().

File

./commerce_registration.rules.inc, line 215
Commerce Registration rules file.

Code

function commerce_registration_order_has_registration($line_item) {
  $line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
  $type = $line_item_wrapper->commerce_product->type
    ->value();
  $id = $line_item_wrapper->commerce_product->product_id
    ->value();
  $can_register = registration_entity_registration_status(array(
    'id' => $id,
    'type' => 'commerce_product',
    'bundle' => $type,
  ));
  if ($can_register == 1) {
    return TRUE;
  }
  return FALSE;
}