You are here

function uc_cart_view in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_cart/uc_cart.pages.inc \uc_cart_view()
  2. 7.3 uc_cart/uc_cart.pages.inc \uc_cart_view()
1 string reference to 'uc_cart_view'
uc_cart_menu in uc_cart/uc_cart.module
Implementation of hook_menu().

File

uc_cart/uc_cart.module, line 1149

Code

function uc_cart_view() {

  // Failsafe so that this function only works when called with no arguments.
  // This prevents the accidental wiping of the cart_order session variable.
  if (func_num_args() > 0) {
    return drupal_not_found();
  }
  if (!empty($_SESSION['cart_order'])) {
    unset($_SESSION['cart_order']);
  }
  $items = uc_cart_get_contents();
  if (empty($items)) {
    return theme('uc_empty_cart');
  }
  $panes = uc_cart_cart_pane_list($items);
  foreach ($panes as $pane) {
    if ($pane['enabled']) {
      $output .= $pane['body'];
    }
  }
  if (isset($_SESSION['last_url'])) {
    drupal_set_breadcrumb(array(
      l(t('Back'), check_plain($_SESSION['last_url'])),
    ));
    unset($_SESSION['last_url']);
  }
  else {
    if (($text = variable_get('uc_cart_breadcrumb_text', t('Home'))) !== '') {
      $link = l($text, variable_get('uc_cart_breadcrumb_url', '<front>'));
      drupal_set_breadcrumb(array(
        $link,
      ));
    }
  }
  return $output;
}