uc_order_edit_products_remove

  1. drupal
    1. 7 uc_order.order_pane.inc function
Drupal 7 uc_order_edit_products_remove($form, &$form_state)

Form submit callback: remove a product from an order.

1 string reference to 'uc_order_edit_products_remove'

File

sites/all/modules/ubercart/uc_order/uc_order.order_pane.inc, line 566
This file contains the callbacks for the default order panes supplied with Ubercart and their corresponding helper functions.

Code

function uc_order_edit_products_remove($form, &$form_state) {
  $form_state['refresh_products'] = TRUE;

  $order_product_id = intval($form_state['triggering_element']['#return_value']);

  uc_order_product_delete($order_product_id);

  $order = $form_state['build_info']['args'][0];
  $matches = array();
  preg_match('/products\[(\d+)\]/', $form_state['triggering_element']['#name'], $matches);
  $key = $matches[1];

  unset($order->products[$key]);
  $order->products = array_values($order->products);
}