You are here

function commerce_registration_information_review in Commerce Registration 7

Same name and namespace in other branches
  1. 7.3 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 192
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) {
    $type = $line_item_wrapper->commerce_product->type
      ->value();
    $can_register = registration_entity_registration_status(array(
      'id' => $line_item_wrapper->commerce_product->product_id
        ->value(),
      'type' => 'commerce_product',
      'bundle' => $type,
    ));
    if ($can_register == 1) {
      $product = $line_item_wrapper->commerce_product;
      $quantity = (int) $line_item_wrapper->quantity
        ->value();
      $msg .= '<em>' . $product->title
        ->value() . ' (' . format_plural($quantity, '1 registration', '@count registrations') . '):</em><br />';
      $msg .= t('');
      for ($i = 0; $i < $quantity; $i++) {
        $entity = $order->data['register_entities']['prod-' . $product->sku
          ->value()][$i];
        $l = $i + 1;
        $msg .= t("<hr><em><u>Registrant #@count</u></em><br />", array(
          '@count' => $l,
        ));
        $msg .= t("<strong>Email</strong>: @email", array(
          '@email' => $entity->mail,
        )) . "<br />";
        $msg .= drupal_render(field_attach_view('registration', $entity, 'full'));
      }
    }
  }
  return $msg;
}