Creating a new issue based on the discussions here: http://drupal.org/node/840626#comment-3228792

Note that I actually have two separate values ('phone 1' and 'phone 2') that I want to put together into one multi-valued field.
Looking at content_feeds_set_target() in mappers/content.inc, it seems this is not supported...

Is this the case?

CommentFileSizeAuthor
#6 873198-6_merge_tags.patch773 bytesalex_b
#4 873198-3-feeds-multisource-taxonomy.patch650 bytesAnonymous (not verified)
#1 feeds-873198-1.patch645 bytesBWPanda
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BWPanda’s picture

Category: support » bug
Status: Active » Needs review
FileSize
645 bytes

I worked out why this wasn't working - it's a bug.

The attached patch fixes it by merging the existing value (if any) with the new value(s). It was previously ignoring the existing value and overwriting it.
Let me know if this patch fixes it for you too.

Anonymous’s picture

Would the same thing apply for taxonomy.inc?

For example, using a free tagging - multitag 'Categories' vocabulary:

Source -> Target:
------------------
Category Level 1 -> Categories
Category Level 2 -> Categories
Category Level 3 -> Categories

The result is, only Level 3 is stored in Categories, 1 & 2 are lost.

Anonymous’s picture

In mappers/taxonomy inc, I think this is the solution, change:

  if ($vocab->tags) {
    // Simply add a comma separated list to the node for a "tags" vocabulary.
    $node->taxonomy['tags'][$vocab->vid] = implode(',', $terms);
  }

to this:

  if ($vocab->tags) {
    // Simply add a comma separated list to the node for a "tags" vocabulary.
    $terms = array_merge($terms, explode(',', $node->taxonomy['tags'][$vocab->vid]));
    $node->taxonomy['tags'][$vocab->vid] = implode(',', $terms);
  }

I still need to test this.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
650 bytes

I tested the patches (mine attached now), and they really work.

My patch is for 6x10-beta4, but it should apply to latest dev.

If the maintainers feel they should be part of feeds, please include them.

Anonymous’s picture

On a side not, my patch might need array_unique to reduce duplicates,

$terms = array_unique(array_merge($terms, explode(',', $node->taxonomy['tags'][$vocab->vid]));

Unless Drupal does this anyway.

alex_b’s picture

FileSize
773 bytes

array_unique is not necessary as taxonomy uses drupal_explode_tags() to split tags - which in turn uses array_unique. We should be using drupal_explode_tags(), too btw.

alex_b’s picture

Title: Import multiple values to multi-valued field » Import multiple values to tag vocabulary
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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