Keyword

Hide empty subcategories

  • Bram Van Grimberge
  • Bram Van Grimberge's Avatar Topic Author
  • Offline
  • New Member
More
13 years 7 months ago #93739 by Bram Van Grimberge
Hide empty subcategories was created by Bram Van Grimberge
Hi,

 

I'm trying to hide empty subcategories (categories containing 0 items) but I can't seem to find this in the settings. I've searched the forum for this topic, but the solution was on a site that is no longer available (gworldz.com)

 

The page for which I want to hide the empty subcategories: www.hqgames.be/test/joomla/index.php/spellen

 

I've looked at the category.php code and I know I should hide the div with class 'subCategoryContainer'

 when "$subCategory->numOfItems" equals 0. Bit I am not familiar with php to accomplish this.

 

Can Anyone help me out?

 

thank you!

 

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

More
13 years 7 months ago #93740 by Roger Edrinn
Replied by Roger Edrinn on topic Hide empty subcategories
I don't have THE answer, but from what I've learned you need to do this:


Go the global parameters and set to hide categories
Do the same for Categories and sub categories because they are usually set to inherit from the higher category
Now for the Non-empty subcategories, set them to show individually

There is no global way to set empty to hide.

 

Happy K2 :)

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

More
13 years 7 months ago #93741 by marioglez
Replied by marioglez on topic Hide empty subcategories
You have to use an if statement in php in the categories template file...

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

More
13 years 6 months ago #93742 by Eminov Merdan
Replied by Eminov Merdan on topic Hide empty subcategories
So, what you were had to do is to go to /components/com_k2/templates/default/category.php, and find div with class 'subCategoryContainer' press "-" sign( that near the line numbers) on this line and write around this <div> if statement, So, you'll have next picture!

 


I've been using Notepad++

P.S.: Thank you all! I was solving the same problem and i'm very very new to Joomla and especially to K2

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

More
13 years 6 months ago #93743 by william white
Replied by william white on topic Hide empty subcategories
@ eminov    Nice Code!

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

More
13 years 1 week ago #93744 by star R.
Replied by star R. on topic Hide empty subcategories
It is difficult to find exactly what to look for and change in the category.php override file. It is also unclear if this code should simply be added, or if something should be changed instead.

 

Perhaps you can just post the code to search for, then paste the correction below that.

 

Thanks

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


Powered by Kunena Forum