From da2bdf2b95a55f03aadfb6a1d21a90a0fff627db Mon Sep 17 00:00:00 2001 From: Ahmad Anbar Date: Thu, 13 Feb 2014 12:59:18 +0200 Subject: Re-arranged documentation, fixed comment. --- system/libraries/Cart.php | 2 +- user_guide_src/source/libraries/cart.rst | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index ec67d9b4a..389b1b77e 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -326,7 +326,7 @@ class CI_Cart { * 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 - * rowid and qty for each item. + * rowid and quantity for each item. * * @param array * @return bool diff --git a/user_guide_src/source/libraries/cart.rst b/user_guide_src/source/libraries/cart.rst index 6d0dd2e3a..a0870e34a 100644 --- a/user_guide_src/source/libraries/cart.rst +++ b/user_guide_src/source/libraries/cart.rst @@ -206,9 +206,7 @@ Updating The Cart To update the information in your cart, you must pass an array containing the Row ID and quantity to the $this->cart->update() -function, you may also update any property you have previously -defined when inserting the item such as options, price -or other custom fields you defined. +function. .. note:: If the quantity is set to zero, the item will be removed from the cart. @@ -217,7 +215,6 @@ or other custom fields you defined. $data = array( 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', - 'price' => 10, 'qty' => 3 ); @@ -242,6 +239,20 @@ or other custom fields you defined. $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? ***************** -- cgit v1.2.3-24-g4f1b