CatalogNode Parent Category ID

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

CatalogNode Parent Category ID

Post by jmestep » Tue Feb 10, 2009 7:51 am

I've had to take some objects like webpages and add them to an array list after turning them into catalog nodes. How can I get the category id of the parent category? I've seen it in other places like product.
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
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: CatalogNode Parent Category ID

Post by mazhar » Tue Feb 10, 2009 8:00 am

Try

Code: Select all

catalogNode.CategoryId

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

Re: CatalogNode Parent Category ID

Post by jmestep » Tue Feb 10, 2009 9:28 am

That wasn't coming up in intellisense so I hadn'tused and now it breaks the page.
I'm creating the node from an object that has an id and a type so that I can get a link to it.
CatalogNode node = new CatalogNode(0, objectId2, (byte)objectType2);
The above line is what I have to go on. I can't add the CategoryId in place of the 0 because the custom object doesn't know the category Id.
So I added the following, but it still shows 0 for the category Id
int CID = node.CategoryId;

newNode = new CatalogNode(CID, objectId2, (byte)objectType2);

If I hard-code a number in for the CID, then it picks up that number.
I'm still not able to get the category id. I need something like Lookup the object that has a CatalogNodeId of xx and a type of yy and find the category id for one instance of that node.
Maybe I need to approach this a different way, but I don't know how.
I am just trying to get a category id into the link so that there won't be duplicate content in search engines-- the link works fine with a 0 for the category id.
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
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: CatalogNode Parent Category ID

Post by mazhar » Tue Feb 10, 2009 9:46 am

I think for this you need to query the ac_CatalogNodes table to find out the parent category id. For example

Code: Select all

SELECT CategoryId FROM ac_CatalogNodes WHERE CatalogNodeId = nodeId AND CatalogNodeType = nodeType
You can create another property which returns the parent category ids and when you call that property first it query the ac_CatalogNodes table using above query with the current node id and type of your object.

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

Re: CatalogNode Parent Category ID

Post by jmestep » Thu Feb 19, 2009 8:30 am

I ended up cloning the GetCategoryId(int nodeId, CatalogNodeType nodeType) from the Able source code and it works well.
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