Maybe this has been discussed before, but i can't find any reference, so i decided to post this as new request.
I'm trying to import a taxonomy terms list from an old website to a new one, using a csv file - it's a simple list as:
tid,term
12,"term 1"
13,"term 2"
etc.
I would like that in the "target" vocabulary, each term.id is the same as in the source (i want "term 1" as $tid->12, "term 2" ad $tid=13, etc.). But I cant find a way to map the "tid" from the csv file, to the proper term.id. Each term is created in the vocabulary as a new one, with a new, different term id.
Is this just *possible*? :)
Thanks
fb
Comment | File | Size | Author |
---|---|---|---|
#5 | feeds_7_2_taxonomy_term_tid_as_target.patch | 3.9 KB | brtamas |
|
Comments
Comment #1
AvalancheOfLlamas CreditAttribution: AvalancheOfLlamas commentedI'm looking for this functionality as well. When taxonomy terms have non-unique names, it makes it difficult to update them. I'd add to the use case above that I have:
tid,term,CCK text field
12,"Contact Name A","Company 1"
13,"Contact Name B","Company 2"
14,"Contact Name B","Company 3"
tl;dr: I'm trying to make an importer to update taxonomy terms, but it's impossible without the TID, since I have deliberately duplicated term names.
Comment #2
twistor CreditAttribution: twistor commentedThe taxonomy module will not let you assign a tid to a term that doesn't not exist. The node module will allow this, which is why we provide that functionality for node.
What you're really looking for is a unique value to map to. Simply map the value you wanted to use for tid to the GUID target and set it as unique, that will accomplish basically the same thing.
Comment #3
francoud CreditAttribution: francoud commentedthanks Twistor. It's exactly what i did and it worked ;-)
Comment #5
brtamas CreditAttribution: brtamas commentedHere is a patch for feeds 2.0-beta. It is not a nice solution, but works.
Comment #6
pelicani CreditAttribution: pelicani commentedThank you brtamas!
It is a very nice solution.
I like how you used the existing taxonomy query to validate that the term getting imported is new, rather than just relying on the existence of a tid.
Slick.
The patch installed cleanly.
peace,
michael
Comment #7
pelicani CreditAttribution: pelicani commentedI feel this would be beneficial to others.
I'm working on a project and the dev before me couldn't get the tids to import.
When using taxonomy references we need to keep the tid intact.
Your solution work well.
Can this patch get a review?
Please and thank you.
peace,
mcihael
Comment #8
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedIt would be nice if this could get implemented in a similar way as #1570544: Add UID target to FeedsUserProcesser. (if possible). The function
taxonomy_term_save_new_with_tid()
seems to duplicate a lot of what the taxonomy module is already doing. Is there a way to avoid that?It would also need tests. These tests could be implemented in a similar way as
FeedsCSVtoUsersTest::testUidTarget()
andFeedsCSVtoUsersTest::testUidUpdating()
.Comment #9
masher CreditAttribution: masher commentedPatch #5 worked perfectly for me.
Some duplicate term id error messages in the feed log but terms ID assigned correctly
Many thanks
Comment #10
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedClosed #2339353: Enable term ID as unique identifier and #2391041: Term processor does not respect Term ID as a unique GUID as duplicates.
Comment #11
NWOM CreditAttribution: NWOM commented#5 still works amazingly. Otherwise terms cannot import if the Term ID is being targeted. Oddly it says that the items were successfully imported even though they aren't created. This patch fixes this.