You are here

function basic_cart_cart_form_submit in Basic cart 7.3

Same name and namespace in other branches
  1. 7 basic_cart.cart.inc \basic_cart_cart_form_submit()
  2. 7.2 basic_cart.cart.inc \basic_cart_cart_form_submit()

Shopping cart form.

File

./basic_cart.cart.inc, line 76
Basic cart shopping cart implementation functions.

Code

function basic_cart_cart_form_submit($form_id, $form_state) {
  foreach ($form_state['values']['cartcontents'] as $nid => $value) {
    $quantity = (int) $value;
    if ($quantity > 0) {
      $_SESSION['basic_cart']['cart'][$nid]->basic_cart_quantity = $quantity;
    }
    elseif ($quantity == 0) {
      unset($_SESSION['basic_cart']['cart'][$nid]);
    }
  }
  if (module_exists('basic_cart_order') && $form_state['values']['op'] == t('Checkout')) {
    drupal_goto('checkout');
  }
  else {
    drupal_set_message(t('Shopping cart updated.'));
  }
}