You are here

function uc_checkout_pane_cart in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_cart/uc_cart_checkout_pane.inc \uc_checkout_pane_cart()
  2. 7.3 uc_cart/uc_cart_checkout_pane.inc \uc_checkout_pane_cart()

Display the cart contents for review during checkout.

2 string references to 'uc_checkout_pane_cart'
hook_checkout_pane in docs/hooks.php
Register callbacks for a checkout pane.
uc_cart_checkout_pane in uc_cart/uc_cart.module
Implementation of hook_checkout_pane().

File

uc_cart/uc_cart_checkout_pane.inc, line 17
This file contains the callbacks for the default checkout panes supplied with Ubercart and their corresponding helper functions.

Code

function uc_checkout_pane_cart($op) {
  switch ($op) {
    case 'view':
      $contents['cart_review_table'] = array(
        '#value' => theme('cart_review_table'),
        '#weight' => variable_get('uc_pane_cart_field_cart_weight', 2),
      );
      return array(
        'contents' => $contents,
        'next-button' => FALSE,
      );
    case 'review':
      $items = uc_cart_get_contents();
      $output = '<table>';
      foreach ($items as $item) {
        $rows = array();
        foreach ($item->options as $option) {
          $rows[] = t('@attribute: @option', array(
            '@attribute' => $option['attribute'],
            '@option' => $option['name'],
          ));
        }
        $desc = check_plain($item->title) . theme('item_list', $rows, NULL, 'ul', array(
          'class' => 'product-options',
        ));
        $output .= '<tr valign="top"><td>' . $item->qty . 'x</td><td width="100%">' . $desc . '</td><td nowrap="nowrap">' . uc_currency_format($item->price * $item->qty) . '</td></tr>';
      }
      $output .= '</table>';
      $review[] = $output;
      return $review;
  }
}