How can I get the category type using a Joomla category node?

More
5 years 5 months ago - 5 years 5 months ago #75103 by riiich
I have a Joomla category list called from SQL and need the FlexiContent 'type' of the category, for example...
Code:
... $database = JFactory::getDBO(); $database->setQuery("SELECT * FROM #__categories WHERE parent_id=".$id." AND published = 1 ORDER BY lft"); $categories = $database->loadObjectList(); foreach ($categories as $category) { //$type = ...? } ...

Is there a method I can call to get the Flexi field 'type' for the categories in the array? Or is there a way I can ammend the SQL call to obtain the type?

Thanks
Last edit: 5 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago - 5 years 5 months ago #75104 by ggppdk
Hello

you can use the code that you are using in your example

To get Flexicontent category configuration you can
Code:
foreach ($categories as $category) { $category->config = new JRegistry($category->params); }
if you want to get item counts then you can use our global (Cached) variable $globalcats
it is cached because it contains also things like item counts that consider multi-category assignments, which can be a little heavy
e.g. 0.2 seconds in large websites,

please do not modify it
if you want to modify assign the array to a new variable
global $globalcats;
$cats = $globalcats;


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 5 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #75157 by riiich
Apologies for not replying. I found that categories don't store types (as far as I'm aware). So although I set the type on the category, the only place to get the value is to check an item inside the category for the 'type_id' field.

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #75161 by ggppdk
Hello

you mean that in types manager you have edited a type and limited the type to a specific category subtree ?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.311 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline