function commerce_registration_information_review in Commerce Registration 7.2
Same name and namespace in other branches
- 7.3 includes/commerce_registration.checkout_pane.inc \commerce_registration_information_review()
- 7 includes/commerce_registration.checkout_pane.inc \commerce_registration_information_review()
Commerce checkout pane review callback.
File
- includes/
commerce_registration.checkout_pane.inc, line 373 - 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);
$i = 0;
// Main counter for all the registrations
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 (commerce_registration_product_has_registration_field($id) && registration_status('commerce_product', $id, TRUE) == 1) {
$product = $line_item_wrapper->commerce_product;
$line_item_id = $line_item_wrapper->line_item_id
->value();
$quantity = (int) $line_item_wrapper->quantity
->value();
$msg .= '<em>' . $product->title
->value() . ' (' . format_plural($quantity, '1 registration', '@count registrations') . '):</em><br />';
for ($k = 0; $k < $quantity; $k++) {
$prodkey = $line_item_id . 'prod-' . $product->sku
->value();
$entity = $order->data['register_entities'][$prodkey][$i];
$l = $i + 1;
$reg_wrapper = entity_metadata_wrapper('registration', $entity);
$email = $reg_wrapper->mail
->value();
$msg .= "<hr><em><u>" . t("Registrant #@count", array(
'@count' => $l,
)) . "</u></em><br />";
$msg .= "<strong>" . t("Email") . "</strong>: " . check_plain($email) . "<br />";
$field_view = field_attach_view('registration', $entity, 'review_pane');
$msg .= drupal_render($field_view);
// Update the total registration counter
$i++;
}
}
}
return $msg;
}