function uc_product_kit_buy_it_now_form_submit in Ubercart 5
Same name and namespace in other branches
- 8.4 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()
- 7.3 uc_product_kit/uc_product_kit.module \uc_product_kit_buy_it_now_form_submit()
File
- uc_product_kit/
uc_product_kit.module, line 591 - The product kit module for Übercart.
Code
function uc_product_kit_buy_it_now_form_submit($form_id, $form_values) {
$node = node_load($form_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');
return drupal_get_path_alias('node/' . $form_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');
return drupal_get_path_alias('node/' . $form_values['nid']);
}
}
}
}
return uc_cart_add_item($form_values['nid'], 1, $form_values);
}