You are here

function uc_shipping_package_edit_submit in Ubercart 6.2

Same name and namespace in other branches
  1. 5 shipping/uc_shipping/uc_shipping.module \uc_shipping_package_edit_submit()
  2. 7.3 shipping/uc_shipping/uc_shipping.admin.inc \uc_shipping_package_edit_submit()

Submit handler for uc_shipping_package_edit().

See also

uc_shipping_package_edit()

File

shipping/uc_shipping/uc_shipping.admin.inc, line 337
Shipping administration menu items.

Code

function uc_shipping_package_edit_submit($form, &$form_state) {
  $package = uc_shipping_package_load($form_state['values']['package_id']);
  foreach ($form_state['values']['products'] as $id => $product) {
    if ($product['checked']) {
      $package->products[$id] = (object) $product;
    }
    else {
      unset($package->products[$id]);
    }
  }
  $package->shipping_type = $form_state['values']['shipping_type'];
  uc_shipping_package_save($package);
  $form_state['redirect'] = 'admin/store/orders/' . $package->order_id . '/packages';
}