- This topic has 6 replies, 2 voices, and was last updated 2 years, 6 months ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
- The forum ‘How do I …’ is closed to new topics and replies.
Events Made Easy › Forums › How do I … › Import Location Custom Fields
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
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?
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
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/
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!
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).
Cool, thanks for the explanation – makes sense.
Have a nice day!