Welcome, Guest
Username: Password: Remember me
Please do not post off-topics

TOPIC: Category Count Include Sub Categories

Category Count Include Sub Categories 2 years 3 months ago #10292

  • Scott
  • Scott's Avatar
  • OFFLINE
  • User
  • Posts: 25
  • Karma: 0
I would like main categories to display the count of sub categories instead of 0. For example I have a math category and a sub category of algebra and although there are quizzes in the algebra section the math category count shows 0 so that it looks like there are no quizzes.

I hope that makes sense.
The administrator has disabled public write access.

Re: Category Count Include Sub Categories 2 years 3 months ago #10295

  • Maverick
  • Maverick's Avatar
  • OFFLINE
  • Developer
  • Posts: 8528
  • Thank you received: 775
  • Karma: 167
I will make a note of it. In fact this is what I thought of as did with Community answers.
If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory (direct links are given below).
Community PollsCommunity AnswersCommunity QuizCommunity QuotesCommunity Surveys
Community CrosswordsGPS ToolsArticle SuggestionsCjBlog
The administrator has disabled public write access.
The following user(s) said Thank You: Scott

Re: Category Count Include Sub Categories 2 years 3 months ago #10301

  • Scott
  • Scott's Avatar
  • OFFLINE
  • User
  • Posts: 25
  • Karma: 0
I'm not great with PHP but would be happy to edit the specific file. If it requires you collecting data from another table perhaps you could just share the code/file to remove the count (0) as any categories would have quizzes.

Thanks for all of your help!
The administrator has disabled public write access.

Re: Category Count Include Sub Categories 2 years 3 months ago #10305

  • Maverick
  • Maverick's Avatar
  • OFFLINE
  • Developer
  • Posts: 8528
  • Thank you received: 775
  • Karma: 167
It needs adjusting the count everytime a new post is made.

Edit components/com_communityquiz/models/quiz.php and find below code at line 288
$query = 'update '.T_QUIZ_CATEGORIES.' set quizzes=quizzes+1 where id='.$catid;
change it to
$query = 'select id, nleft, nright from '.T_QUIZ_CATEGORIES.' where id='.$catid;
$this->_db->setQuery($query);
$category = $this->_db->loadObject();

$query = 'update '.T_QUIZ_CATEGORIES.' set quizzes=quizzes+1 where nleft<='.$category->nleft.' and nright>='.$category->nright;
If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory (direct links are given below).
Community PollsCommunity AnswersCommunity QuizCommunity QuotesCommunity Surveys
Community CrosswordsGPS ToolsArticle SuggestionsCjBlog
Last Edit: 2 years 3 months ago by Maverick.
The administrator has disabled public write access.
The following user(s) said Thank You: Scott

Re: Category Count Include Sub Categories 2 years 3 months ago #10368

  • Scott
  • Scott's Avatar
  • OFFLINE
  • User
  • Posts: 25
  • Karma: 0
My apologies for the delay in replying and appreciation for your suggestion. I made the change recommended above, cleared my cache and started a new session but still don't see the number of quizzes in subcategories reflected on the main page.

It's still Science (0) even though there are two quizzes in Biology.
The administrator has disabled public write access.

Re: Category Count Include Sub Categories 2 years 3 months ago #10434

  • Scott
  • Scott's Avatar
  • OFFLINE
  • User
  • Posts: 25
  • Karma: 0
Bump
The administrator has disabled public write access.

Re: Category Count Include Sub Categories 2 years 3 months ago #10438

  • Maverick
  • Maverick's Avatar
  • OFFLINE
  • Developer
  • Posts: 8528
  • Thank you received: 775
  • Karma: 167
Scott, contact me through contact us form, I will send you update.
If you use our extensions, please post a rating and a review at the Joomla! Extensions Directory (direct links are given below).
Community PollsCommunity AnswersCommunity QuizCommunity QuotesCommunity Surveys
Community CrosswordsGPS ToolsArticle SuggestionsCjBlog
The administrator has disabled public write access.
The following user(s) said Thank You: Scott
Time to create page: 0.106 seconds
Powered by Kunena Forum