Webpages/Links and CatalogNodes

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
sloDavid
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 92
Joined: Thu Feb 25, 2010 12:34 pm

Webpages/Links and CatalogNodes

Post by sloDavid » Wed Jul 25, 2012 1:00 pm

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.

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Webpages/Links and CatalogNodes

Post by david-ebt » Wed Jul 25, 2012 5:51 pm

They are in the ac_CatalogNodes table. CatalogNodeTypeId = 2 for webpages. (0 = category, 1 = product, 3 = link).
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

sloDavid
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 92
Joined: Thu Feb 25, 2010 12:34 pm

Re: Webpages/Links and CatalogNodes

Post by sloDavid » Wed Jul 25, 2012 6:58 pm

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)?

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Webpages/Links and CatalogNodes

Post by david-ebt » Thu Jul 26, 2012 9:15 am

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.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

sloDavid
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 92
Joined: Thu Feb 25, 2010 12:34 pm

Re: Webpages/Links and CatalogNodes

Post by sloDavid » Thu Jul 26, 2012 11:35 am

Ah, my bad; I misunderstood the table's keys. I thought CatalogNodeId was the primary key by itself, not a (sort of) foreign key.

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Webpages/Links and CatalogNodes

Post by david-ebt » Thu Jul 26, 2012 11:44 am

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.
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

Post Reply