3

I want to import a csv file using the feed module. This feed corresponds to an article content type, but the problem is the image field in the article content type contains multiple images. If I want to use the feed module to import, I can only import one image, if I paste multiple image urls, this causes errors.

7 Answers 7

9

Feeds and Feeds Tamper worked for me too. To get one row for each multi-value field I used the GROUP_CONCAT() function from MySQL. I used this in conjunction with the Feeds_SQL module.

1
  • +1 I've used Feeds Tamper for this and it's worked perfectly. Note if you want to import alt and/or title fields, then at the moment you'll need the patch from #1080386
    – Andy
    Sep 6, 2012 at 12:16
2

I just don't think Feeds supports multi value feeds that way.

I briefly considered Feeds Tamper, that is capable of making various manipulations to the indata, but I don't see how it could solve this particular problem.

I think your best bet, short of a big patch to feeds, is to override the Feeds Processor. I have an answer with an example of that here: Using feeds module to import to user reference fields.

2

I had the same problem and installed the Feeds Tamper module. I then mapped my multi-value field in my custom importer and added a Explode plugin through the Feeds Tamper UI. The plugin will turn a comma separated list into an array.

Here's one row from my csv file:

GUID, title, image
1, "sample product", "images/image1.jpg, images/image2.jpg, images/image3.jpg"

This solved the problem and made it possible to connect more than one image to my multi-value field.

1

Feeds Tamper solves this easily with the Explode plugin.

1
  • in my case this worked only without whitespaces and with public://images pointing to /sites/default/files/images where images where uploaded manually, say public://images/file1.png,public://images/file2.png,public://images/file1.png not just file1.png, file2.png, file3.png
    – vladkras
    May 30, 2014 at 16:18
1

At first Explode didn't work for me. After trying several thing I tried to add a different string separator for the multi list. So, instead of a comma (,) I used a pipe (|) and the multi list came in on import for my nodes. I was using taxonomy and a term reference field.

0

I have written a blog post on how to import data from a multi row csv file into a CCK multigroup in Drupal. It involves the Feeds and Feeds Tamper module and a bit of VBA code. It could maybe give you some pointers.

2
  • The blog mentions 'We use CCK fields in a Content Multigroup to show this data in the invoice node' - What is a Content Multigroup? Is that the same as multifields?
    – pal4life
    May 6, 2015 at 15:38
  • the Content Multigroup was a part of the CCK3 module. It was available for Drupal 6. I don't know the equivalent for Drupal 7. You could take a look at drupal.org/project/field_collection.
    – Paul
    May 6, 2015 at 19:00
0

This Blogpost did the trick for me: enter link description here http://thejibe.com/blog/12/09/feeds-importing-multiple-values-one-multi-value-field

Maping multiple csv sources to one target field:

Source_01 > Target_Field
Source_02 > Target_Field
Source_03 > Target_Field

Then using Feeds Tamper to rewrite the Source_03:

Use REWRITE and as REPLACEMENT PATERN do:

Source_01, Source_03, Source_03

Then use a second plugin: EXPLODE. Make sure that the string separator is the same as the one you have used in the Rewrite plugin (,)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.