function uc_product_kit_buy_it_now_form_submit in Ubercart 7.3
Same name and namespace in other branches
- 8.4 uc_product_kit/uc_product_kit.module \uc_product_kit_buy_it_now_form_submit()
- 5 uc_product_kit/uc_product_kit.module \uc_product_kit_buy_it_now_form_submit()
- 6.2 uc_product_kit/uc_product_kit.module \uc_product_kit_buy_it_now_form_submit()
Form submission handler for uc_product_kit_buy_it_now_form().
See also
uc_product_kit_buy_it_now_form()
File
- uc_product_kit/
uc_product_kit.module, line 890 - The product kit module for Ubercart.
Code
function uc_product_kit_buy_it_now_form_submit($form, &$form_state) {
$node = node_load($form_state['values']['nid']);
if (module_exists('uc_attribute')) {
$attributes = uc_product_get_attributes($node->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');
$form_state['redirect'] = drupal_get_path_alias('node/' . $form_state['values']['nid']);
return;
}
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');
$form_state['redirect'] = drupal_get_path_alias('node/' . $form_state['values']['nid']);
return;
}
}
}
}
$form_state['redirect'] = uc_cart_add_item($form_state['values']['nid'], 1, $form_state['values'], NULL, variable_get('uc_cart_add_item_msg', TRUE));
}