You are here

function uc_order_edit_products_add_blank in Ubercart 7.3

Form submit callback: add a blank line product to an order.

1 string reference to 'uc_order_edit_products_add_blank'
uc_order_pane_products in uc_order/uc_order.order_pane.inc
Handles the "Products" order pane.

File

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

Code

function uc_order_edit_products_add_blank($form, &$form_state) {
  $form_state['refresh_products'] = TRUE;
  $form_state['rebuild'] = TRUE;
  $order = $form_state['build_info']['args'][0];
  $product = new stdClass();
  $product->qty = 1;
  $product->order_id = $order->order_id;
  $product->data = NULL;
  uc_order_product_save($order->order_id, $product);
  $order->products[] = $product;
  uc_order_log_changes($order->order_id, array(
    'add' => t('Added new product line to order.'),
  ));
}