Needs review
Project:
Feed Element Mapper
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 May 2009 at 21:47 UTC
Updated:
27 May 2009 at 23:47 UTC
Hello,
I've found small issue - feedapi_mapper_taxonomy.inc mapper do not respect terms synonyms. My typical workflow is following:
- I am importing content from feeds and map value to Category vocabulary.
- taxonomy mapper creates new terms
- some terms later are merged with help of Taxonomy Manager module and all these terms added as synonyms. This usefull for, for example, different spellings, mispells, etc.
What happend next - next time if same misspelled term found in feed - module creates new term instead using one via synonyms.
Here is simple patch to make it look into synonyms prior creating new term:
feedapi_mapper_taxonomy.inc (line #64):
instead:
else {
if ($static == FALSE) {
$new_term['name'] = $term;
$new_term['vid'] = $vid;
taxonomy_save_term($new_term);
$tids[$new_term['tid']] = taxonomy_get_term($new_term['tid']);
unset($new_term);
}
}
place:
else {
$curr_term = taxonomy_get_synonym_root($term);
if ( is_object($curr_term) && $curr_term->vid == $vid ) {
$tids[$curr_term->tid] = $curr_term;
}
else {
if ($static == FALSE) {
$new_term['name'] = $term;
$new_term['vid'] = $vid;
taxonomy_save_term($new_term);
$tids[$new_term['tid']] = taxonomy_get_term($new_term['tid']);
unset($new_term);
}
}
}
unified patch attached.
| Comment | File | Size | Author |
|---|---|---|---|
| feedapi_mapper_taxonomy.inc_.patch | 815 bytes | pavel.karoukin |
Comments
Comment #1
ekes commentedRespecting synonyms isn't really default Drupal behaviour - even if the obvious one. I've used http://drupal.org/project/synonym_collapsing to do this (including with FeedAPI Mapper)
Comment #2
pavel.karoukin commentedI am sure this should be implemented into module, 'cos when importing third-party categories you can't to be sure they will use correct spelling.
Comment #3
alex_b commentedI actually think that this would be sane default behavior. Does this patch conflict with #354657: Taxonomy mapper: fix and simplify term creation ?