You are here

function commerce_registration_information_review in Commerce Registration 7.3

Same name and namespace in other branches
  1. 7 includes/commerce_registration.checkout_pane.inc \commerce_registration_information_review()
  2. 7.2 includes/commerce_registration.checkout_pane.inc \commerce_registration_information_review()

Commerce checkout pane review callback.

File

includes/commerce_registration.checkout_pane.inc, line 480
Checkout pane callback functions.

Code

function commerce_registration_information_review($form, $form_state, $checkout_pane, $order) {
  $msg = '';
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
  foreach ($order_wrapper->commerce_line_items as $delta => $line_item_wrapper) {
    if (!in_array($line_item_wrapper->type
      ->value(), commerce_product_line_item_types())) {
      continue;
    }
    $id = (int) $line_item_wrapper->commerce_product->product_id
      ->value();
    if (registration_status('commerce_product', $id, TRUE) == 1) {
      $product = $line_item_wrapper->commerce_product;

      // Registration objects are stored as a serialized string in the database,
      // so we need to unserialize it to get the full registration object.
      $registrations = $line_item_wrapper->registrations
        ->value();
      if (!is_array($registrations)) {
        $registrations = unserialize($registrations);
      }
      $variables = array(
        'line_item' => $line_item_wrapper,
        'registrations' => $registrations,
        'product' => $product,
      );
      $msg .= theme('commerce_registration_review_pane', $variables);
    }
  }
  return $msg;
}