Page 1 of 1
Continuing Orphaned Items
Posted: Wed Nov 26, 2008 2:20 pm
by heinscott
Hello...
I'm again seeing items in my orphaned items list that have not been edited in any way. We have been adding new product to our catalog, but, existing items have not been edited at all. This is for a few different items... whether actual product, or components of a kit. There doesn't seem to be any consistent data across these items either. All showed either positive in stock levels, inv tracking disabled... The only thing that is consistent, is that for some reason, they lost the categories they were associated with.
Can someone please help me out with this? I have to check the orphaned items table every day to make sure nothing is in it again!
Thanks for the help.
Scott
Re: Continuing Orphaned Items
Posted: Wed Nov 26, 2008 2:42 pm
by heinscott
Hello again... It seems that I have figured out why the problem is occurring, but, not how to fix it

Here is an example:
Whenever we have a product where the ProductId is equal to a Category with the same CategoryId
(1439 Polaris Ball Bearing (ATV-380-360) PRODUCT 1439 Solar Pool Cover CATEGORY)
and we delete the Category, not only will all the Node associations for that category get deleted, but so will the ones for the Product. It seems that the NodeTypeId is not being checked during the delete process.
Any help on this???
Thanks again,
Scott
Re: Continuing Orphaned Items
Posted: Wed Nov 26, 2008 3:12 pm
by AbleMods
heinscott wrote:Whenever we have a product where the ProductId is equal to a Category with the same CategoryId...
I don't understand. Do you mean when you delete ProductId 482 and you have a category that also happens to have Id 482, the nodes for the whole category are getting deleted along with the one product?
Re: Continuing Orphaned Items
Posted: Wed Nov 26, 2008 3:15 pm
by heinscott
Yes, that is exactly what I mean. Just to test, I ran the query "Select A.ProductId, A.Name, B.Name from ac_Products A INNER JOIN ac_Categories B ON A.ProductId = B.CategoryId", and got a list of all products/categories with matching ids. Then, I deleted one of the categories (that we didn't have products in yet), and sure enough... The product showed right up in the orphaned items list.
Re: Continuing Orphaned Items
Posted: Wed Nov 26, 2008 3:17 pm
by heinscott
Actually, I guess we're having the opposite problem from what you described... We delete the category, and the product loses it's categories.
Re: Continuing Orphaned Items
Posted: Wed Nov 26, 2008 3:24 pm
by nickc
Your initial report sounded familiar...
http://bugs.ablecommerce.com/show_bug.cgi?id=7056
- now seems that things are still not quite right with deletion cascade in the CatalogNodes table.
Re: Continuing Orphaned Items
Posted: Wed Nov 26, 2008 3:56 pm
by jmestep
A co-worker had that problem with a site he did and was never able to pinpoint the problem since the pages were heavily customized.
Draneb has reported the problem also.
This is the first clue as to why it is happening, which is good.
Re: Continuing Orphaned Items
Posted: Thu Nov 27, 2008 6:35 am
by mazhar
This is due to the following bug
http://bugs.ablecommerce.com/show_bug.cgi?id=7056
Currently this is fixed in AC7.1 but not yet fixed in AC7.0.
Re: Continuing Orphaned Items
Posted: Thu Nov 27, 2008 8:19 am
by jmestep
I know Able recommended waiting for 7.2 unless we needed new international stuff in 7.1. This is a pretty serious bug. Will it be fixed in 7.0? If not, then we should probably upgrade to 7.1?
Re: Continuing Orphaned Items
Posted: Thu Nov 27, 2008 12:31 pm
by mazhar
If you people think that this fix is critical for AC7 then better some one from you should throw a ticket request.
Re: Continuing Orphaned Items
Posted: Fri Nov 28, 2008 11:10 am
by heinscott
Either that, or would it be possible to get the code for the cascade category delete? I wouldn't mind, for the time being, creating a custom fixed method to handle the delete for me.
I'm sure I could come up with something, but would rather make sure that I'm catching all the related data.
Thanks Mazhar.
Scott
Re: Continuing Orphaned Items
Posted: Fri Nov 28, 2008 11:20 am
by mazhar
It would be better to open a ticket.
Re: Continuing Orphaned Items
Posted: Wed Dec 03, 2008 9:14 am
by heinscott
In case this helps anyone while waiting for the fix in 7.1, I've modified the delete method for a Category type CatalogNode to re-create any product types after the Category delete. This will take care of the orphaned products.
In the browse.aspx.cs file (Admin/Catalog), find the DoDelete method. Change the case CatalogNodeType.Category in the switch statement to:
Code: Select all
case CatalogNodeType.Category:
List<int> Categories = new List<int>();
List<short> OrderByList = new List<short>();
Category category = CategoryDataSource.Load(catalogNodeId);
if (category != null)
{
CatalogNodeCollection cnc = CatalogNodeDataSource.LoadForCriteria("CatalogNodeId = " + catalogNodeId + " AND CatalogNodeTypeId = 1");
foreach (CatalogNode cn in cnc)
{
Categories.Add(cn.CategoryId);
OrderByList.Add(cn.OrderBy);
}
category.Delete();
for (int i = 0; i < Categories.Count; i++)
{
CatalogNode cn = new CatalogNode(Categories[i], catalogNodeId, CatalogNodeType.Product, OrderByList[i], true);
cn.Save();
}
}
break;
Hope this is helpful.
Scott