You are here

function commerce_cart_menu in Commerce Core 7

Implements hook_menu().

File

modules/cart/commerce_cart.module, line 23
Implements the shopping cart system and add to cart features.

Code

function commerce_cart_menu() {
  $items = array();
  $items['cart'] = array(
    'title' => 'Shopping cart',
    'page callback' => 'commerce_cart_view',
    'access arguments' => array(
      'access content',
    ),
    'file' => 'includes/commerce_cart.pages.inc',
  );
  $items['cart/my'] = array(
    'title' => 'Shopping cart (# items)',
    'title callback' => 'commerce_cart_menu_item_title',
    'title arguments' => array(
      TRUE,
    ),
    'page callback' => 'commerce_cart_menu_item_redirect',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_SUGGESTED_ITEM,
  );
  $items['checkout'] = array(
    'title' => 'Checkout',
    'page callback' => 'commerce_cart_checkout_router',
    'access arguments' => array(
      'access checkout',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/commerce_cart.pages.inc',
  );

  // If the Order UI module is installed, add a local action to it that lets an
  // administrator execute a cart order refresh on the order. Modules that
  // define their own order edit menu item are also responsible for defining
  // their own local action menu items if needed.
  if (module_exists('commerce_order_ui')) {
    $items['admin/commerce/orders/%commerce_order/edit/refresh'] = array(
      'title' => 'Apply pricing rules',
      'description' => 'Executes the cart order refresh used to apply all current pricing rules on the front end.',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'commerce_cart_order_refresh_form',
        3,
      ),
      'access callback' => 'commerce_cart_order_refresh_form_access',
      'access arguments' => array(
        3,
      ),
      'type' => MENU_LOCAL_ACTION,
      'file' => 'includes/commerce_cart.admin.inc',
    );
  }
  return $items;
}