You are here

function uc_ups_product_alter_validate in Ubercart 5

Same name and namespace in other branches
  1. 8.4 shipping/uc_ups/uc_ups.module \uc_ups_product_alter_validate()
  2. 6.2 shipping/uc_ups/uc_ups.module \uc_ups_product_alter_validate()
  3. 7.3 shipping/uc_ups/uc_ups.module \uc_ups_product_alter_validate()

Validation handler for UPS product fields.

File

shipping/uc_ups/uc_ups.module, line 85
Shipping quote module that interfaces with www.ups.com to get rates for small package shipments.

Code

function uc_ups_product_alter_validate($form_id, $form_values) {
  $enabled = variable_get('uc_quote_enabled', array());
  if ($form_values['shippable'] && ($form_values['shipping_type'] == 'small_package' || empty($form_values['shipping_type']) && variable_get('uc_store_shipping_type', 'small_package') == 'small_package')) {
    if ($form_values['ups']['pkg_type'] == '02' && (empty($form_values['length']) || empty($form_values['width']) || empty($form_values['height']))) {
      form_set_error('base][dimensions', t('Dimensions are required for custom packaging.'));
    }
  }
}