Closed (fixed)
Project:
Hierarchical Select
Version:
7.x-3.0-alpha5
Component:
Code - Taxonomy
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
21 Feb 2011 at 16:12 UTC
Updated:
5 Jun 2015 at 19:31 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
wim leersIf you don't have a lot of experience with Drupal development, then I don't recommend diving in yourself. HS is a highly complex module.
"Save lineage" support will only be added to HS3 if it gets sponsored (or contributed, of course). It will definitely be included in the rewrite of HS, HS 4.
Comment #2
supportPIC commentedok, since I have lot of stuff to do I won't try it for the moment. If I manage to do it sometime I will post a patch...
Comment #3
dgastudio commentedWim, how much will cost:
1.views integration.
2. save lineage feature.
??
Comment #4
wim leerskervi, I can't work on this until July probably. I think that won't be fast enough?
Comment #5
bancarddata commentedI am willing to put up half of the cost for implementing multi-parent/save lineage support in HS3 if anyone wishes to co-sponsor. We are slated to have this project started on the week of July 10.
Comment #6
dgastudio commentedfirst, i would like to know the final cost of the development and if Wim is available to do it.
Comment #7
bancarddata commentedWim said he was available to do it next week and has quoted me 8 hours development time.
Comment #8
bancarddata commentedOK, I am now willing to put up the entire cost to just get the save lineage/multi-parent functionality working in D7. Any takers? I believe Wim is extremely busy again. I can relate or I would try to take this on myself.
Comment #9
hozt commentedI also need this same functionality for a project and have come up with a workaround that will work for my use case until the module is fully ported. I just have two levels in my hierarchy so this may not work for you if you have more.
I created another standard list type term reference field for my entity and set the tree depth to 1. This will hold the parent value of my hierarchy. Then I wrote a custom module that uses hook_entity_presave() to get the parent value from the hierarchy and store it to this new parent term. This example is for entity, but you could use the hook_node_presave() if this is a node.
Then I hid this term from the edit form. Having this extra parent term now allows me to use views and get all the parent entities (commerce products in my case) which is not yet supported in this module.
Comment #10
yareckon commentedHere is a little module that is a bit more general than the last above solution.
You can simply set a vocabulary to make sure that all parent terms are selected every time an entity is saved.
The lineage feature in Heirarchical select should still be implemented, as it is per field rather than per taxonomy.
Comment #11
zeezhao commentedsubscribing. thanks
Comment #12
dgastudio commentedit doesn' work for me
after create 3 levels vocabulary, add a term field with HS widget, enable your module, set the correct vocabulary to "Taxonomies with Lineage" create any new node, set three levels of term field and save, only the last term is saved.
Comment #13
yareckon commentedkervi, is there internationalization involved here? I've realized that my module doesn't really account for that.
Comment #14
yareckon commentedkervi, your taxonomy also has to be set to allow more than one value.. If your taxonomy only allows a single value in the field settings, my module can't do anything :)
Comment #15
dgastudio commented13.. yep.. internationalization is activated...
14.. it's set.
Comment #16
justmagicmaria commented@yareckon, thank you! Your little module was exactly what I needed. I don't know why that feature is not in core. It seems to me the most common case for a hierarchical vocabulary is to want to save the lineage.
Editing to add that it worked fine for me once I set the vocabs through the config form (before that it was complaining about an invalid foreach argument on line 62 of taxonomy_set_lineage.module).
Comment #17
wim leersClosed duplicate at #1111718: Vocabulary with multiple parents.
Comment #18
wim leersComments #9—#16, hah, strange to see an entirely new module being born in a single issue of another module's issue queue! Maybe you should submit this as a new module on Drupal.org? After all, your module is *much* simpler and covers a similar, yet different use case than HS Taxonomy with its "save lineage" functionality.
I've started the implementation of "save lineage" support for D7. bancarddata is sponsoring it.
Comment #19
wim leersCommitted: http://drupalcode.org/project/hierarchical_select.git/commit/acac369. Thanks again to Bancard Data Service for sponsoring this!
Please report if everything is working correctly. If it is, I will do a third alpha release.
Comment #20
dgastudio commentedWim
trying to edit field gadget options.
Fatal error: Call to undefined function tt() in /home/*****/sites/all/modules/hierarchical_select/modules/hs_taxonomy.module on line 939
Comment #21
dgastudio commentedupd. i have i18n enabled with taxonomy. See attached screenshot.
Comment #22
wim leersThat's unrelated to this issue. Line 939 (which is part of
_hs_taxonomy_hierarchical_select_terms_to_options()) was not changed as part of the above commit. Could you please give it a try without i18n?(P.S.: see #1216214: D7 i18n Taxonomy compatibility for HS Taxonomy + i18n in D7, I actually made a commit for this just a few days ago, and fietserwin, the guy who posted the patch, is actually using i18n. So this is quite strange for me. Maybe there are different versions of i18n? But please, let's continue in that issue.)
Comment #23
wim leersbancarddata reported that he was still seeing a "This is a vocabulary with multiple parents. The Drupal 7 port of Hierarchical Select does not yet support this." message. I then realized that I had actually forgotten to enable/test multiple parents functionality: I had only worked on the "save lineage" functionality. I had simply forgotten about that.
While fixing that, I also found http://drupal.org/node/1068070#comment-4840346 (solving #1068070: When multiple HS widgets exist on the same page, and #process order != displayed order: Drupal's JS setting handling breaks HS!) and noticed that it may be impossible to create multiple parent hierarchies (if you upgraded from a D6 site with HS) because
taxonomy_override_selectorapparently still exists for the Taxonomy term create/edit form. Hence, I also implemented the ability to use HS to select parent terms.All of the above has been committed: http://drupalcode.org/project/hierarchical_select.git/commit/e2b1c3c.
Comment #24
davidwhthomas commentedGreat to see the "Save term lineage" functionality being worked on.
Unfortunately, updating to -dev to add this feature caused my field_section term reference field to lose all existing data on node save.
The data still appears to be in the database, but when editing a node, the hierarchical select widget shows as default/empty with no terms selected..
UPDATE: Just an update to this, I suspect this is because existing tagged nodes don't have the parent term saved as well, only the child term, so it shows up as empty in the drop box, with nothing selected..
Comment #25
davidwhthomas commentedOK, I fixed the above issue using yareckon's useful module from #10
1. Install and configure taxonomy_set_lineage for required vocabularies
2. Created a views_bulk_operations view with a 'save content' action
3. Batch re-saved all relevant nodes, this set the term lineage as per taxonomy_set_lineage module
4. Configured hierarchical_select to 'save term lineage'
Done.
Editing an existing node now correctly shows the term lineage.
Thanks again for the excellent module.
DT
Comment #26
wim leers@davidwhthomas: Yes, that would cause problems. Glad you sorted it out! :)
Comment #27
zeezhao commentedWim - when migrating from D6 to D7, please can you confirm what to do to ensure all previous lineages are retained? Or do we also have to follow #25? Thanks.
Comment #28
wim leers@zeezhao: storing lineages does not involve anything special: simply all terms are stored by Taxonomy. You don't have to do anything special: Drupal core's upgrade path also automatically migrates all Taxonomy terms, so there's absolutely nothing you have to do or worry about! :)
Comment #29
zeezhao commentedThanks for reply. The reason I ask is in a D6 to D7 conversion test I did, all the lineages for existing nodes in D7 do not show up when editing the nodes i.e. HS selection is none even though old data indicates otherwise. Whereas they were fine in D6 database.
Comment #30
wim leersIs this using content_taxonomy, maybe?
Also, did you reconfigure your HS widgets? Not all settings are migrated.
Comment #31
zeezhao commentedYes, the HS widgets were reconfigured. Yes, it is also using content_taxonomy. Thanks
[edit]
To add - the weird thing is when I did a conversion a few weeks ago with an older version of HS 7.x, CT, etc., it appeared to work then....
Comment #32
wim leersThere have been no changes to HS or HS Taxonomy that could have broken this. It must be the upgrade path of CCK -> Field API or Content Taxonomy.
Also: I'm not going to help with debugging Content Taxonomy upgrade path misery. That module has cost me enough days of misery already. I hope you understand :)
Comment #33
zeezhao commentedI reran upgrade using a version of cck I used in past from March 2011, and it now works well. So issue appears to be content_migrate related...
Comment #34
wim leersYes, that's what I was afraid of… Hopefully this is your final part of the upgrade, so you can do the final migration and be done with it? :)
Comment #35
zeezhao commentedThanks. Well... upgrade is quite complicated, so still have to wait/do loads of other module stuff e.g. cck & multigroups, some aspects of notifications, quiz, HS and limit depth..., and more...
Just trying to ensure that critical issues are solved first. In reality, there is no visible benefit to the upgrade, other than keeping up-to-date... Thanks, anyway.
Comment #37
dxhuong commentedAmazing module.
Thanks !
Comment #38
mikeguzman commentedHi I updated the yareckon's module from #10 because with the latest version of Drupal 7 I had issues. I want to share this improvement because this module helped me a lot.
Same steps:
1. Install and configure taxonomy_set_lineage for required vocabularies
2. Set the term lineage as per taxonomy_set_lineage module
4. Configured hierarchical_select to 'save term lineage' with multiple parent taxonomies
5. Voila!!! you have now the full term lineage with all the related parents.
Comment #39
jramby commentedHi, just a question, is it available on which version?
thanks!
Comment #40
jramby commentedSorry, I missed something... I just saw it in the time.
Again thank you... it's a great module!!
Comment #41
jonofthedead commentedHello,
Recently I ran into this issue but at the end of the day decided not to use Hierarchical Select due to a bug in the create new functionality. So I adjusted the Module in #38 (which was adjusted from #10) to work with the standard "autocomplete term widget (tagging)" widget.
Issues I found in #38 when using with the standard widget -
1) when tagging multiple values if two terms have the same parent, the parent term was displayed twice.
2) when adding new terms, the new term would be added twice
I resolved both by first creating an array of all of the TID's for all the terms stored in the entity->{$tag_field_name}. Then the second time through the terms list I then grab all the parents for each term then check each parent if the TID is in my "already defined" array. if not I insert it into the entity and my array.
I realize going through twice can be a huge timesink if you have a large number of terms, but it worked for me since this is done on a save and will not affect my viewers, only contribs (which is me and 1 other person at the moment).
If you are reading this and revisit to find a better way please let me know!
Hope this helps others!
Setup:
1) Install taxonomy_set_lineage
2) go to admin/config/content/taxonomy_set_lineage to configure required vocabs
3) make sure you are using the standard "autocomplete term widget (tagging)" widget for your taxonomy field (other widgets might work but haven't tested!)
4) you are good to go!
Jonathan.