Closed (fixed)
Project:
Taxonomy CSV import/export
Version:
6.x-5.5
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 Jan 2010 at 04:19 UTC
Updated:
22 Jan 2011 at 13:07 UTC
I am looking to import 1000+ terms in a 2 level hierarchy with multiple parents. I have the terms in the order I would need them in the prepared import file, but once imported they are changed to alphabetical order in drupal taxonomy.
Is it possible to have the imported terms to be in the order of the lines as prepared in the import file?
Thank you
Comments
Comment #1
Daniel_KM commentedHi,
Drupal arranges terms by alphabetic order by default. If you want to have a specific order, you need to set a weight for each term. If there isn't any duplicate term, you can set them with Taxonomy csv import/export by importing a two columns csv file with terms and weigths and by choosing appropriate first and third options.
Sincerely,
Daniel Berthereau
Knowledge manager
Comment #2
Daniel_KM commentedI think i can add this option in 4.10 release (in March or April).
Daniel Berthereau
Knowledge manager
Comment #3
rburgundy commentedhello Daniel_KM,
Thank you for the reply. I would like to import a hierarchical taxonomy, where a term may be listed 1st under one parent, 2nd under different parent, and 3rd under another parent (my taxonomy is of train lines/stations). This is because many lines may overlap Station A (below). Is this possible with Taxonomy CSV import/export now? An option to order the terms in the order they are imported would be awesome! I have changed this to a new feature request. Many thanks!
Line 1
-Station A<=1st here
-Station B
-Station C
Line 2
-Station D
-Station A<=2nd here
-Station E
Line 3
-Station F
-Station G
-Station A<=3rd here
Comment #4
Daniel_KM commentedHi,
Duplicate terms are difficult to manage. It is not possible to set a different weight for different submenus with the same term/station: one term can only have one weight. So you need to create related or duplicate terms and eventually to add extra code to manage terms.
To create related and to import the hierarchy of terms, the simpler way seems to add a prefix as this:
and next, eventually, to make related terms:
So there is no need of weights, order is alphabetic and links are relatively simple to manage and to display.
A second way is to create duplicate terms and to use weights. You can import them in two times as i explain in my previous post. You can import them too by using only one process : for that, you need to convert polyhierarchic list into "Full term fields and links" format (order of terms is not important), with or without related to Station A (here, a simplified but working csv list):
Pehraps other ways to process exist.
Daniel Berthereau
Knowledge manager
Comment #5
rburgundy commentedAfter many hours for testing, this seems to be a big roadblock that I am facing.
I would like to make, for example, "Lexington Station" as one term so that I can search users that have that term (no matter which line they are on). But I am unable to currently list Lexington Station under Line 1, Line 2, Line 3 etc properly as the term will only take one weight (Lexington Station is 1st station on Line 1, 15th station on Line 2 and 30th station on Line 3 etc.)
I am using Views and an exposed Taxonomy filter with autocomplete to pull up the station name for the search. If I add a Lexington Station for each line and make them related, I am getting a "Lexington Station" result for each line it is listed on in the search (so 3 of the same name shows) so users will be confused.
Is there any way to allow a different weight for the term for each parent it is under?
Or is there another workaround that will solve my issue?
Please let me know if more information is required to better understand what I am trying to do.
Many thanks!
Comment #6
Daniel_KM commentedHi,
If I understand what you want, you need to unduplicate the autocomplete search field.
The cleaner but harder way is to do it by creating an sql request and using it in your autocomplete field.
The second way is to create a second taxonomy where all stations are unique. For menu, you use first taxonomy. Submenus are imported as i explain in my previous post and same submenus stations are linked to a unique node. For search, the autocomplete field uses the second taxonomy.
For the rest, relations between terms of the first taxonomy or between terms of the first and second taxonomy are not needed, but can simplify some tasks or be useful for eventual other needs.
Sincerely,
Daniel Berthereau
Knowledge manager
Comment #7
rburgundy commentedHello,
Thanks you for the quick reply. I believe I will be trying your second recommended approach as I am not familiar with sql (I am currently learning).
In Drupal 7, do you know if it will be possible to have terms with multiple parents to have different weights? Or is this is a feature that can live in Taxonomy CSV import/export? This becomes essential when the order of the term really matters (and is different) under each parents, ie train lines, bus routes, flight routes. It would be awesome to have control over the order in the form and output under each parent, and keep the number of taxonomy terms to a minimum (by not duplicating a term).
Many thanks for your help on this issue and your work on this great module.
Best Regards
Comment #8
Daniel_KM commentedHi,
In Drupal 7, taxonomy isn't managed as in Drupal 6. There is no more related or synonyms terms. That's why taxonomy csv import/export module doesn't work totally on Drupal 7. Now, relations and synonyms can be managed as any other items by the new core module Fields. Weights are managed as in Drupal 6, but as you can add Fields to each item, there are probably ways to choose items order. You can read about it in Drupal Fields documentation. But, currently, Drupal 7 is an alpha release, so it's to early to use it in a production site, specially because a lot of modules haven't been converted.
Regards,
Daniel Berthereau
Knowledge manager
Comment #9
Daniel_KM commentedComment #10
porg commentedAs of version 6.x-5.4, Taxonomy CSV still offers no option to keep the line(=term) order.
You end up with an lexicographically ordered list, and have to manually rearrange to your intended order.
Was no big deal for me, as I only have about 100 terms.
But for larger classifications it would be nice, if the module could keep the line order.
In your batch, you can simply run a loop (and inner loops for nested terms), and put the current loop number ($i $ii etc) as the weight of the currently read-in term.
Comment #11
Daniel_KM commentedHi,
That looks like a good and simple solution. I'm going to implement it in next release (in two or three weeks).
Regards,
Daniel Berthereau
Knowledge manager
Comment #12
Daniel_KM commentedHi,
A new option has been added in first group of options to keep order of terms: it sets a weight to each term.
This resolves issue with a single vocabulary, but it doesn't resolve it when a term has multiple and different orders, as in railway example. See my previous comment for such a need.
Sincerely,
Daniel Berthereau
Knowledge manager
Comment #13
Daniel_KM commentedDaniel Berthereau
Knowledge manager