You are here

function uc_cart_view_form_submit in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_cart/uc_cart.module \uc_cart_view_form_submit()
  2. 7.3 uc_cart/uc_cart.module \uc_cart_view_form_submit()

Default submit handler for uc_cart_view_form().

See also

uc_cart_view_form()

1 string reference to 'uc_cart_view_form_submit'
uc_cart_view_form in uc_cart/uc_cart.module
Displays a page allowing the customer to view the contents of his or her cart.

File

uc_cart/uc_cart.module, line 994

Code

function uc_cart_view_form_submit($form, &$form_state) {

  // Remove the cart order variable if the customer came here during checkout.
  if (isset($_SESSION['cart_order'])) {
    unset($_SESSION['cart_order']);
  }

  // If a remove button was clicked, set the quantity for that item to 0.
  if (substr($form_state['clicked_button']['#name'], 0, 7) == 'remove-') {
    $item = substr($form_state['clicked_button']['#name'], 7);
    $form_state['values']['items'][$item]['qty'] = 0;
    drupal_set_message(t('<strong>!product-title</strong> removed from your shopping cart.', array(
      '!product-title' => $form_state['values']['items'][$item]['title'],
    )));
  }

  // Update the items in the shopping cart based on the form values.
  uc_cart_update_item_object((object) $form_state['values']);
}