Where is Product -> Category relationship stored in database

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
southside2005
Ensign (ENS)
Ensign (ENS)
Posts: 15
Joined: Thu May 08, 2008 8:01 pm

Where is Product -> Category relationship stored in database

Post by southside2005 » Thu Jan 14, 2010 2:36 pm

I'm trying to create a simply query to show list of all public (non-ghosted) products and what category they are in. I can't seem to find the relationship between ac_Products and ac_Categories to pull in the related Category names. Is there an easy way to generate this query or report?

bradtm
Ensign (ENS)
Ensign (ENS)
Posts: 6
Joined: Tue Jan 12, 2010 9:48 am

Re: Where is Product -> Category relationship stored in database

Post by bradtm » Thu Jan 14, 2010 4:39 pm

Yeah I had the same issue as they didn't name this table too well. It's ac_CatalogNodes. CatalogNodeId is ProductId.

southside2005
Ensign (ENS)
Ensign (ENS)
Posts: 15
Joined: Thu May 08, 2008 8:01 pm

Re: Where is Product -> Category relationship stored in database

Post by southside2005 » Thu Jan 14, 2010 5:34 pm

Awesome - exactly what I was looking for. You're right, the name doesn't lend itself to easily find that. Thank you!

Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

Re: Where is Product -> Category relationship stored in database

Post by Mike718NY » Thu Feb 25, 2010 7:37 pm

I'm trying to do the same thing.
Can I steal this SQL off someone :wink:

southside2005
Ensign (ENS)
Ensign (ENS)
Posts: 15
Joined: Thu May 08, 2008 8:01 pm

Re: Where is Product -> Category relationship stored in database

Post by southside2005 » Fri Feb 26, 2010 12:56 pm

This worked for me:

SELECT dbo.ac_Products.ProductId, dbo.ac_Products.Name, dbo.ac_Products.Sku, dbo.ac_Products.Description, dbo.ac_Products.InventoryModeId,
dbo.ac_Products.InStock, dbo.ac_Products.InStockWarningLevel, dbo.ac_Categories.Name AS Expr1
FROM dbo.ac_Categories INNER JOIN
dbo.ac_CatalogNodes ON dbo.ac_Categories.CategoryId = dbo.ac_CatalogNodes.CategoryId INNER JOIN
dbo.ac_Products ON dbo.ac_CatalogNodes.CatalogNodeId = dbo.ac_Products.ProductId
WHERE (dbo.ac_Products.VisibilityId = 0)

Post Reply