Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Calling in fields from parent categories

Quote Reply
Calling in fields from parent categories
I'm working on a site that has approximately 4000 categories all up. 40 of these are at root level and the entire category structure is 3 levels deep
ie. Country > State > City

I have 4 fields in the category database (All text fields) that will be displayed on the category.html pages.
The text for each country will be relevant for all the subcategories under that root level category. Rather than have to add text to 3 fields in 4000 category records, I figure it would be better to simply add the text to the Country (root level) category fields and then call it in to the template for all the subcategories.

In theory it sounded good, until I tried to figure out how it could be done. Unsure

I was thinking something along the lines of a global, that when passed the CategoryID, would check to see if the FatherID = 0, and if it didnt, it would then get the record of the Parent category by selecting the ID which of course was the FatherID of the subcategory we started at, and repeat this step until the FatherID did in fact = 0, then grab the data from the fields of the root level Category.

Does this sound like the right way to go about this, and if so could 1 global be used to return the data for all 4 fields, or will I need a global for each?

My global building skills are extremely limited and to be honest I dont like my chances of even coming close to achieving this, so if someone could help me out here or at least get me on the right track it would be very much appreciated.

Quote Reply
Re: [marker] Calling in fields from parent categories In reply to

Try this thread for some ideas:
Quote Reply
Re: [afinlr] Calling in fields from parent categories In reply to
Hi Laura,

Thanks for the quick response, that certainly looks like a much simpler way of approaching it, I think even I can get this working Wink

Very much appreciated Smile