Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
in Drupal 7 it is possible to add fields to a vocabulary for the terms. I need to import taxonomy terms to a vocabulary including the values for the fields of the term. Is it planned to support fields for taxonomy?
Comments
Comment #1
Carsten Müller CreditAttribution: Carsten Müller commentedok,
i have updated the module to the latest release and have seen the message
"Vocabulary management has changed between Drupal 6 and Drupal 7.
In Drupal 7, synonyms and related terms have been removed and replaced by fields."
But how can i import terms and th values of custom fields?
Thanks
Carsten
Comment #2
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
It may be difficult, because if you have custom Fields, you need a custom csv format of import (order of csv fields) and it's not really implemented yet, except with Api.
Could you give me more information about your custom fields or you just talk about synonyms and related terms? For these ones, custom fields are automatically created, even it's not yet totally satisfying, specially for related terms when there are more than one vocabulary.
Daniel Berthereau
Knowledge manager
Comment #3
Carsten Müller CreditAttribution: Carsten Müller commentedHi Daniel_KM,
the problem ist the allocation of the fields to each column of the .csv file. I think i could be handled like a multiple field. You have a settings page where you select the vocabulary and then you have to select your cutom field from aselect box for each .csv file line.
So for the fist line you have a select where you can choose what is given in the fisrt column. Then a secons select for the second line and so on. There could be a button which adds more selects for more columns via javascript like in the cck fields to add more fields.
In the select you can choose the default fields or your custom fields.
I added my custom code which i have written to solve the problem rapidly because i need it now. But i think you can add it in your module to improve it and add the custom fields. The following functions have to be imporved:
- gtin_import_gtins_line_structure()
- gtin_import_gtins_term_fields_structure()
I think this could be a way to improve your module and solve the problem of custom fields. Maybe i will improve my custom module and add the selection for each column.
Greetings
Carsten
Comment #4
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
Thank you very much for your ideas.
I'll check and implement it in next release, but I'm currently very busy for one or two months. If you improve your function, I'll be interested too.
Sincerely,
Daniel Berthereau
Comment #5
molave CreditAttribution: molave commentedHi Daniel_KM and everyone,
Thanks for a great module. I, too, would be grateful for field support in D7.
If I were building a site about cars, and I had a vocabulary of Car Makers, I would like each car maker to have custom fields indicating nationality, for example, and maybe year:
[Taxonomy Term] - [Custom Field] - [Custom Field]
Car Maker - Country - Year Started (data is fictional)
= = = = = = = = = = = = = = = = =
Ford - US - 1900
Chrysler - US -1901
Toyota - Japan - 1902
Nissan - Japan - 1903
Daimler Benz - Germany - 1904
I prefer not to put the info in Term Description because they help to classify and sort the taxonomy terms. But I also do not want to give Car Maker its own content type, because there's no need to include more data than what is above.
Taxonomy CSV makes it easy to import a hundred new Car Maker terms. But at this point, I still have to edit each term to add the values for the custom fields. It would be so cool if I could just upload the custom fields along with the taxonomy terms, even if I would have to do the upload twice (first for the hierarchy, then for the additional data)
I'm afraid I can't help with the coding because I'm not a programmer. Just wanted to illustrate my thoughts as clear as I could, as a user.
Thanks much...
Comment #6
robertom CreditAttribution: robertom commentedHi,
I've tried the custom code of Carsten Müller with all field of type text and a file like that:
this works well, but I would increase "number of values" for field_tax_gtin_status at "unlimited"
for that I wrote a patch for gtin_import.module (attached)
now I can import a file like that:
first field (default name X) is required
this "hackish" works well with field of type text, now I'm interested in field of type "file"... how I could simulate upload button? How I could "fake" managed_field?
I'm new to drupal and is api, I hope in an hint.
Comment #7
robertom CreditAttribution: robertom commented@molave
assumed your custom field named:
field_country and field_year_started
for your purpose you could use a file like that
and module attached.
Due to this BUG #796692: Only show the term heading if the term has a description you could prefere:
(description is a space)
Comment #8
molave CreditAttribution: molave commentedWow robertom thanks very much!
Your instructions worked like a charm. Of course I had to edit the module first---first time ever for me to actually open a module file. So it was great learning experience, too.
Thanks also of course to Daniel_KM and Carsten Müller and everyone else who contributes to this thread.
In case anybody else wants to use this solution and is not a techie, remember to open the gtin_import.module file, and replace the current field names with the actual field names from your taxonomy. as shown below
By the way, what does "gtin" mean, exactly?
Best to all...
Comment #9
robertom CreditAttribution: robertom commentedI don't know, but in field machine name there are "tax" words... I think the problem solved rapidly by Carsten is relative to "German Tax INcome", but is only a guess.
I've solved this problem. Now I could import file like this:
/home/robertom/fileX.pdf is absolute path on server
there isn't check or control, this is only a proof of concept...
I need to import more complex term rapidly, and I search to scipt it a bit.
so... is the time of term reference ;)
Many thanks at Daniel_KM and Carsten Müller for the hard work.
Comment #10
robertom CreditAttribution: robertom commentedvery dirty, but seem to work.
tested only with radio buttons and autocomplete (freetagging)
patch attached
Comment #11
BenK CreditAttribution: BenK commentedSubscribing
Comment #12
renat CreditAttribution: renat commentedSubscribing. Hope all this patches will be committed once a day.
Comment #13
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
Yes, I was very busy as I said previously. Patches will be integrated and committed soon.
Thanks for all,
Daniel Berthereau
Knowledge manager
Comment #14
renat CreditAttribution: renat commentedDaniel, thanks a lot!
My previous message, of course, was posted only to show interest in this functionality, not to hurry up you.
Comment #15
garrettrayj CreditAttribution: garrettrayj commentedsubscribe
Comment #16
perhenrik CreditAttribution: perhenrik commentedSubscribing
Comment #17
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
The patch has been integrated and released.
Sincerely,
Daniel Berthereau
Knowledge manager
Comment #18
renat CreditAttribution: renat commentedThank you!
Latest -dev works perfect for me.
I'm also thinking about writing a patch to add support for Title module. Can we achieve this with simple check of name_field and/or description_field existence?
Comment #19
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
I don't know the title module. I'm just looking it (I see it's a i18n one) but I don't understand what you want to do. Do you want to import field title in lieu of terms name?
Sincerely,
Daniel Berthereau
Knowledge manager
Comment #20
renat CreditAttribution: renat commentedThis module was written to replace pseudo-fields name and description with real fields (they tried to do it in core, but it'll be there only in D8). Yes, this is for field-based translation, but not only for it, there are other scenarios of its usage.
I'd like to make it possible to import data to name_field and to name_description fields, created with Title, in lieu of standard name and description. Currently it is impossible, or half-possible. Taxonomy CSV will not fill this fields as custom, though appropriate terms will be created.
Comment #21
jgerbracht CreditAttribution: jgerbracht commentedI plan on having several fields be taxonomy terms themselves, field 1 will be from vocabulary 1 and field 2 will be from vocabulary 2. Is it possible to upload this structure with the 7.x-5.x-dev ? and if so, how would I structure the CSV so that it treats the field value as a taxonomy term? Or will this magically happen?
Also, can I specify a "parent" when uploading taxonomy terms with fields?
Thanks
Jeff
Comment #22
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
I don't understand what you want. Could you give me an example, even anonymized?
Thanks,
Daniel Berthereau
Knowledge Manager
Comment #23
jgerbracht CreditAttribution: jgerbracht commentedHere is my specific scenario. I have a vocabulary of "birds" and terms within this vocabulary are taxonomic concept ids, not common or scientific names as those change over time. I have a second vocabulary of "common_names" and a third vocabulary of "scientific_names".
For the "birds" vocabulary, I've added two fields, com_name and sci_name and set these fields as type "term reference" and pointed them to the "common_names" and "scientific_names" vocabularies respectively.
I tried to upload data using Custom Fields, taxon_concept, field_com_name, field_sci_name
similar to
TC1232, Canada Goose, Branta canadensis
TC2345, Cackling Goose, Branta hutchinsii
And it failed (though I don't recall the error) Given that these fields are vocabulary based, will this work and have I set up for upload correctly for this??
Thanks
Jeff
Comment #24
rogical CreditAttribution: rogical commented+1 my vocabulary has an image field, and can't be exported with this latest version.
Comment #25
mlyno CreditAttribution: mlyno commentedI will give it a try with the 7.x-5.x-dev. I have a picture field, media field and file field to import with the term.
Comment #26
mlyno CreditAttribution: mlyno commentedNo luck in importing files to file_field from taxonomy CSV
says
Does the
work?
What is the
I let it out, is this the problem?
Comment #27
mattbk CreditAttribution: mattbk commentedIs there a method (with the latest dev and Custom fields import) to import multiple items to a single field (that will allow multiple values)? Specifically I want to import multiple synonyms of terms if possible, each term having several synonyms.
Comment #28
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
The new 7.x-5.7 release fixes a lot of fields issues and adds some improvments.
@renat: I'll work on Title module for the next release, but I don't know when.
@jgerbracht: It's now possible too to export a tree or any vocabulary from a Drupal 6.x site and to import it to a Drupal 7.x site.
@rogical, @mlyno & @mattbk: Could you retry with the new release? Thanks.
Note that usually, the module, which uses only core taxonomy functions, is significantly slower with Drupal 7 than with Drupal 6 (about 2 to 4 times).
Sincerely,
Daniel Berthereau
Infodoc, Digital humanities & Knowledge management
Comment #29
renat CreditAttribution: renat commented@Daniel_KM, thank you for your intention to add support for Title module!
Looks like, though, that problem mentioned in #20 is with Title module, not with Taxonomy CSV:
http://drupal.org/node/1146724#comment-4552926
Anyway, it'll be cool to have such a support - to handle multilingual vocabularies, for example.
Comment #31
jrviper2000 CreditAttribution: jrviper2000 commentedHey Guys,
I Installed the latest version of taxonomy csv and I am finding that it is unable to export custom fields. Am I doing something wrong?
Thanks!
Comment #32
chryslerpacifica CreditAttribution: chryslerpacifica commentedI see what you did right there.