function uc_catalog_buy_it_now_form_submit in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_product/uc_product.module \uc_catalog_buy_it_now_form_submit()
- 7.3 uc_product/uc_product.module \uc_catalog_buy_it_now_form_submit()
File
- uc_product/
uc_product.module, line 958 - The product module for Ubercart.
Code
function uc_catalog_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, module_invoke_all('add_to_cart_data', $form_values));
}