function uc_atctweaks_feature_form_submit in UC Add to Cart Tweaks 7        
                          
                  
                        Same name and namespace in other branches
- 6 uc_atctweaks.module \uc_atctweaks_feature_form_submit()
 
 
See also
uc_atctweaks_feature_form()
1 call to uc_atctweaks_feature_form_submit()
  - uc_atctweaks_node_insert in ./uc_atctweaks.module
 
  - Implements hook_node_insert().
Inserts add to cart tweak product feature on product node creation.
 
 
File
 
   - ./uc_atctweaks.module, line 220
 
  - Defines a product feature to tweak the add to cart form behavior.
 
Code
function uc_atctweaks_feature_form_submit($form, &$form_state) {
  
  $atctweaks_data = array(
    'pfid' => $form_state['values']['pfid'],
    'cart_empty' => $form_state['values']['cart_empty'],
    'redirect' => $form_state['values']['redirect'],
  );
  
  $tweaks_form = _uc_atctweaks_feature_form();
  $description = array(
    t('<b>Add to cart form redirect:</b> @redirect', array(
      '@redirect' => $tweaks_form['redirect']['#options'][$atctweaks_data['redirect']],
    )),
  );
  if ($atctweaks_data['cart_empty']) {
    $description[] = t('The cart will be emptied prior to adding this item to it.');
  }
  
  $data = array(
    'pfid' => $atctweaks_data['pfid'],
    'nid' => $form_state['values']['nid'],
    'fid' => 'atctweaks',
    'description' => implode('<br />', $description),
  );
  $form_state['redirect'] = uc_product_feature_save($data);
  $atctweaks_data['pfid'] = $data['pfid'];
  
  $key = array();
  if ($vpid = _uc_atctweaks_get_vpid($atctweaks_data['pfid'])) {
    $key = 'vpid';
    $atctweaks_data['vpid'] = $vpid;
  }
  drupal_write_record('uc_atctweaks_products', $atctweaks_data, $key);
}