🇷🇸Serbia @norbert-goco

Subotica
Account created on 4 April 2020, about 5 years ago
#

Recent comments

🇷🇸Serbia norbert-goco Subotica

I was in a hurry.
The number of entities in the migrate_map_* table now matches with the CSV, but the elements with the same name have a same ID (destid1), so it's still not good.

E.g.:
sourceid1, sourceid2, destid1
packaging, 1-5kg, 568
weight, 1-5kg, 568

🇷🇸Serbia norbert-goco Subotica

Ok, I figured it out. It works fine.
If bundle and bundle_key are not defined then it works dynamically, I just had to make the CSV source plugin look at the attribute when creating the mapping, not just the name: ids: [attribute, name]

So the updated YML:

source:
  plugin: csv
  path: 'modules/custom/my_module/files/product_attribute_values.csv'
  header_offset: 0
  ids: [attribute, name]

process:
  attribute: attribute
  name: name
  attribute_value_id:
    plugin: entity_lookup
    entity_type: commerce_product_attribute_value
    source: name
    value_key: name
    access_check: false

destination:
  plugin: 'entity:commerce_product_attribute_value'
🇷🇸Serbia norbert-goco Subotica

I've created a patch for Drupal 11.

🇷🇸Serbia norbert-goco Subotica

I modified the patch because when I added a country code field to the user and put it on the admin page, its value was in the value parameter, not in the country_code.

🇷🇸Serbia norbert-goco Subotica

Thanks for the patch. Also works on Drupal core 9.5.11.

Production build 0.71.5 2024