How to Import Feeds with Field Collections

Jan 24, 2017. | By: Henok Mikre

If you Google “how to import feeds with field collections,” you are most likely going to find resources on how to use Field collection feeds module. That module is very difficult to use and there is a much easier solution. There is a Field collection patch that adds Feeds integration.

We will use a dataset from the DC Open Data portal to test this. The Child Development Centers dataset is a list of centers provided by OSSE (Office of the State Superintendent of Education). It has “Name,” “Address,” “Zipcode” and geocode information for each center. The “Address” column only has the street address. We will create a field collection with two fields, “street” and “zipcode”, with the goal of inserting the “Address” value into “street” field.

Install Feeds (current stable:7.x-2.0-beta3) and Field collection (7.x-1.0-beta12) modules:

drush dl feeds
drush en -y feeds feeds_ui

drush en -y field_collection

Here is the content type we will use to import the data:

Content type

The “Address” field collection above has the following fields:

Field collection

If we look at the fields available to us before applying the patch, this is what we will see:

List of fields before patch

Our fields collection fields are not available in the list. Let’s apply the patch:

# Get patch
curl -LO https://www.drupal.org/files/issues/add_feeds_integration-1063434-232.patch
cd sites/all/modules/contrib/field_collection/

# Test patch
patch -p1 < ../../../../../add_feeds_integration-1063434-232.patch --dry-run

# Apply patch
patch -p1 < ../../../../../add_feeds_integration-1063434-232.patch

# Clear cache and registry
drush cc all; drush rr; drush cc all

If we check the field list again, we will see our field collection fields:

List of fields after patch

That’s it!

Subscribe

Subscribe to this blog via RSS.

Recent Posts

About

BLEN Corp is a small, minority, and veteran-owned information technology firm located in Washington D.C. Since 2004, we have been ahead of the curve in early adaption and implementation of cutting edge technologies including web and mobile development, service-oriented architecture, and other innovative web based solutions. Look at some of our projects.

Social Links

Our Bunker

WeWork Wonder Bread Factory
641 S St. NW
3rd Floor
Washington, DC 20001
United States.