Today, I attempted to import a csv file containing a mailing list to a content type, "Mailing List." Most fields of this content type were pure text fields which feeds mapping dialog recognized properly. Several fields, however were text fields controlled by list widgets. None of these fields can be mapped for upload.

Comments

wilkenw’s picture

Will check the latest dev iteration for this problem.

todddevice’s picture

subscribing

todddevice’s picture

StatusFileSize
new751 bytes

type list_text is absent from the array of eligible string type fields in field.inc. The attached patch may help.

retolist’s picture

Subscribe

Countzero’s picture

Many thanks todddevice for the patch. Did the modification manually, but it definitely works. Great !

parvardeh’s picture

Could someone please tell me how to apply or install this patch. I want the same functionality that the patch offers but I dont have any idea how to add this patch to Feeds module.
By the way I am using Drupal 7 on windows.

l_o_l’s picture

For manual applying the patch:
Open the patch as a text file. Study it. In you will find a file reference. That is the file the patch is meant for. Browse through the module map to find exact that file. In the patch text are one or more lines with a '-' and/or '+'-char at the very beginning. These lines have to be deleted and/or added to the source of the file.

Good luck !

Seraphin42’s picture

subscribing

Countzero’s picture

You can also use the instructions on this page : http://drupal.org/patch, which is the proper way of using patches.

emorency’s picture

I modified the function field_feeds_set_target_text to allow to import multiple values since it's a list... The delimiter is '|'.

I tried using Field Tamper but I was not able to enable the tampering...

/**
* Callback for mapping text fields.
*/
function field_feeds_set_target_text($source, $entity, $target, $value) {
if (!is_array($value)) {
$info = field_info_field($target);
if ($info['type'] == 'list_text'){
$value = explode('|', $value);
}
else{
$value = array($value);
}
}
_field_feeds_set_target($source, $entity, $target, $value, TRUE);
}

emorency’s picture

StatusFileSize
new614 bytes

Here is a patch to allow to import multiple values when the type if the field is a "list_text".

parvardeh’s picture

Thanks.

upupax’s picture

I can't get this to work.
I applied both patches successfully, but I still can't import values in my text_list/radio button field.
I've tried to switch to list widget but still have no effect.

emorency’s picture

The delimiter must be ','

The fix works with something like this:

"field_1";"field_2"
"text";"value1","value2"

I use the ; delimiter because Excel does not really like to open csv with , delimiters. Also, to avoid any problems I use double-quotes to allow to have some text values that contains comma.

To import items for lists, be sure to have the key, not the value. For example, if you defined your list like:

1|First item of my list
2|Second item of my list
...

You should import "1".

Hope that helps!

upupax’s picture

@emorency unfortunately I'm working with XML files, so I don't have to take care about delimiters.

pcambra’s picture

patch in #3 seems to be already included

pcambra’s picture

I don't think that patch in #11 makes sense to be included into the "core" feeds module as it forces the delimiter to be a comma and probably is not suitable for every case.

I'd suggest to use feeds_tamper or maybe custom code with hook_feeds_after_parse to split the multivalues

Pocketpain’s picture

sub

imiksu’s picture

Confirming that #3 patch is working for me (used xpath parser with single-value field).

vin247’s picture

Anyone know how to get this working on version 6?

rfay’s picture

Status: Active » Needs review

Well, there are two patches here, one possibly committed? Setting to "Needs Review"

jedprentice’s picture

Status: Needs review » Fixed
StatusFileSize
new505 bytes

#3 has apparently been committed, and seems to work. I was able to map a list text field and import successfully using the attached CSV. The field mapper unit test could/should be updated, though.

Status: Fixed » Closed (fixed)

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