You are here

function uc_shipping_package_edit_submit in Ubercart 5

Same name and namespace in other branches
  1. 6.2 shipping/uc_shipping/uc_shipping.admin.inc \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().

File

shipping/uc_shipping/uc_shipping.module, line 510
Organizes ordered products into packages and sets them up for shipment. Shipping method modules may add functionality to generate shipping labels and tracking numbers.

Code

function uc_shipping_package_edit_submit($form_id, $form_values) {
  $package = uc_shipping_package_load($form_values['package_id']);
  if ($form_values['op'] != t('Cancel')) {
    foreach ($form_values['products'] as $id => $product) {
      if ($product['checked']) {
        $package->products[$id] = (object) $product;
      }
      else {
        unset($package->products[$id]);
      }
    }
    $package->shipping_type = $form_values['shipping_type'];
    uc_shipping_package_save($package);
  }
  return 'admin/store/orders/' . $package->order_id . '/packages';
}