Index: ec_cart/ec_cart.module
===================================================================
RCS file: /var/lib/cvs/drupal-common/modules/contrib/ecommerce/ec_cart/ec_cart.module,v
retrieving revision 1.1.6.1
diff -u -8 -p -u -p -r1.1.6.1 ec_cart.module
--- ec_cart/ec_cart.module	22 Oct 2009 10:39:05 -0000	1.1.6.1
+++ ec_cart/ec_cart.module	29 Jan 2010 14:03:39 -0000
@@ -559,17 +559,17 @@ function ec_cart_block($op = 'list', $de
  * Add an item to the cart via ajax.
  */
 function ec_cart_ajax_add($item_id, $qty = 1) {
   $ret = array();
 
   $qty = isset($_REQUEST['qty']) ? $_REQUEST['qty'] : $qty;
   $data = isset($_REQUEST['data']) ? $_REQUEST['data'] : '';
   $items = ec_cart_current();
-  if (ec_cart_update_item($item_id, $qty, $data)) {
+  if (ec_cart_update_item($item_id, $qty + ($items[$item_id] ? $items[$item_id]->qty : 0), $data)) {
     if (count($items)) {
       $items = ec_cart_current();
       // Check for a ptype specific theme function.
       $ret['block_item'] = theme('ec_cart_display_item', $items[$item_id]);
       $ret['block_id'] = 'cart-item-'. $item_id;
       $ret['items'] = count($items);
       $ret['total'] = format_currency(ec_cart_get_total($items));
     }
@@ -713,16 +713,20 @@ function ec_cart_edit($item_id, $qty = 1
 
 /**
  * Add item to cart and return to destination (default: front page).
  * Passing data from $_REQUEST if it exists.
  */
 function ec_cart_add($item_id, $qty = 1) {
   $qty = isset($_REQUEST['qty']) ? $_REQUEST['qty'] : $qty;
   $data = isset($_REQUEST['data']) ? $_REQUEST['data'] : '';
+  $item = ec_cart_get_cart(ec_checkout_get_id(), $item_id);
+  if ($item) {
+    $qty += $item->qty;
+  }
   if (ec_cart_update_item($item_id, $qty, $data)) {
     drupal_set_message(t('Your item has been added.'));
   }
   $node = node_load($item_id);
   rules_invoke_event('ec_cart_add', $node);
   drupal_goto();
 }
 
