summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cart.php
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-07-20 17:47:13 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-07-20 17:47:13 +0200
commit499a583e5b28980a962d3a00db882232a39ee8fe (patch)
treea078205cc4074f13e7e113f404e7322e0bcd09b6 /system/libraries/Cart.php
parent3b840b60c5cc9041098f971c4c58889bc609d82a (diff)
parent7df793273edd4c9d01b8f83c1d1bbb801a623bd8 (diff)
Merge branch 'develop' of github.com:philsturgeon/codeigniter-reactor into develop
Diffstat (limited to 'system/libraries/Cart.php')
-rw-r--r--system/libraries/Cart.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index 7f65b48b9..b2eaa9ad7 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -374,6 +374,7 @@ class CI_Cart {
// Lets add up the individual prices and set the cart sub-total
$total = 0;
+ $items = 0;
foreach ($this->_cart_contents as $key => $val)
{
// We make sure the array contains the proper indexes
@@ -383,13 +384,14 @@ class CI_Cart {
}
$total += ($val['price'] * $val['qty']);
+ $items += $val['qty'];
// Set the subtotal
$this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']);
}
// Set the cart total and total items.
- $this->_cart_contents['total_items'] = count($this->_cart_contents);
+ $this->_cart_contents['total_items'] = $items;
$this->_cart_contents['cart_total'] = $total;
// Is our cart empty? If so we delete it from the session