3

I am using Drupal 7, Reference Module (references-7.x-2.x-dev), and Feeds Module (feeds-7.x-2.x-dev).

I created 2 Content Types: Address Book, and City. The Address Book content type has a node reference to nodes of the City content type; the CSV file is imported to "City" content type with success using Feeds Module.

I am unable to import to a node reference using the Feeds module. With it, I created an importer, and mapped 2 fields for AddressBook content type:

  • Name: Target is Title
  • City: Target is NodeID

The CSV file looks like the following:

Name,City
COK,1230

Executing this import gives me unfavorable results, where the City field does not get populated.

Is there an alternative module that may be used or another method that may be recommended?

Please advise where further clarification is needed.

  • If you check on the feeds reports page, does it say anything why the reference didn't worked? Also, are you sure you are using the correct NodeID. – Cyclonecode Dec 13 '11 at 7:02
  • @KristerAndersson Thanks for responding. Looking at the report, I received a PHP error of:" Undefined property: stdClass::$vid in drupal_write_record() ". Which I later assumed that the 'City' Node Reference field is not being mapped to the CSV 'City' field. After importing the csv file, the 'City' CSV data gets populated in the 'Name' field. I do not know how to set the Feeds Mapping Target to the Node Reference field. Must I create custom mapping? Any advice or tips is appreciated. – Hjones Dec 14 '11 at 6:05
4

There is a patch in the works that adds Feeds support for Entity reference fields.

References will most likely be deprecated in favour of Entity Reference in the near future, so this is a good option once it gets finalized.

2

I went out searching for something to support this functionality today. First I found the patch noted in the other answer, but I also found the feeds_entityreference module, which I decided to try. I've got some building to do, but my first attempts at importing entity reference fields have been successful.

  • but it is in dev version... – monymirza Dec 13 '12 at 5:05
  • I wound up dumping feeds_entityreference after finding this other patch in the works on the entity reference module. It's a clearer, cleaner implementation and it sounds like it will get accepted. I have not tried the patch mentioned by @colan, and also not sure why there are seemingly two long-running patch threads for this functionality in the issue queue. – emjayess Dec 14 '12 at 8:58
  • Oh I see the thread colan linked to wound up being closed (duplicate) and linking to the patch thread I linked to. With comments directing people to the related issue thread I mentioned above. I guess this means these answers could be merged together? – emjayess Dec 14 '12 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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