Closed (fixed)
Project:
Advanced Taxonomy Blocks (abandoned)
Version:
6.x-1.8
Component:
Documentation
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
12 Jan 2009 at 17:26 UTC
Updated:
19 Feb 2011 at 14:13 UTC
Hello,
I've read the documentation, but can't see to find a way of displaying all terms for a vocabulary. I want to show all terms even if they have 0 count.
E.g.: a vocabulary
Vocab
- term 1 (5)
- term 2 (2)
- term 3 (0) ==> list will be empty
- term 4 (1)
Is this possible with the UI?
TIA,
Fossie
Comments
Comment #1
mrmelson commentedI would find this useful, too.
I have a hierarchy where some terms have no nodes ... but sub-categories do.
E.G.
Vegetables (1)
Fruits (0)
- Apples (2)
- Oranges (1)
Right now, the Fruits terms is dropped b/c it doesn't have any nodes ... so I can't get to the nodes in the sub-categories.
Comment #2
PixelClever commentedThat was by design, it isn't good to send users to empty pages. The best way around this is to tag the node with the parent term also. So if you tag a post with oranges tag it with fruit as well. I might consider making an option for showing empty terms, but I am not sure yet.
Comment #3
sheena_d commentedWould it be possible for terms that have children and a node count of 0 to be displayed as text with no link? Thus, we still get our full hierarchy in the block, don't send users to empty pages, and we do not have the duplicate content that would come from assigning a node to multiple terms.
Comment #4
smokris+1. I like that idea, particularly as a means of avoiding duplicate content.
I'm thinking this should be an option (off by default to match current behavior).
Comment #5
Flying Drupalist commentedYes, I was wondering why my hierarchy has disappeared. Because my nodes are all on the lowest level hierarchy, I don't see any containers.
"The best way around this is to tag the node with the parent term also. So if you tag a post with oranges tag it with fruit as well."
This is too much work for the end user!
"I might consider making an option for showing empty terms, but I am not sure yet."
Please do, this is very important to not have my hierarchy destroyed.
Can forum containers also be supported as well? So I don't just see a non hierarchical, flat list.
Comment #6
PixelClever commentedI am more inclined to write a module that automatically tags parent terms than I am to create an option to create broken links. However if you need it badly enough post a well written patch and if it test out I will add it under the following conditions:
1. The option must be turned off by default
2. No new tables or alterations to tables are made. Use a variable_set().
3. The code should be clean and in accordance to Drupal coding standards.
Otherwise I really don't have time to set aside to develop something this questionable. Especially considering the fact that the main project page has stated from the beginning that this was by design.
As for forums and their containers... that would require an entirely different approach than this module provides. It could easily be done with a new module using the jquerymenu api. But this is a separate issue... one issue to a thread please or it will probably get lost and forgotten.
Comment #7
Flying Drupalist commentedWhat do you mean broken links? The links would show the child terms?
Without containers you can't have a hierarchy?
Comment #8
Mac Ryan commentedThe problem with this is that you are assuming the link would be to an empty page.
In reality this is not the only possibility, in fact my views are such that they display all the nodes with children terms, in addition to the one with the parent term, so: none of the links points to an empty page.
It might be that some users would have the link pointing to an empty page, but this is just one of the possibilities, so IMO the design should allow for a configuration option in the admin settings...
Comment #9
sheena_d commentedJust as an idea for anyone who is facing this same problem, here is how I am working around it:
1. Downgrade to 6.x-1.7. In the previous version there was a bug that would count a term as "not empty" even if all its nodes were unpublished.
2. Create an unpublished node for each of your parent terms (or if the vocabulary allows multiple select, one unpublished node for all parent terms). Now your taxonomy parents are showing up in your Advanced Taxonomy Block, but you still need to deal with that link to an empty page.
3. Create a View page with taxonomy term id argument. Give the page the path to match the Advanced Taxonomy Blocks menu path. Use Views normally to set up how you want to display the information for each taxonomy term (in my case, I was displaying the teaser and link to full node for every node that matched the taxonomy term argument).
4. in the "empty text" for the view, insert something like this:
where the x in arg(x) is the location of the argument in your URL (ie., if my path is articles/category/% then x=2).
Now any "empty" taxonomy terms will link to a page with a list of that term's children, or if it has no children, the page will simply have the "sorry, no content" message.
And in the interest of full disclosure, I am a Graphic Designer, so I may very well have no clue what I'm doing. However, it works and my co-workers didn't see anything wrong with my code, so I think it's safe to share.
Comment #10
PixelClever commentedI've reconsidered this issue and I have changed my mind. However, this will take more than the hack posted above to do correctly. I am going to work on this and when it is ready I will put it in a dev release.
I don't recommend that anyone downgrades to the 1.7 version as there were bug fixes that would resurface for you.
Comment #11
Mac Ryan commented@Aaron, nice to hear you reconsider this. :)
@All
As for a quick hack to get all the terms listed: in the current version of the module (v 1.9 2009/01/31 21:12:45) go to line 699 of the file taxonomyblocks.module (this line is inside the function taxonomy_recursive_array_builder) and comment out:
$tree[$termname]['link']['hidden'] = '1';so as to have
//$tree[$termname]['link']['hidden'] = '1';Basically what you are doing is removing the instruction that hides nodes from displaying. Of course you can instead hack the code run before that line that makes tests and set the variable $omited to TRUE.... I might doing it myself sometimes in the next days, in which case I will submit a patch.
Comment #12
PixelClever commentedThis feature is in the 2.1 release. You have to visit the update.php page on this version as there is a new table column.
Comment #13
sheena_d commentedThanks for adding this feature, Aaron!
Comment #14
PixelClever commentedNo problem. I actually realized that this can actually be the better way to go, and after testing it I decided to use it on my site.
Comment #16
zeezeeZ commentedHi Aaron,
I was actually glad when you said in the end of this thread that you have added this feature to the latest version. But unfortunately this didn't work for the forums. So I made some alterations (simple) to show empty terms for forum taxonomy block. I've tested it and it all works fine. And it works with forum term hierarchy as well.
So if you ( or anyone else) need that feature I can give the code. I m not sure how to put it as a patch but I can share the module code with the changes.
And Thanks a million for saving us with this module :)
Cheers!!!