7.0.3 Add to cart bug (maybe)

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

7.0.3 Add to cart bug (maybe)

Post by jmestep » Tue Jun 16, 2009 10:11 am

Would someone else test the following procedure? If we don't have the minibasket on a product page, and click to add a product to the cart, it doesn't get added. Then if I go to the cart - nothing is there- and come back to to the product, we can add the product. My test 14458 has that problem, a store that upgraded from 7.0.2 to 7.0.3 and went live today has the problem- it didn't have it in 7.0.2.
Here is what I do
Take any scriplets out of nav display on product page if they have the minibasket in them.
Clear cookies in the browser
Go to product page and try to add to cart. I've clicked up to 10 times and it doesn't get added.
Go to basket page -- nothing in cart
Go back to product page and try to add again-- it works this time.

My test site doesn't show an error, but the live site shows:
The INSERT statement conflicted with the FOREIGN KEY constraint "ac_Baskets_ac_BasketItems_FK1". The conflict occurred in database "xxx", table "dbo.ac_Baskets", column 'BasketId'.

Thanks
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
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: 7.0.3 Add to cart bug (maybe)

Post by jmestep » Tue Jun 16, 2009 12:12 pm

I was able to fix this by putting the basket.Package(true) in this code block. I haven't completely tested to make sure it caused other problems, but I think this is a bug and if someone else can confirm it, I will put in a bug report.

Code: Select all

                // THERE ARE NO AGREEMENTS, SO SAVE THIS ITEM INTO THE BASKET
                Basket basket = Token.Instance.User.Basket;
                basket.Items.Add(basketItem);
                basket.Package(true);
                basketItem.Save();

Edit: This was done in the BuyProductDialog.ascx.cs
Last edited by jmestep on Mon Jul 13, 2009 1:22 pm, edited 1 time in total.
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
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: 7.0.3 Add to cart bug (maybe)

Post by mazhar » Wed Jun 17, 2009 6:33 am

There seems to be something wrong, Judy after case reproduction could you check your error log and post information here if there is any? For me its reporting FOREIGN KEY problem.

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

Re: 7.0.3 Add to cart bug (maybe)

Post by jmestep » Wed Jun 17, 2009 10:16 am

I posted a bug on it and mentioned that we fixed it putting basket.Package(true) into the code.
I wasn't getting popup error messages on my test site, just nothing was happening. I just checked the error log and it was the same errors I was getting on the live site.
basketerror.JPG
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
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: 7.0.3 Add to cart bug (maybe)

Post by mazhar » Wed Jun 17, 2009 10:26 am

Thanks Judy

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

Re: 7.0.3 Add to cart bug (maybe)

Post by jmestep » Wed Jul 01, 2009 7:15 am

I know there is a bug report, but I can't post to it. I just found an error on a 7.0.2 store that did have the basket.Package(true) code in the BuyProductDialog, but still got the error. Or maybe it's a new one.
Could not calculate with the configured tax provider.
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
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: 7.0.3 Add to cart bug (maybe)

Post by draneb » Sat Jul 04, 2009 9:00 am

I really do not want the minibasket because I offer engraving and when a customer types in engraving the minibasket doesn't wrap the text and it can make it extend all across the width of the page. So, I removed it from the right sidebar.
Now, when I try adding an item to the basket it throws an error and I get this message in the Admin.

Exception of type 'System.Web.HttpUnhandledException' was thrown.; The INSERT statement conflicted with the FOREIGN KEY constraint "ac_Baskets_ac_BasketItems_FK1". The conflict occurred in database "(mydbname)", table "dbo.ac_Baskets", column 'BasketId'. The statement has been terminated.

Does Judy's fix above work or is there a fix I can do myself without having to wait for a release?
AC 7.0.3 build 13937

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

Re: 7.0.3 Add to cart bug (maybe)

Post by jmestep » Mon Jul 13, 2009 1:00 pm

I couldn't post this to the bug report, but I found out that it doesn't happen if customer is logged in before adding to basket.
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
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: 7.0.3 Add to cart bug (maybe)

Post by draneb » Mon Jul 13, 2009 1:09 pm

Judy,

I was told by my developer that the line of code you posted was supposed to be there and had been there up to 7.0.2 and that it somehow got left out of 7.0.3. He added it back and everything is working fine on my end so far.

Thank you.
AC 7.0.3 build 13937

User avatar
AlexG
Commander (CMDR)
Commander (CMDR)
Posts: 128
Joined: Mon Mar 03, 2008 9:51 pm
Location: StealDeals.com
Contact:

Re: 7.0.3 Add to cart bug (maybe)

Post by AlexG » Sun Sep 20, 2009 12:29 pm

Hi jmestep,
I've the same error!
Did you fixed that error in your web store (7.0.3)?
If yes, Can you explain me how to do this?
Thanks,
Alex

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

Re: 7.0.3 Add to cart bug (maybe)

Post by jmestep » Mon Sep 21, 2009 5:59 am

Yes, the same way as above:
// THERE ARE NO AGREEMENTS, SO SAVE THIS ITEM INTO THE BASKET
Basket basket = Token.Instance.User.Basket;
basket.Items.Add(basketItem);
basket.Package(true);
basketItem.Save();


Edit: This was done in the BuyProductDialog.ascx.cs

Note- if you have the minibasket in the sidebar, it isn't necessary to do this and it will make the minibasket double the quantities.
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
AlexG
Commander (CMDR)
Commander (CMDR)
Posts: 128
Joined: Mon Mar 03, 2008 9:51 pm
Location: StealDeals.com
Contact:

Re: 7.0.3 Add to cart bug (maybe)

Post by AlexG » Mon Sep 21, 2009 9:06 am

THANK YOU!

YOU ARE THE BEST!


jmestep wrote:Yes, the same way as above:
// THERE ARE NO AGREEMENTS, SO SAVE THIS ITEM INTO THE BASKET
Basket basket = Token.Instance.User.Basket;
basket.Items.Add(basketItem);
basket.Package(true);
basketItem.Save();


Edit: This was done in the BuyProductDialog.ascx.cs

Note- if you have the minibasket in the sidebar, it isn't necessary to do this and it will make the minibasket double the quantities.

markpuck
Ensign (ENS)
Ensign (ENS)
Posts: 10
Joined: Mon Aug 03, 2009 11:30 pm

Re: 7.0.3 Add to cart bug (maybe)

Post by markpuck » Fri Dec 11, 2009 11:54 am

I've added this fix and it solves the insert error. There is one bad side-effect to this (that I've found):
- go to a product, click add to cart
- click keep shopping button to return to same product
- click add to cart again
you now have 3 of these items in the cart instead of 2.

So each add of an already existing item adds 2 more of them to the cart.

Are there any other fixes for this or the insert error?

I'm using 7.0.3.

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

Re: 7.0.3 Add to cart bug (maybe)

Post by jmestep » Fri Dec 11, 2009 1:58 pm

Yes, Able came out with the real fix. Mine was just a hack to get something to work.
Their fix is at help.ablecommerce.com - free patches for 7.0.3
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
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: 7.0.3 Add to cart bug (maybe)

Post by draneb » Sat Dec 12, 2009 6:10 pm

Hmm... I downloaded the BuyProductDialog.ascx.cs patch but I am still experiencing the problem markpuck described

- go to a product, click add to cart
- click keep shopping button to return to same product
- click add to cart again
you now have 3 of these items in the cart instead of 2.
AC 7.0.3 build 13937

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

Re: 7.0.3 Add to cart bug (maybe)

Post by jmestep » Mon Dec 14, 2009 6:44 am

Did you take the other patches back out?
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
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: 7.0.3 Add to cart bug (maybe)

Post by draneb » Mon Dec 14, 2009 9:05 am

Hi Judy,

I noticed the patch was one file, I think BuyProductDialog. The only change I saw in mine was the one line of code added so I just overwrote my file with the patched file.

I think it is yet another bug. I am experiencing the same thing markpuck mentions.
AC 7.0.3 build 13937

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

Re: 7.0.3 Add to cart bug (maybe)

Post by jmestep » Mon Dec 14, 2009 12:19 pm

Did you put any of my patch into your category display page? I think I had on a site originally. If you did, you need to take it back out also.
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

Post Reply