Page 1 of 1

Cant change quantity in cart once discount is applied

Posted: Thu Jan 20, 2011 1:52 pm
by richa
AbleCommerce version? 7.0.5 build 14053
In the Shopping cart, you can change the quantity of any item, until a discount is applied. Once a discount is applied, you can change the quantity of only the first item in the cart.

Re: Cant change quantity in cart once discount is applied

Posted: Fri Jan 21, 2011 7:28 am
by jmestep
Do you have custom code on the basket? I'm not seeing that problem in a 7.0.5 site.

Re: Cant change quantity in cart once discount is applied

Posted: Fri Jan 21, 2011 8:01 am
by richa
we call a method: ShowDiscountMessageInfo(); in page load in basket.ascx.cs

Code: Select all

private void ShowDiscountMessageInfo()
    {
        VolumeDiscountCollection volumeDiscountCollection = VolumeDiscountDataSource.LoadForStore();
        for (int i = 0; i < volumeDiscountCollection.Count; i++)
        {
            VolumeDiscount volumeDiscount = volumeDiscountCollection[i];

            if (string.Compare(volumeDiscount.Name, "new discount", StringComparison.OrdinalIgnoreCase) == 0)
            {
                VolumeDiscountLevelCollection volumeDiscountLevelCollection = volumeDiscountCollection[i].Levels;
                BasketHelper.SaveBasket(BasketGrid);
                BindBasketGrid();

                LSDecimal subTotalOfCart = GetBasketSubtotalWithoutDiscount();

                bool discountApplied = false;
                for (int j = 0; j < volumeDiscountLevelCollection.Count; j++)
                {
                    VolumeDiscountLevel volumeDiscountLevel = volumeDiscountLevelCollection[j];
                    if (volumeDiscountLevel.MinValue - subTotalOfCart < 10 &&
                        volumeDiscountLevel.MinValue - subTotalOfCart > 0)
                    {
                        bool isPercent = volumeDiscountLevel.IsPercent;
                        string discountAmount = string.Empty;
                        if (isPercent)
                        {
                            discountAmount = (volumeDiscountLevel.DiscountAmount / 100).ToString("0.00%");
                        }
                        else
                        {
                            discountAmount = volumeDiscountLevel.DiscountAmount.ToString("C");
                        }
                        lblDiscountInfo.Text = (volumeDiscountLevel.MinValue - subTotalOfCart).ToString("C") +
                                               " more and you will save " + discountAmount + " on your entire order";
                        discountApplied = true;
                        break;
                    }
                }
                if (!discountApplied)
                {
                    divDiscountInfo.Visible = false;
                }
                else
                {
                    divDiscountInfo.Visible = true;
                }
            }
        }
    }
i put this additional code in a clean install and it works fine. but just doesnt work on the real website....

Re: Cant change quantity in cart once discount is applied

Posted: Fri Jan 21, 2011 9:11 am
by jmestep
There has to be some other difference on the live site. Try checking for nulls in your code and see if that helps.