View Single Post
  #5  
Old 10-24-2007, 04:11 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Items in Cart - Doesn't count quantities

I actually took this code and changed it a little bit. Instead of replacing the code in minicart.php I added it.
Here is what I did:
1. Open minicart.php and add
Code:
$MINICART["total_products"] = 0;
right after
Code:
$MINICART["total_items"] = 0;
2. In
Code:
$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);
replace
Code:
$MINICART["total_items"]
with
Code:
$MINICART["total_products"]
3. Then add this
Code:
if (!empty($cart["products"]) and is_array($cart["products"])) { foreach ($cart["products"] as $_tmp) $MINICART["total_items"] += $_tmp["amount"]; } if (!empty($cart["giftcerts"]) and is_array($cart["giftcerts"])) $MINICART["total_items"] += $cart["giftcerts"];
4. Just before the closing tag "?>" add
Code:
$smarty->assign("minicart_total_products", $MINICART["total_products"]);
5. Add a new language lable "lbl_minicart_products"
6. Then open customer/main/minicart.tpl and add the new variable "minicart_total_products" where you want it to appear. Something like this
Code:
<tr> <td colspan="2" class="VertMenuItems"><b>{$lng.lbl_minicart_products}: </b></td> <td class="VertMenuItems"><font color="#a10000">{$minicart_total_products}</font></td> </tr>
That's it. It looks to work fine so far. This is done on 4.1.7 original files. Note sure if it will work on other version. Attached is a snapshot of the cart with the above changes.
Attachment 597
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote