Skip Navigation

[Resolved] Bulk populate countries and provinces

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to import a CSV of all countries and provinces in Italy so I can use them in custom field options.

Solution: It's not currently possible to import custom field options directly from a CSV, but it is possible to import from an XML file. Begin by creating one or two options, then use Toolset Import / Export to export these options as XML. Then you could modify that XML file to include the desired results, and re-import it. This step is not a supported Toolset feature so it will be up to you to transform the CSV file into valid XML

You may also find this module useful:
https://toolset.com/forums/topic/how-to-import-states-and-countries-into-selects-for-fields/

Relevant Documentation: https://toolset.com/documentation/user-guides/how-to-importexport-types-structures/

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by Franco Calcagni 6 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#536524

I am trying to: find a fast way to populatre a dropdown list of countries and another sub category of provinces. is there a way to avoid inserting those data one-by-one?

I visited this URL:

I expected to see:

Instead, I got:

#536643

Hi, another forum user was kind enough to create a module that contains Countries, States and Provinces. Please check this ticket:
https://toolset.com/forums/topic/how-to-import-states-and-countries-into-selects-for-fields/

You can download the zip file, then import the modules using Toolset Module Manager - it should be available in your account downloads page if you don't already have it. Will this be helpful? If it doesn't quite work for your needs, please let me know and I may be able to help.

#536647

Thanks Christian, but we mean Provinces and areas of Italy, we need to know if there is a method of importing some select items from within a csv file.
Any help on that?

Thanks.

Franco

#536716

There is no way to directly import options from a CSV file, unfortunately. However, if you begin by creating one or two options manually, then you can export that list of options as an XML file using Toolset Import / Export Tools. Then you could modify that XML file to include the desired results, and re-import it. You wouldn't be able to use a CSV directly, but you might be able to transform it somehow into a valid XML document. This isn't a supported feature of Toolset, so I wouldn't be able to assist you.

#537052

Hi Christian we exported an XML file of TYPES data but we get an XML file that contains a random generated code for each option of a select (see screenshot) so we cannot populate that select outside Toolset with other additional options because we don't know how to populate that code

(i.e. <wpcf-fields-select-option-c502d5216d81f2407112ea41cb54e711-1>)

Kindly let me know if there is a workaround for that or how to populate that XML

Thanks,

Franco

#537224

It's an arbitrary, unique hash used for internal purposes. You could supply your own arbitrary unique hash here, or simply omit it and increment the number and it should be fine. For instance:

<wpcf-fields-select-option-1>...</wpcf-fields-select-option-1>
<wpcf-fields-select-option-2>...</wpcf-fields-select-option-2>
<wpcf-fields-select-option-3>...</wpcf-fields-select-option-3>
<wpcf-fields-select-option-4>...</wpcf-fields-select-option-4>
...
#538470

Issue resolved thanks for your help .

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.