Events Made Easy › Forums › How do I … › Import Location Custom Fields
- This topic has 6 replies, 2 voices, and was last updated 3 years, 5 months ago by
Anonymous.
-
AuthorPosts
-
Mon 16 May 2022 at 23:40 #64247
Anonymous
InactiveHi 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,BerlinMon 16 May 2022 at 23:43 #64248Franky
KeymasterWell, 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?Mon 16 May 2022 at 23:54 #64249Anonymous
InactiveThanks 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 fieldsTue 17 May 2022 at 00:15 #64250Franky
KeymasterWell, 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/Tue 17 May 2022 at 15:23 #64253Anonymous
InactivePerfect!
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!
Tue 17 May 2022 at 15:46 #64254Franky
KeymasterWell, 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).
Tue 17 May 2022 at 15:49 #64255Anonymous
InactiveCool, thanks for the explanation – makes sense.
Have a nice day! -
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.