Page 1 of 1

Number of Cart Items

Posted: Mon Apr 18, 2011 12:18 pm
by clevername
I am using the Minibasket and I want to put the number of total items in the cart. I know how to call the number, however, I do no know how to get the correct number. This is what I am using now

Code: Select all

foreach (BasketItem item in basket.Items)
        {
			//calculate with the item quantity
			itemCount += item.Quantity;
        }
        
        itemCount = itemCount - 1;

        if (itemCount >= 1)
          {
                lblBasketCount.Text = "<span id=\"ItemCount\">" + itemCount.ToString() + "</span>";
           }
     


The problems I am having:
1. the itemCount will count the Package as a product in addition to the package contents
for example: if I have a package with 3 items in it and the package is called "Sale Package". It will count 4 because it includes the Package itself as an item.

I would really appreciate anyones help on this matter.

Re: Number of Cart Items

Posted: Mon Apr 18, 2011 1:50 pm
by clevername
Never mind we found the solution. Thank you!