diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-07-20 18:07:40 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-07-20 18:07:40 +0200 |
commit | 909105135439ac2ade75a99922f77c038e882fee (patch) | |
tree | f6984a61489dc199a309513ea63c1010a4c3a463 /system/libraries/Cart.php | |
parent | 6d2f13a3dd1f44d8b20d61bdde5c77c7d827cfde (diff) |
Changed Cart library to return the if inserted successfully. This will be fine for anyone using () == true. http://codeigniter.uservoice.com/forums/40508-codeigniter-reactor/suggestions/2055829-last-rowid-of-cart
Diffstat (limited to 'system/libraries/Cart.php')
-rw-r--r-- | system/libraries/Cart.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index b2eaa9ad7..ab5a70c98 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -99,7 +99,7 @@ class CI_Cart { $save_cart = FALSE; if (isset($items['id'])) { - if ($this->_insert($items) == TRUE) + if (($rowid = $this->_insert($items))) { $save_cart = TRUE; } @@ -110,7 +110,7 @@ class CI_Cart { { if (is_array($val) AND isset($val['id'])) { - if ($this->_insert($val) == TRUE) + if ($this->_insert($val)) { $save_cart = TRUE; } @@ -122,7 +122,7 @@ class CI_Cart { if ($save_cart == TRUE) { $this->_save_cart(); - return TRUE; + return isset($rowid) ? $rowid : TRUE; } return FALSE; @@ -244,7 +244,7 @@ class CI_Cart { } // Woot! - return TRUE; + return $rowid; } // -------------------------------------------------------------------- |