0

I migrate my content from an old D7 site to D8 site. All went well, except the addresses from field address where not migrated to the new address field.

Then I use feeds, feeds_migrate, content-import... Nothing work for this.

Then finaly start learning how to do this in a custom module. I used the plugin from the module addres, I wrote my own plugin. No migration seems to work.

I have a CSV file with the addresses. There is also a NID row that is unique, I also try with the title field who also is unique. I try to import this csv file into my content type business. The nodes are existing with the NID numbers. Just try to fill the address in each content. All addresses are in Belgium.
Below my YML file in a custom module.

    id: migzaal
label: Adres veld migratie
source: 
   plugin: csv
   path: modules/custom/adresmigratie/assets/adresinvoer.csv
   header_row_count: 1
   ids:
     - Nid
process:
   nid: Nid
   field_adres:
     plugin: addressfield
destination:
  plugin: 'entity:node'
  default_bundle: business
  overwrite_properties:
    - 'field_adres/address_line1'
    - 'field_adres/locality'
    - 'field_adres/postal_code'
    - 'field_adres/country'

Can someone guide me in the right direction. Thanks.

  • AFAIK Migrate can not update foreign entities (e.g. nodes not created with the Migrate module) – Hudri Aug 19 '19 at 13:41
  • The nodes did been made by the Migrate module. But I will try it with feeds, it has escape me that there was a patch. – Belba Aug 20 '19 at 8:47
  • If the nodes were created with migrate, you can update them. But you have to calculate the nid using migration_lookup plugin in the process section, you can not directly pass the Nid from the CSV (this would create a new entity, instead of updating an existing entity) – Hudri Aug 20 '19 at 9:33
-1

I've been through a similar situation and I resolved it depending on the feeds module.

You need to use the following patch to allow the address field to be recognized by the feeds module https://www.drupal.org/project/address/issues/2882589

This is might not be what you're looking for at this stage but I thought this might help.

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.