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

3.5.4 Mini Cart gives wrong number of items

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 03-05-2004, 01:00 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default 3.5.4 Mini Cart gives wrong number of items

I saw this mentioned before with regards to earlier versions. Mini cart is showing groups of items as one item e.g. added 3 x product to cart and mini cart says 1 item. Is this by design?

Thanks

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #2  
Old 03-05-2004, 01:49 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

yeh, maybe it should say '3 products'
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 03-05-2004, 07:48 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

Well it doesn't look right. If I have a total quantity of 6 items in my cart I expect to see "6" in the mini cart -what's the point in having the mini cart if it doesn't match up to the main cart? I've mailed X-Cart about this.

Thanks

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #4  
Old 03-05-2004, 02:16 PM
 
Cameron Cameron is offline
 

eXpert
  
Join Date: Jan 2003
Location: Washington State, USA
Posts: 224
 

Default

Please let us know what x-cart tells you for a fix on this. I've never noticed it in all the stores I've done, but it's been there as far back as 3.3.x

Thanks,
Cameron
__________________
Current project: 4.4.2
Reply With Quote
  #5  
Old 03-05-2004, 03:40 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

It's the total number of different products not the total quantity of individual items in the cart.

3 x Red Balloons is only 1 item.
3 x Red Balloons and 2 x Blue Balloons is 2 items.
Reply With Quote
  #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
  #7  
Old 03-08-2004, 12:35 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default

Thanks Boomer, I'll give that a shot. I still think the mini cart should show the total quantity of items by default. I'll see what X-Cart say. I think they must be busy at the moment as they've not replied to my mails for a while.

Thanks again

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #8  
Old 06-18-2004, 03:12 PM
 
bluesunomi bluesunomi is offline
 

Member
  
Join Date: Feb 2004
Location: Oxford, UK
Posts: 22
 

Default

Hi,

This doesn't include gift vouchers in the total no products though, so you need an additional line after the loop ....

after ...

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


Put in this line to fix this ....

Code:
$MINICART["total_items"] += ((!empty($cart["giftcerts"]) and is_array($cart["giftcerts"]))?count($cart["giftcerts"]):0);
Reply With Quote
  #9  
Old 10-02-2004, 08:16 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

I used this in 4.0.4 (Thanks Boomer), but my "Total" still says $0.00 no matter how many items are in the cart.

This changes when you "View Cart" or "Checkout", but I don't want to redirect to cart for the customer as our average order has 8-10 items.

Does anyone know how to get the total (sub-total) to show in the minicart?

Thanks,

Mike
__________________
4.1.9
Reply With Quote
  #10  
Old 03-27-2006, 01:53 PM
 
dankind dankind is offline
 

Member
  
Join Date: Mar 2006
Posts: 16
 

Default

This mod was exactly what I was looking foor. Thanks a bunch BOOMER!!!
__________________
Thanx,
Dan
________________
X-Cart Gold 4.0.18
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 03:43 PM.

   

 
X-Cart forums © 2001-2020