View Single Post
  #14  
Old 11-19-2008, 09:21 PM
 
whsu716 whsu716 is offline
 

Senior Member
  
Join Date: Jun 2005
Posts: 168
 

Default Re: 3.5.4 Mini Cart gives wrong number of items

Got it:

Quote:
<?php
if ( !defined('XCART_START') ) { header("Location: home.php"); die("Access denied"); }

x_session_register ("cart");

$MINICART["total_cost"] = price_format(0);
$MINICART["total_items"] = 0;

if (!empty($cart)) {

if (!empty($cart["total_cost"])) {
if (!empty($active_modules["Fast_Lane_Checkout"]))
$MINICART["total_cost"] = $cart["display_subtotal"];
else
$MINICART["total_cost"] = $cart["total_cost"];
}

$MINICART["total_items"] = ((!empty($cart["products"]) and is_array($cart["products"]))?count($cart["products"]):0) + ((!empty($cart["giftcerts"]) and is_array($cart["giftcerts"]))?count($cart["giftcerts"]):0);

if(!empty($cart["products"])) {
foreach($cart["products"] as $key => $value) {
$MINICART["total_items"] += $value["amount"] - 1;
}
}


}

$smarty->assign("minicart_total_cost", $MINICART["total_cost"]);
$smarty->assign("minicart_total_items", $MINICART["total_items"]);
?>

Just needed to add the "-1"
__________________
...
v 4.0.18; 4.1
Reply With Quote