// Returns the total quantity of all items in the cart.
function uc_cart_total_qty($cart_id = NULL) {
  if (empty($cart_id)) {
    $cart_id = uc_cart_get_id();
  }

  return db_result(db_query("SELECT SUM(qty) FROM {uc_cart_products} WHERE cart_id = '%s'", $cart_id));
}
CommentFileSizeAuthor
#3 508888-uc_cart_get_total_qty.patch1.57 KBrszrama

Comments

rszrama’s picture

Just realized that it could happen that the next time a cart is loaded the qty for an item gets adjusted; this happens w/ uc_restrict_qty. Either that doesn't really matter or this function should be updated to simply loop through the return value of uc_cart_get_contents().

rszrama’s picture

Issue tags: +Release blocker
rszrama’s picture

Status: Active » Fixed
StatusFileSize
new1.57 KB

Took my own advice. Committed patch attached. Documented in the update docs.

Status: Fixed » Closed (fixed)
Issue tags: -Release blocker, -ubercamp sprint

Automatically closed -- issue fixed for 2 weeks with no activity.