function uc_cart_view in Ubercart 7.3
Same name and namespace in other branches
- 5 uc_cart/uc_cart.module \uc_cart_view()
- 6.2 uc_cart/uc_cart.pages.inc \uc_cart_view()
Displays the cart view page.
Show the products in the cart with a form to adjust cart contents or go to checkout.
1 string reference to 'uc_cart_view'
- uc_cart_menu in uc_cart/
uc_cart.module - Implements hook_menu().
File
- uc_cart/
uc_cart.pages.inc, line 14 - Cart menu items.
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 MENU_NOT_FOUND;
}
// Load the array of shopping cart items.
$items = uc_cart_get_contents();
// Display the empty cart page if there are no items in the cart.
if (empty($items)) {
return array(
'#theme' => 'uc_empty_cart',
);
}
$build = array();
// Load through the cart panes...
foreach (uc_cart_cart_pane_list($items) as $id => $pane) {
// If the pane is enabled...
if ($pane['enabled']) {
// Add its output to the cart view.
$build[$id] = $pane['body'];
}
}
// Add a custom cart breadcrumb if specified.
if (($text = variable_get('uc_cart_breadcrumb_text', '')) !== '') {
$link = l($text, variable_get('uc_cart_breadcrumb_url', '<front>'));
drupal_set_breadcrumb(array(
$link,
));
}
return $build;
}