R11 SR1 delete products in batch

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

R11 SR1 delete products in batch

Post by jmestep » Sun Oct 01, 2017 11:49 pm

We have a client who is trying to delete products in a batch from Catalog/Browse and keeps getting the error below if they try to delete 50 at a time- I had to use Elmah error logging to capture it. I was able to test and sometimes it worked, sometimes it didn't. I tested with 20 on a page and it did those products OK, even if they were included in the batch of 50 that failed. They have a few of the products that are in more than one category, if that is any help.
GPSStale.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
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: R11 SR1 delete products in batch

Post by Katie » Mon Oct 02, 2017 1:35 am

Does it work if they use the delete multiple function from the Product Manager?
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

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

Re: R11 SR1 delete products in batch

Post by jmestep » Wed Oct 04, 2017 2:36 am

We tested on their live site and their dev site. We selected a category in the product manager and there were 921 products. We changed the page to show 50. We checked the box to check all and didn't expand to do all the products. Selected delete and clicked and nothing happened, they weren't deleted, no error was shown.

I just tried it again at 20 per page of the 921 products and put logging code in and it said it was deleting them but didn't.
I was able to delete products from categories that had fewer products.

Code: Select all

 public static bool DeleteProducts(int[] productIds)
        {
            List<string> ids = new List<string>();
            IDatabaseSessionManager database = AbleContext.Current.Database;
            database.BeginTransaction();
            foreach (int pid in productIds)
            {
                ProductDataSource.Delete(pid);
                Logger.Warn("Line 123 deleting " + pid.ToString());
            }
            database.CommitTransaction();
            return true;
        }
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
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: R11 SR1 delete products in batch

Post by Katie » Thu Oct 05, 2017 5:36 am

Unfortunately, I don't have easy access to a R11 install right now, but here are a couple things you can look for.

- try getting a result set that DOESN'T trigger the paging and the fancy script that allows you to select from multiple pages.
- is it getting hung up on products that are assigned to multiple categories, or that have digital goods or subscriptions?

I just don't have a clue on where to start looking, or why your logging code isn't working. But, maybe it would help if there were a little more info about the products that are being deleted.

Thanks
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

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

Re: R11 SR1 delete products in batch

Post by jmestep » Thu Oct 12, 2017 3:23 am

I tested on a local R11 site of mine after getting the products from the problem site and ran into the same problem. On both the browse and ManageProducts page, the error is thrown at database.CommitTransaction(). I commented out the transaction code and was able to delete OK. Some of the products are in two categories, if that helps. I had the display size set to 50 products.
I've attached an image of debugging on the Browse page.
transaction.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
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: R11 SR1 delete products in batch

Post by Katie » Fri Oct 13, 2017 5:27 am

Hi Judy,

I am going to try and setup a Gold install so I can test this. Give me a few days though...

Thanks
Katie
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

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

Re: R11 SR1 delete products in batch

Post by jmestep » Mon Oct 16, 2017 12:12 am

Katie,
I can give you access to a dev site to test it, but I'm not sure that doing that or your setting up a site would help. There are reports of similar errors on Google and it seems to be that somehow the session gets out of sync with what is in the database and it's pretty elusive. One of the recommendations was to open a new session, but I'm not sure I can do that in the code since AC controls the session. Right now after taking the transaction code off, the merchant is able to delete 50 several times before he runs into a problem. Then he can delete more the next day. I just put code in to wrap each delete in a transaction to see if that helps. It's not the best way to do it, but it might get him by.
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