function basic_cart_cart_form_submit in Basic cart 7.2
Same name and namespace in other branches
- 7.3 basic_cart.cart.inc \basic_cart_cart_form_submit()
- 7 basic_cart.cart.inc \basic_cart_cart_form_submit()
Shopping cart form.
File
- ./
basic_cart.cart.inc, line 73 - 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 ($form_state['values']['op'] == t('Checkout')) {
drupal_goto('checkout');
}
else {
drupal_set_message(t('Shopping cart updated.'));
}
}