Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index 5a31a1d..389b1b7 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -323,10 +323,10 @@
 	/**
 	 * Update the cart
 	 *
-	 * This function permits the quantity of a given item to be changed.
+	 * This function permits changing item properties.
 	 * Typically it is called from the "view cart" page if a user makes
 	 * changes to the quantity before checkout. That array must contain the
-	 * product ID and quantity for each item.
+	 * rowid and quantity for each item.
 	 *
 	 * @param	array
 	 * @return	bool
@@ -350,7 +350,19 @@
 		}
 		else
 		{
-			$this->_cart_contents[$items['rowid']]['qty'] = $items['qty'];
+			// find updatable keys
+			$keys = array_intersect(array_keys($this->_cart_contents[$items['rowid']]), array_keys($items));
+			// if a price was passed, make sure it contains valid data
+			if (isset($items['price']))
+			{
+				$items['price'] = (float) $items['price'];
+			}
+			
+			// product id & name shouldn't be changed			
+			foreach (array_diff($keys, array('id', 'name')) as $key) 
+			{
+				$this->_cart_contents[$items['rowid']][$key] = $items[$key];
+			}
 		}
 
 		return TRUE;
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 16c30b7..c8cbbb9 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -308,6 +308,7 @@
       -  Added method ``remove()`` to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatibility.
       -  Added method ``get_item()`` to enable retrieving data for a single cart item.
       -  Added unicode support for product names.
+      -	 ``update()`` now supports updating all properties attached to an item.
 
    -  :doc:`Image Manipulation Library <libraries/image_lib>` changes include:
 
diff --git a/user_guide_src/source/libraries/cart.rst b/user_guide_src/source/libraries/cart.rst
index fb92c28..74e7915 100644
--- a/user_guide_src/source/libraries/cart.rst
+++ b/user_guide_src/source/libraries/cart.rst
@@ -88,6 +88,18 @@
 your data among all your products in order to make displaying the
 information in a table easier.
 
+::
+
+	$data = array(
+	               'id'      => 'sku_123ABC',
+	               'qty'     => 1,
+	               'price'   => 39.95,
+	               'name'    => 'T-Shirt',
+	               'coupon'	 => 'XMAS-50OFF'
+	            );
+
+	$this->cart->insert($data);
+
 The insert() method will return the $rowid if you successfully insert a
 single item.
 
@@ -194,7 +206,7 @@
 
 To update the information in your cart, you must pass an array
 containing the Row ID and quantity to the $this->cart->update()
-function:
+function.
 
 .. note:: If the quantity is set to zero, the item will be removed from
 	the cart.
@@ -227,6 +239,21 @@
 
 	$this->cart->update($data);
 
+You may also update any property you have previously 
+defined when inserting the item such as options, price 
+or other custom fields you defined.
+
+::
+
+	$data = array(
+		       'rowid'	 => 'b99ccdf16028f015540f341130b6d8ec',
+	               'qty'     => 1,
+		       'price'	 => 49.95,
+	               'coupon'	 => NULL
+	            );
+
+	$this->cart->update($data);
+
 What is a Row ID?
 *****************
 
@@ -289,10 +316,10 @@
 		:returns:	TRUE on success, FALSE on failure
 		:rtype:	bool
 
-		This method permits the quantity of a given item to be changed.
+		This method permits changing the properties of a given item.
 		Typically it is called from the "view cart" page if a user makes changes
-		to the quantity before checkout. That array must contain the product ID
-		and quantity for each item.
+		to the quantity before checkout. That array must contain the rowid
+		and qty for each item.
 
 	.. method:: remove($rowid)