Number of Cart Items

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
User avatar
clevername
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Tue Jan 11, 2011 8:54 am

Number of Cart Items

Post by clevername » Mon Apr 18, 2011 12:18 pm

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.

User avatar
clevername
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Tue Jan 11, 2011 8:54 am

Re: Number of Cart Items

Post by clevername » Mon Apr 18, 2011 1:50 pm

Never mind we found the solution. Thank you!

Post Reply