Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Items in Cart - Doesn't count quantities

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 10-22-2007, 02:48 PM
 
creativearc creativearc is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 34
 

Default Items in Cart - Doesn't count quantities

Currently - our "items in cart" is not counting the quantity of items. It only counts how many unique items there are in the cart.

Is there an easy way to modify this to count the total amount of items - including their quantities (so if there were 2 different items, each with quantity of 10 - it would show 20)
__________________
CreativeArc
---------------
X-Cart Pro
Version: 4.1.8
Reply With Quote
  #2  
Old 10-22-2007, 02:53 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

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

http://forum.x-cart.com/showthread.php?t=29370
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 10-23-2007, 08:47 AM
 
creativearc creativearc is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 34
 

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

Well - that shows the not-so-goodness of xcart forums search function...

That thread helped - thank you.
__________________
CreativeArc
---------------
X-Cart Pro
Version: 4.1.8
Reply With Quote
  #4  
Old 10-23-2007, 08:49 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

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

All depends on what you search for. The new forum search is fine, just need the keywords is all. Thread came right up for me.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 10-24-2007, 04:11 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

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
  #6  
Old 10-24-2007, 06:52 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

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

moving to completed mods...
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:45 AM.

   

 
X-Cart forums © 2001-2020