From 11db7a7da940a6ab0168a70b71194f078cdf953d Mon Sep 17 00:00:00 2001 From: Ahmad Anbar Date: Thu, 13 Feb 2014 02:40:45 +0200 Subject: Delete by values, not keys --- system/libraries/Cart.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php index f5e85b715..8a2516f1c 100644 --- a/system/libraries/Cart.php +++ b/system/libraries/Cart.php @@ -353,14 +353,13 @@ class CI_Cart { // 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($keys['price'])) + if (isset($items['price'])) { - $keys['price'] = (float) $keys['price']; + $items['price'] = (float) $items['price']; } // product name & id shouldn't be changed - unset($keys['name']); - unset($keys['id']); + $keys = array_diff($keys, array('id', 'name')); foreach ($keys as $key) { -- cgit v1.2.3-24-g4f1b