Import Data To Field Collection Using Feed Importer | Drupal

Creating hierarchical tree in Drupal using view org charts.
December 5, 2016
Difference between UI and UX design.
May 23, 2017

Import Data To Field Collection Using Feed Importer | Drupal

Feed importer is one of the most important module supported by drupal community,which helps in importing various data format such as CSV,XML,Plain text and many more to your specific content.

Feed importer is convenient method when it comes to import the data to your custom content type but importing data to the field collection would  require little amount of trick

So today we will try to give you simple and direct steps to import the field collection data and relate it to your particular content type

Let’s just make an assumption for convenience:

Content Type: Market Details

Field Collection: Price_Per_item

Step 1:  Create the content type Market Details and add field Such as Title and S.No

Step 2: Add Field Collection Price_Per_item

Step 3: Create Fields Such as list and price In field collection Price_Per_item

step 4: Goto feed importer and create 2 new importer one for the content type and another for field collection

Note:  you can’t import data to content type and field collection in same importer so it is required to create 2 different importer and then combining the data of 2 importer to get desired result

step 5: open the feed importer for the content type Market Details and add following settings to it.

step 5.1: click over Fetcher And choose file upload or HTTP fetcher where ever your file is located

step 5.2: Select the type of File/Parser in Parser Setting

Step 5.3: click on processor and choose Node(if not selected by default)

step 5.4: Move to the Node processor and select the content type in which the data has to be uploaded

step 5.5: now click the mapping and choose the source field(from your local file) and map it to the target field of your content type Market Details

Note: importing data to content type requires to specific trick its done in same way the magic methods lies behind the settings of how you import the field collection.Don’t get worried just follow the following easy steps

step 6: choose the importer of Field Collection Price_Per_item

step 6.1:click over Fetcher And choose file upload or HTTP fetcher where ever your file is located

step 6.2: Select the type of File/Parser in Parser Setting

Step 6.3: click on processor and choose Field Collection option, if it is not available then add module Field Collectin feed

step 6.4: Goto to the processor setting choose the field collection in which data has to be imported and move to the bottom of page where it says  Field/property name of Host entity GUID  and Identifier field name

step 6.5:  create an extra field in Content type Market details and Field Colection Price_Per_item that will allow to link the field collection with content type and provide the machine name of content type in  Field/property name of Host entity GUID  and that of Field Collection in Identifier field name

step 6.6: In the mapping section do the following changes-:

uid (csv column) : Host Entity GUID (this will go into the field you entered in “Host entity GUID” on the settings panel)
S.No (csv column) : Identifier Field (this will go into the field you entered in “Identifier field” on the settings panel)
list (csv column) : Page list(field_page_lsit)
price (csv column) : Page price (field_page_price)

 

import the data and probably you will get what you expect…

 

Leave a Reply

Your email address will not be published. Required fields are marked *

two × three =