Page 1 of 1

Webpages/Links and CatalogNodes

Posted: Wed Jul 25, 2012 1:00 pm
by sloDavid
In the database, how to Webpages relate to their particular CatalogNode? I don't see the data anywhere. I need to run a custom query on Webpages within a particular category, for some custom fields that I've added. Same for Links.

Re: Webpages/Links and CatalogNodes

Posted: Wed Jul 25, 2012 5:51 pm
by david-ebt
They are in the ac_CatalogNodes table. CatalogNodeTypeId = 2 for webpages. (0 = category, 1 = product, 3 = link).

Re: Webpages/Links and CatalogNodes

Posted: Wed Jul 25, 2012 6:58 pm
by sloDavid
I understand that, but my question is how do I know which specific Webpage correlates to a given ac_CatalogNodes record (assuming, of course, that the CatalogNodeTypeId = 2)?

Re: Webpages/Links and CatalogNodes

Posted: Thu Jul 26, 2012 9:15 am
by david-ebt
So you want to get all the webpages for a specific category?

Here's a SQL Query that will return the webpage data. You can add a WHERE clause for the appropriate CategoryID

Code: Select all

select cn.CategoryId, wp.*
from ac_CatalogNodes cn
join ac_Webpages wp on cn.CatalogNodeId = wp.WebpageId
where cn.CatalogNodeTypeId = 2
You can also use the CatalogNodeDataSource.LoadForCategory to return all the nodes and loop through that collection looking for the nodes that are of type webpage.

Re: Webpages/Links and CatalogNodes

Posted: Thu Jul 26, 2012 11:35 am
by sloDavid
Ah, my bad; I misunderstood the table's keys. I thought CatalogNodeId was the primary key by itself, not a (sort of) foreign key.

Re: Webpages/Links and CatalogNodes

Posted: Thu Jul 26, 2012 11:44 am
by david-ebt
This is one of the few places where the ID isn't a unique key. It's a nice structure for mixing the category structure with the content (webpage, product, link). When you're just looking for products or webpages or links in a category it's a little weird.