function uc_atctweaks_node_insert in UC Add to Cart Tweaks 7
Implements hook_node_insert(). Inserts add to cart tweak product feature on product node creation.
File
- ./
uc_atctweaks.module, line 130 - Defines a product feature to tweak the add to cart form behavior.
Code
function uc_atctweaks_node_insert($node) {
if (uc_product_is_product($node)) {
$data = variable_get('ucatc_class_def_' . $node->type, array());
// If the product class has default Add to Cart Tweaks...
if ($data) {
// Prepare the data as if it were from a form submission.
$data = unserialize($data);
$data['nid'] = $node->nid;
$data['pfid'] = '';
$form_state = array(
'values' => $data,
);
// Add the feature to the product by spoofing the normal form submission.
uc_atctweaks_feature_form_submit(array(), $form_state);
}
}
}