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
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.
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.
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.
Feeds Tamper solves this easily with the Explode plugin.
-
in my case this worked only without whitespaces and with
public://images
pointing to/sites/default/files/images
where images where uploaded manually, saypublic://images/file1.png,public://images/file2.png,public://images/file1.png
not justfile1.png, file2.png, file3.png
– vladkrasMay 30, 2014 at 16:18
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.
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.
-
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?– pal4lifeMay 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.– PaulMay 6, 2015 at 19:00
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 (,)