Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

sync total items count and total amount price; by sum of quantity of …

…each item in cart
  • Loading branch information...
commit 72038ba6fd2e8196623bf1bd1a38756ad41ce905 1 parent 5025929
@marcoscoelho marcoscoelho authored philsturgeon committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 system/libraries/Cart.php
View
4 system/libraries/Cart.php
@@ -374,6 +374,7 @@ function _save_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 @@ function _save_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
Please sign in to comment.
Something went wrong with that request. Please try again.