Page 1 of 1

custom Cart Total in Header is incorrect--Need help

Posted: Tue Oct 14, 2008 12:21 pm
by alee337
My programmer has added a cart item(s) # as well as dollar amount to the header, but we are experiencing a small problem. Whenever adding items to the cart, the number of items shown as well as total amount is right. But as soon as you checkout, this is where the problem occurs.

Once you select a shipping method, it adds 1 item to the cart (but total $ amount doesn't change). Also, when you add a coupon code, it adds another item to the cart (again, the $ amount of the cart doesnt change, which is right). What now happens is the basket total in the header shows 3 items (1 for the actual product, 1 for shipping and 1 for coupon code). We only want it to display 1 item, as this is the correct number.

See attached screenshot. Could someone let us know how to fix this?

Thanks again AbleCommerce members!

Re: custom Cart Total in Header is incorrect--Need help

Posted: Tue Oct 14, 2008 12:25 pm
by Shopping Cart Admin
Hello,

I'd just create a new header for use on the checkout page without the cart total, it's redundant and trying to get it to work with the ajax enabled one page checkout is likely more work than it's worth.

Re: custom Cart Total in Header is incorrect--Need help

Posted: Tue Oct 14, 2008 2:41 pm
by jmestep
Able uses numbers less than 0 for things like coupons, shipping, taxes. Try filtering your quantity count to exclude basket products that have a productid <0 .

Re: custom Cart Total in Header is incorrect--Need help

Posted: Thu Jan 01, 2009 11:07 am
by vijjendra
To display the total quantity or Items plz use the following code..

System.Int32 j;
System.Int32 j;
protected void Page_Load(object sender, EventArgs e)
{
GetBasketItems();
}
private void GetBasketItems()
{
Basket basket = Token.Instance.User.Basket;
//WE WANT TO RESET THE GIFT OPTIONS AT THIS STAGE
basket.Package(true);

foreach (BasketItem item in basket.Items)
{
if (item != null)
{
Product product = item.Product;
if (product != null)
{
i++; // total items in the cart
j = j+item.Quantity; // total items Quantity in the cart
}
}
}
MessageItem.Text = Convert.ToString(i);
MessageQuantity.Text = Convert.ToString(j);
}