Page 1 of 1

Kit issues during checkout in 7.06 ?

Posted: Mon Feb 21, 2011 7:13 pm
by wiredbox
When I have a kit in the shopping cart and the customer clicks remove from cart the individual products are still in that cart. Any ideas what is causing this ?

Re: Kit issues during checkout in 7.06 ?

Posted: Mon Feb 21, 2011 8:11 pm
by compunerdy
Wow.. I just verified this.

If you have a bundle kit added to the cart and click delete it dumps all of the items in the cart as if you had added a itemized kit to the cart.

Re: Kit issues during checkout in 7.06 ?

Posted: Mon Feb 21, 2011 8:27 pm
by wiredbox
yeah any clue on how to fix this, the only thing that i can thik of is the basket.ascx

Here is the code from it
<asp:LinkButton ID="DeleteItemButton" runat="server" CssClass="altoddButton" CommandName="DeleteItem" CommandArgument='<%# Eval("BasketItemId") %>' Text="Delete" OnClientClick="return confirm('Are you sure you want to remove this item from your cart?')"></asp:LinkButton><br /><br />

Re: Kit issues during checkout in 7.06 ?

Posted: Tue Feb 22, 2011 7:30 am
by jmestep
I just tested this in 7.0.6 to see if it was a bug and when I had a bundled or itemized kit in the cart and deleted it, it deleted all the items. I don't understand why it shouldn't do this- if a merchant is making a kit, a lot of times they have items in there with special prices because they are part of a kit, so they would want all those items deleted also. This was testing with Able's sample build your own computer kit and all the component parts are private.
What am I missing?

Re: Kit issues during checkout in 7.06 ?

Posted: Tue Feb 22, 2011 9:52 am
by compunerdy
Give this a try.

Go here http://www.thecustomsabershop.com/Build ... -P469.aspx

add it to your cart

go to the basket

click delete on the item, not "clear cart" which does work.

Re: Kit issues during checkout in 7.06 ?

Posted: Tue Feb 22, 2011 12:46 pm
by calvis
That is certainly very odd behavior and not something that should be happening.

In fact, I am going through all of Tim's kits to see if I can find some killer deals. :)

Re: Kit issues during checkout in 7.06 ?

Posted: Wed Feb 23, 2011 5:14 am
by mazhar
I was able to confirm it and created an entry for this in our logs.

Re: Kit issues during checkout in 7.06 ?

Posted: Wed Feb 23, 2011 5:09 pm
by Logan Rhodehamel
Until a proper fix can be determined, prevent this from happening with a slight code change. Find ConLib\Basket.ascx.cs and locate this code:

Code: Select all

    protected void BasketGrid_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
    {
        Basket basket;
        int index;
        switch (e.CommandName)
        {
            case "SaveItem":
                basket = Token.Instance.User.Basket;
                index = basket.Items.IndexOf(AlwaysConvert.ToInt(e.CommandArgument.ToString()));
                if ((index > -1))
                {
                    basket.Items.MoveToWishlist(index, Token.Instance.User.PrimaryWishlist);
                }
                break;
            case "DeleteItem":
                basket = Token.Instance.User.Basket;
                index = basket.Items.IndexOf(AlwaysConvert.ToInt(e.CommandArgument.ToString()));
                if ((index > -1))
                {
                    basket.Items.DeleteAt(index);
                }
                break;
            case "DeleteCouponItem":				
                basket = Token.Instance.User.Basket;							
                index = basket.Items.IndexOf(AlwaysConvert.ToInt(e.CommandArgument.ToString()));				
                if ((index > -1))
                {
                    BasketItem bitem = basket.Items[index];
                    if (bitem.OrderItemType == OrderItemType.Coupon)
                    {
                        basket.Items.DeleteAt(index);
                        foreach (BasketCoupon cpn in basket.BasketCoupons)
                        {
                            if (cpn.Coupon.CouponCode == bitem.Sku)
                            {                                
                                basket.BasketCoupons.Remove(cpn);
                                cpn.Delete();
                                basket.BasketCoupons.Save();
                                break;
                            }
                        }
                    }                    
                }
                break;
        }
    }
Update the content of this method with this code:

Code: Select all

    protected void BasketGrid_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
    {
        Basket basket = Token.Instance.User.Basket;
        int index;
        switch (e.CommandName)
        {
            case "SaveItem":
                index = basket.Items.IndexOf(AlwaysConvert.ToInt(e.CommandArgument.ToString()));
                if ((index > -1))
                {
                    basket.Items.MoveToWishlist(index, Token.Instance.User.PrimaryWishlist);
                }
                break;
            case "DeleteItem":
                index = basket.Items.IndexOf(AlwaysConvert.ToInt(e.CommandArgument.ToString()));
                if ((index > -1))
                {
                    basket.Items.DeleteAt(index);
                }
                break;
            case "DeleteCouponItem":				
                index = basket.Items.IndexOf(AlwaysConvert.ToInt(e.CommandArgument.ToString()));				
                if ((index > -1))
                {
                    BasketItem bitem = basket.Items[index];
                    if (bitem.OrderItemType == OrderItemType.Coupon)
                    {
                        basket.Items.DeleteAt(index);
                        foreach (BasketCoupon cpn in basket.BasketCoupons)
                        {
                            if (cpn.Coupon.CouponCode == bitem.Sku)
                            {                                
                                basket.BasketCoupons.Remove(cpn);
                                cpn.Delete();
                                basket.BasketCoupons.Save();
                                break;
                            }
                        }
                    }                    
                }
                break;
        }

        // remove orphaned items
        for (int i = basket.Items.Count - 1; i >= 0; i--)
        {
            int parentId = basket.Items[i].ParentItemId;
            if (parentId != 0 && basket.Items.IndexOf(parentId) < 0)
            {
                basket.Items.DeleteAt(i);
            }
        }
    }