From f75ec11d7ed0592f930dd3a090db7c1c6d251eed Mon Sep 17 00:00:00 2001 From: Andrew Seymour Date: Wed, 14 Dec 2011 09:36:39 +0000 Subject: Added in a remove item from cart function to save the "hacky" method of updating a product with 0 quantity, updated the changelog to reflect and to be neater and more readable surrounding the changes of the Cart library --- system/libraries/Cart.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index e78ecd5f6..7f6cdf5dd 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -450,7 +450,29 @@ class CI_Cart { { return $this->_cart_contents['cart_total']; } - + + // -------------------------------------------------------------------- + + /** + * Remove Item + * + * Removes an item from the cart + * + * @access public + * @return boolean + */ + public function remove($rowid) + { + // just do an unset + unset($this->_cart_contents[$rowid]); + + // we need to save the cart now we've made our changes + $this->_save_cart(); + + // completed + return true; + } + // -------------------------------------------------------------------- /** -- cgit v1.2.3-24-g4f1b