You are here

function uc_product_update_cart_item in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \uc_product_update_cart_item()

Implements hook_update_cart_item().

1 call to uc_product_update_cart_item()
uc_product_kit_update_cart_item in uc_product_kit/uc_product_kit.module
Implements hook_update_cart_item().

File

uc_product/uc_product.module, line 1201
The product module for Ubercart.

Code

function uc_product_update_cart_item($nid, $data = array(), $qty, $cid = NULL) {
  if (!$nid) {
    return NULL;
  }
  $cid = !(is_null($cid) || empty($cid)) ? $cid : uc_cart_get_id();
  if ($qty < 1) {
    uc_cart_remove_item($nid, $cid, $data);
  }
  else {
    db_query("UPDATE {uc_cart_products} SET qty = %d, changed = %d WHERE nid = %d AND cart_id = '%s' AND data = '%s'", $qty, time(), $nid, $cid, serialize($data));
  }
}