Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Carsten Müller’s picture

ok,

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

Daniel_KM’s picture

Hi,

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

Carsten Müller’s picture

FileSize
9.07 KB

Hi 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

Daniel_KM’s picture

Hi,

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

molave’s picture

Hi 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...

robertom’s picture

Hi,

I've tried the custom code of Carsten Müller with all field of type text and a file like that:

default name 1,tax gtin name 1,description 1,package 2,status 1
default name 2,tax gtin name 2,description 2,package 2,status 2

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:

default name 1,tax gtin name 1,description 1,package 2,status 1
default name 1,,,,status 1a
default name 1,,,,status 1b
default name 1,,,,status 1c
default name 1,,,,status 1d
default name 2,tax gtin name 2,description 2,package 2,status 2

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.

robertom’s picture

FileSize
2.9 KB

@molave

assumed your custom field named:
field_country and field_year_started

for your purpose you could use a file like that

Ford,,US,1900
Chrysler,,US,1901
Toyota,,Japan,1902
Nissan,,Japan,1903
Daimler Benz,,Germany,1904

and module attached.

Due to this BUG #796692: Only show the term heading if the term has a description you could prefere:

Ford, ,US,1900
Chrysler, ,US,1901
Toyota, ,Japan,1902
Nissan, ,Japan,1903
Daimler Benz, ,Germany,1904

(description is a space)

molave’s picture

Wow 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


  // STRUCTURE: GTIN, GTIN NAME, GTIN DESCRIPTION, PACKAGE, STATUS

  return array(
    'gtin' => 0,
    'description' => 1,
    'mycustomfield1' => 2,
    'mycustomfield2' => 3,
    'mycustomfield3' => 4
  );

}


/**
 * get the csv line structure
 */
function gtin_import_gtins_term_fields_structure() {

  return array(
    'gtin' => 'name',
    'description' => 'description',	
    'mycustomfield1' => 'field_mycustomfield1machinename',
    'mycustomfield2' => 'field_mycustomfield2machinename',
    'mycustomfield3' => 'field_mycustomfield3machinename',
	
  );

}


By the way, what does "gtin" mean, exactly?

Best to all...

robertom’s picture

By the way, what does "gtin" mean, exactly?

I 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.

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've solved this problem. Now I could import file like this:

default name 1,tax gtin name 1,description 1,/home/robertom/file1.pdf,status 1
default name 2,tax gtin name 2,description 2,/home/robertom/file2.pdf,status 2
default name 3,tax gtin name 3,description 3,/home/robertom/file3.pdf,status 3

/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.

robertom’s picture

so... is the time of term reference ;)

very dirty, but seem to work.

tested only with radio buttons and autocomplete (freetagging)

patch attached

BenK’s picture

Subscribing

renat’s picture

Subscribing. Hope all this patches will be committed once a day.

Daniel_KM’s picture

Title: Taxonomy CSV: Fields Support » Fields Support

Hi,

Yes, I was very busy as I said previously. Patches will be integrated and committed soon.

Thanks for all,

Daniel Berthereau
Knowledge manager

renat’s picture

Title: Fields Support » Taxonomy CSV: Fields Support

Daniel, thanks a lot!
My previous message, of course, was posted only to show interest in this functionality, not to hurry up you.

garrettrayj’s picture

subscribe

perhenrik’s picture

Title: Fields Support » Taxonomy CSV: Fields Support

Subscribing

Daniel_KM’s picture

Version: 7.x-5.6 » 7.x-5.x-dev
Status: Active » Needs review

Hi,

The patch has been integrated and released.

Sincerely,

Daniel Berthereau
Knowledge manager

renat’s picture

Thank 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?

Daniel_KM’s picture

Hi,

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

renat’s picture

This 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.

jgerbracht’s picture

I 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

Daniel_KM’s picture

Hi,

I don't understand what you want. Could you give me an example, even anonymized?

Thanks,

Daniel Berthereau
Knowledge Manager

jgerbracht’s picture

Here 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

rogical’s picture

+1 my vocabulary has an image field, and can't be exported with this latest version.

mlyno’s picture

I 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.

mlyno’s picture

No luck in importing files to file_field from taxonomy CSV
says

Notice : Unable to load the file attached to the term.

Does the

default name 1,tax gtin name 1,description 1,/home/robertom/file1.pdf,status 1
default name 2,tax gtin name 2,description 2,/home/robertom/file2.pdf,status 2
default name 3,tax gtin name 3,description 3,/home/robertom/file3.pdf,status 3

/home/robertom/fileX.pdf is absolute path on server

work?
What is the

status 1

I let it out, is this the problem?

mattbk’s picture

Is 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.

Daniel_KM’s picture

Version: 7.x-5.x-dev » 7.x-5.7
Status: Needs review » Fixed

Hi,

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

renat’s picture

@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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jrviper2000’s picture

Hey 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!

chryslerpacifica’s picture

I see what you did right there.