You are here

function uc_product_kit_buy_it_now_form_validate in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 uc_product_kit/uc_product_kit.module \uc_product_kit_buy_it_now_form_validate()
  2. 7.3 uc_product_kit/uc_product_kit.module \uc_product_kit_buy_it_now_form_validate()

Redirects to the product kit page so attributes may be selected.

See also

uc_product_kit_buy_it_now_form()

1 string reference to 'uc_product_kit_buy_it_now_form_validate'
uc_product_kit_buy_it_now_form in uc_product_kit/uc_product_kit.module
Adds to cart button with any extra fields.

File

uc_product_kit/uc_product_kit.module, line 866
The product kit module for Ubercart.

Code

function uc_product_kit_buy_it_now_form_validate($form, &$form_state) {
  if (module_exists('uc_attribute')) {
    $node = node_load($form_state['values']['nid']);
    if (is_array($node->products)) {
      foreach ($node->products as $nid => $product) {
        $attributes = uc_product_get_attributes($nid);
        if (!empty($attributes)) {
          drupal_set_message(t('This product has options that need to be selected before purchase. Please select them in the form below.'), 'error');
          drupal_goto('node/' . $form_state['values']['nid']);
        }
      }
    }
  }
}