Permalink
Browse files

Added new item() method to the Cart library to allow you to get the d…

…etails of a specific cart item as an array in one step.
  • Loading branch information...
1 parent 40d1a76 commit 50ec6e8f189f73be4bd50591ddfdbfb3f3c99a58 @kylefarris committed Sep 6, 2011
Showing with 21 additions and 2 deletions.
  1. +21 −2 system/libraries/Cart.php
View
23 system/libraries/Cart.php
@@ -543,8 +543,27 @@ function destroy()
$this->CI->session->unset_userdata('cart_contents');
}
-
-
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Cart Item
+ *
+ * Returns the details of a specific cart item.
+ *
+ * @access public
+ * @param integer ID of the cart item to get details of
+ * @return array
+ */
+ public function item($row_id = FALSE)
+ {
+ if (empty($row_id))
+ {
+ return array();
+ }
+ return $this->_cart_contents[$rowid];
+ }
+
}
// END Cart Class

0 comments on commit 50ec6e8

Please sign in to comment.