public function UcAjaxCart::addItemToCart in Ubercart AJAX Cart 6.2
Same name and namespace in other branches
- 7.2 uc_ajax_cart.extender.inc \UcAjaxCart::addItemToCart()
File
- ./
uc_ajax_cart.php, line 39
Class
Code
public function addItemToCart($nodeID, $qty = 1, $data = array()) {
$node = node_load($nodeID);
if (!is_object($node) || !uc_product_is_product($node)) {
throw new NoProductException();
}
/** @todo this should come over form. or this field is populated by submit handler. **/
$data['nid'] = $nodeID;
if ($node->type == 'product_kit') {
return $this
->addItemKitToCart($nodeID, $qty, $data);
}
uc_cart_add_item($node->nid, $qty, module_invoke_all('add_to_cart_data', $data), null, true, false, true);
return;
}