View Single Post
  #6  
Old 03-05-2004, 04:37 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

This was done with 3.5.4, customer/minicart.php:

Code:
x_session_register ("cart"); $MINICART["total_cost"] = price_format(0); $MINICART["total_items"] = 0; if (!empty($cart)) { if (!empty($cart["total_cost"])) $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"]; } } } $smarty->assign("minicart_total_cost", $MINICART["total_cost"]); $smarty->assign("minicart_total_items", $MINICART["total_items"]);

This code actually loops over the cart array products index, and finds the amount and adds them up to return a true number of items.

Donations: paypal@molotovbliss.com if you find this useful.

__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote