Events Made Easy Forums How do I … Import Location Custom Fields

Tagged: , ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #64247
    Anonymous
    Inactive

    Hi Franky

    I feel I’m missing the obvious but from reading the doc I just can’t figure out whatS wrong with my CSV for importing locations. The “regular” columns get imported just fine, but not the custom fields. Which I setup up as location fields with IDs 1,2,3 and 34.
    Can you point me in the right direction? Thanks!

    Here’s my CSV:

    location_name,answer_1,answer_2,answer_3,answer_34,location_description,location_image_url,location_address1,location_city
    Music & Performance Room,H 3005,EG,Main Building,48,"Large Room, open space, Loudspeaker, Beamer, Piano",https://now2022.de/tu_berlin_h3005_copyright_christian_kielmann-9886/,Straße des 17. Juni 135,Berlin
    Workshop Room,MA 551,5,Math Building,22,Blackboard,https://now2022.de/tu-roomphoto-ma-551/,Straße des 17. Juni 136,Berlin
    #64248
    Franky
    Keymaster

    Well, first: all fields should be enclosed with your enclosure setting (not allowed to be empty)
    Second: are your custom fields with ids 1, 2, 3 and 34 of type location?

    #64249
    Anonymous
    Inactive

    Thanks for your quick reply!

    1. Not sure, I fully understand – location_name, location_address1, location_city, and location_description get imported just fine as is – without quotes 🤔 What do you mean by my enclosure setting? With the Import Dialog, I use the default: , and “”
    2. Yes, all location fields

    #64250
    Franky
    Keymaster

    Well, all should be enclosed (see the doc), but without it might work (and usually does).
    But the import for custom fields for locations indeed had a bug, this oneliner fixes it:
    https://plugins.trac.wordpress.org/changeset/2724868/

    #64253
    Anonymous
    Inactive

    Perfect!
    Thanks for catching and fixing the bug. It now works beautifully.

    In terms of enclosing – it seems that this is only necessary if a data item contains the separator character (, in most cases)? I used a Google spreadsheet to create my CSV, and it automatically enclosed the ones with commas in quotes and left the rest as is, the import then was perfect.

    Thanks again!

    #64254
    Franky
    Keymaster

    Well, eme uses fgetcsv and there I give the enclosure as an option (which is by default the double quotes). Maybe that is smart enough to work for non-enclosed fields too 🙂 (which would explain why it works).

    #64255
    Anonymous
    Inactive

    Cool, thanks for the explanation – makes sense.
    Have a nice day!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top