Kit issues during checkout in 7.06 ?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
wiredbox
Ensign (ENS)
Ensign (ENS)
Posts: 4
Joined: Sat Feb 19, 2011 8:34 pm

Kit issues during checkout in 7.06 ?

Post by wiredbox » Mon Feb 21, 2011 7:13 pm

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 ?

User avatar
compunerdy
Admiral (ADM)
Admiral (ADM)
Posts: 1283
Joined: Sun Nov 18, 2007 3:55 pm

Re: Kit issues during checkout in 7.06 ?

Post by compunerdy » Mon Feb 21, 2011 8:11 pm

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.

wiredbox
Ensign (ENS)
Ensign (ENS)
Posts: 4
Joined: Sat Feb 19, 2011 8:34 pm

Re: Kit issues during checkout in 7.06 ?

Post by wiredbox » Mon Feb 21, 2011 8:27 pm

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 />

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Kit issues during checkout in 7.06 ?

Post by jmestep » Tue Feb 22, 2011 7:30 am

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?
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
compunerdy
Admiral (ADM)
Admiral (ADM)
Posts: 1283
Joined: Sun Nov 18, 2007 3:55 pm

Re: Kit issues during checkout in 7.06 ?

Post by compunerdy » Tue Feb 22, 2011 9:52 am

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.

User avatar
calvis
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 710
Joined: Tue Jan 27, 2004 3:57 pm
Location: Redmond, WA

Re: Kit issues during checkout in 7.06 ?

Post by calvis » Tue Feb 22, 2011 12:46 pm

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. :)
Able Customer Since 1999 Currently Running on GOLD R12 SR1 and PCI Certified.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Kit issues during checkout in 7.06 ?

Post by mazhar » Wed Feb 23, 2011 5:14 am

I was able to confirm it and created an entry for this in our logs.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Kit issues during checkout in 7.06 ?

Post by Logan Rhodehamel » Wed Feb 23, 2011 5:09 pm

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);
            }
        }
    }
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

Post Reply