Needs work
Project:
Term Node Count
Version:
6.x-1.3
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Mar 2009 at 20:53 UTC
Updated:
23 Mar 2013 at 06:57 UTC
Jump to comment: Most recent file
Comments
Comment #1
archard commentedI thought about putting this in originally, but decided to see if there was any interest before I went through with implementing it. I'll put it an admin page in the next version that allows you to toggle the term count for parents between 0 and whatever the sum of all the child terms are.
Comment #2
giorgio79 commentedMuch appreciated archard, looking forward to it. Let me know if you need any assistance.
Comment #3
mrgoltra commentedI was going crazy why parent terms are always 0. I spent the whole weekend trying to figure this out.
Me too, looking forward.
Thank you
Comment #4
archard commentedI worked on it quite a bit last week but didn't finish. I'll be pretty busy for the next 2 or 3 days, but hopefully I'll finish it by this weekend.
Comment #5
Flying Drupalist commentedThanks! Subscribe. :)
Comment #6
archard commentedI need patch testers. I think it works properly but I just don't have time to test it thoroughly.
You need to apply the patch and also put term_node_count.admin_.inc_.txt in the module's root directory and rename it term_node_count.admin.inc
Sorry im a patch noob.
Comment #7
artscoop commentedHi, I've just tested your patch (that I couldn't apply due to errors, whatever. I had to apply it by hand), and it works.
But it doesn't work fine with many taxonomy terms ( It times out after 5 minutes, for about 1000 terms )
I've changed some code (taken from Taxonomy_VTN), and it processes 1000 terms in about 15 seconds, So it is at least 20 times faster.
Here is the function you should replace :
Comment #8
archard commentedThanks artscoop.
I assume the crash happened on the install. I was afraid that might happen and was part of the reason I chose not to include this originally. Without considering child terms you can easily get that counts all in one query (with a couple sub-queries). I'll consider a few possibilities for how to deal with this. I think the use of static caching should solve it. The reason I don't use it now is because if multiple nodes are updated in on operation, like on the node operations page or the devel generate items page, then the node counts will get cached on the first node and not update for the rest. To deal with this I think I'll put a flag inside my count function that will skip the static caching only for certain cases. I should be able to keep the caching in for the install phase.
Comment #9
Marko B commentedCan u post patched file(s) here so i could test it, patch doesnt work for me. Thanx
Comment #10
artscoop commentedHi deepM, you have to apply the patch by hand.
Open the file in a text editor.
You will have to find the lines marked with a "-" in the module and replace them with the next lines marked with a "+" (for example)
You may also have to add lines. These will be marked with a "+" and be preceded by some code in the original module.
Comment #11
ManyNancy commentedIs this patch working? Could this be committed?
Comment #12
alcoder commentedI think this patch is working. I am attaching the whole patched module. The function term_node_count_count_nodes() is replaced by the function written by artscoop. It would be good if the maintainer would create a new release for this project.
Comment #13
ryan88 commentedThank you for your post. This is just what I needed.
Comment #14
dicreat commentedThank you for this patch!
Comment #15
fasdalf@fasdalf.ru commentedFollowing does not work:
1- replace files
2- change setting
3- edit node
but this appears to be working:
1- replace files
2- change setting
3- rebuild node counts
4- save settings page again (why?)
5- edit node
Is that normal?
Also if i remove child term child count decreases, but parent count does not.
P.S. I'm using hierarhical select now.
P.P.S. Without HS thing behave the same.
Comment #16
fasdalf@fasdalf.ru commentedI modified 3 functions to make this module work properly with and without "inherit" setting.
Now uses taxonomy API to determine all parets if necessery
Pulls current revision from {node} table
Counts children's nodes only when inherit option enabled.
Comment #17
marketter commentedSubscribed. Really looking forward to this patch getting added to the next release. Let me know if you need additional testers.
Comment #18
off commented#12 works fine
Comment #19
YK85 commented+1 subscribing
Comment #20
Marko B commentedWhy is no 12 not used in official relase?
Comment #21
Heihachi88 commentedThanks #12, it works perfectly. Dont forget about settings on page → admin/settings/term_node_count
Inherit child term's node counts?: Yes, then rebuild node counts
Comment #22
johan2 commentedHi,
I am trying to figure out why this doesn't work on my site.
I am running D6.22 and replaced "term_node_count-6.x-1.3" after it didn't work with this patch.
But the node count always gives the result 0.
I call the node count through a term-view, even turned off all filters so all nodes should be counted but still it stays 0. The terms are recognized since they show up but the query returns 0.
Anybody has an idea how this happens?
regards,
Johan
Comment #23
aaronbaumanHere's a proper patch from the .zip in #12.
I haven't reviewed this at all, but invoking an uninstall/install function on a form submission is a gigantic waving blinking flashing red flag, so i'll go ahead and mark this needs work.
If I have time I'll re-work this and upload a new version on the off chance anyone still cares about this 3.5-year old feature reqeust.
Comment #24
dizee commentedI still care! :)
Comment #25
gielfeldt commentedThis is issue is probably better addressed at query time:
Tree:
Acquire children tids and use:
I'm also thinking about integrating it with taxonomy edge: