function uc_ajax_cart_add_item in Ubercart AJAX Cart 7.2
Same name and namespace in other branches
- 6.2 uc_ajax_cart.module \uc_ajax_cart_add_item()
@todo Please document this function.
See also
1 call to uc_ajax_cart_add_item()
- uc_ajax_cart_callback in ./
uc_ajax_cart.module - @todo Please document this function.
File
- ./
uc_ajax_cart.module, line 207
Code
function uc_ajax_cart_add_item($data) {
// Protect agains bad calls.
if (!isset($data['form_id'])) {
return;
}
if (!isset($data['qty'])) {
$data['qty'] = 1;
}
$formID = explode('_', $data['form_id']);
$nodeID = array_pop($formID);
$formID = implode('_', $formID);
$product = node_load($nodeID);
$formValues = array(
'values' => $data,
);
drupal_form_submit($formID, $formValues, $product);
return;
}