Hi,

I have configured an feed importer for a content type as follow:
- import from csv file
- Update existing nœuds : YES (Update existing nodes (slower than replacing them))
- Skip hash check : YES (Force update of items even if item source data did not change)

When I import the nodes, everything works fine, and nodes are updated (the modified content is indeed modified). However, I noticed that, if the content of a text field is deleted, then the content of the field is not updated, but the old text remains (in place of the new empty content).

Could you help me on this issue? I cannot figure out what I could try to solve the problem.

Thanks in advance,

Comments

robgreeniowa’s picture

I am experiencing this exact same issue with an XLS import, when using either Update Existing Nodes or Replace Existing nodes. Otherwise, Feeds Import works magnificently!

MichaelGreisman’s picture

I depend upon this behavior; I believe that Feeds is working as designed. Otherwise you'd have to import every single field on a content type to avoid clearing those fields. With the functionality as it is, you could import only the identifying columns and the columns of data that had changed.

I believe you could update a field when the import data is empty by using hook_feeds_presave.
Very loosely speaking, find a way to compare each imported value with the imported-and-tampered value in the $entity argument. If the imported value was empty, alter the entity's value to empty.

(I didn't find the un-tampered import values in any of hook_feeds_presave's arguments. So I do something that sounds a little dumb, and use str_getcsv to get the original import values from the import file.)

hth

twistor’s picture

MichaelGreisman’s picture

twistor, that is good to know!! I will plan for that.