[Answered] Query from one category to another

More
11 years 11 months ago #24862 by igcorreia
I need help please,

I have creating a custom category and template called:
Courses
From another template for and category called:
Videos
I want to COUNT how many item are inside the COURSES category.

My problem is that when I am in the VIDEOS category and I count $items the result is showing me all the items inside the VIDEOS category, what I need is something like this:
Code:
count($flexicontent->category['courser']->items);

Is something like this possible? Any help is welcome.

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

More
11 years 11 months ago #24881 by igcorreia
Any help? Please.

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

More
11 years 11 months ago #24886 by ggppdk
If it is a subcategory of current category then info is already there , look at category_category.php

Otherwise you can use:
Code:
$catid = (int) $some_cat_slug; // ...!!! $query= 'SELECT COUNT(*) FROM #__content AS i' . ' JOIN #__flexicontent_cats_item_relations AS rel ON rel.itemid = i.id' . ' WHERE rel.catid='.$catid; $db=JFactory::getDBO(); $db->setQuery($query); $count = $db->loadResult(); echo $count;

Regards


-- 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.

More
11 years 11 months ago #24907 by igcorreia
Your code incorrect i think.
Change:
Code:
$catid = (int) $some_cat_slug; // ...!!!
To with example:
Code:
$catid = (98) //Your Category ID!
The result is working correctly, I think.

Mark as Solved please.

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

More
11 years 11 months ago #24908 by micker
it's do ! ;)

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
11 years 11 months ago #24917 by ggppdk
The line was an EXAMPLE, of course the variable "some_cat_slug" does not exist, it simply stated that the $catid must be a number. You might have the catid in the form :

"98:somecatname"

in this case you need to convert it to integer

Regards


-- 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.304 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