Skip Navigation

[Resolved] Importing data to checkbox fields using WP-All-import addon

This support ticket is created 4 years, 8 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by matijaK 4 years, 8 months ago.

Assisted by: Nigel.

Author
Posts
#1307827

I used to work with WP-all-import PRO extension to import data into my custom fields values for our course dates, for example data such as: starting and ending dates, hours when course takes place and specifically day of the week which is custom field of Checkbox type, built with Toolset.

After some updates the above option of importing didn't work for me anymore so I decided to switch to the regular WP-All-Import paired with the Types Addon (beta) <a href="https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/how-to-import-data-from-a-csv-file-using-the-wp-all-import-toolset-types-add-on-plugin/">described here</a>.

But I can't seem to figure out how to import values into checkbox fields. I can't find any documentation related to checkbox data or any other info, so please inform me how to specify in my CSV/Xlsx what values to put in to match checkboxes.

In my case the field is for days of the week, so there's a list of seven values, Mon-Sun, that a user can select when creating a new or editing an existing course date. I tried importing as numbers or as field label or as field value, but when import is completed only the first checkbox (in this case Monday) is always selected, regardless of what the input data in the file was.

Thanks in advance.
M.

#1307875

btw: I also tried importing the database entries like this:
a:1:{s:64:"wpcf-fields-checkboxes-option-e1ecb4c8ff1ef0fe8df6b15795863b16-1"
a:1:{s:64:"wpcf-fields-checkboxes-option-2a48eeed3ef24c667b140e7fb4ab55ab-1"
a:1:{s:64:"wpcf-fields-checkboxes-option-beb9dc52446233c9fd671c2bd5f3bd9c-1"
a:1:{s:64:"wpcf-fields-checkboxes-option-dea449fdcce92fe8044a555332cb325e-1"
a:1:{s:64:"wpcf-fields-checkboxes-option-cda67fd769eb95ffd3e4ad0db8c014ed-1"

But again, it does not produce expected results. I ran these tests on my local deployment.

#1307963

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Matija

I'm sorry to say that I don't have a solution for this.

The implementation of the checkboxes field in Types is very complex (it is old code) and we do not have an API function to save checkboxes fields, we only have the API function for displaying Types fields, including the checkboxes fields.

I created an internal request for such a function some time ago and it was recently agreed by the developers to make such a function available, although they commented just yesterday that this was dependent on some other feature and may take some time to implement.

Until such a function becomes available what you are aiming to do is simply not possible, and it would be very hard for a third party plugin to offer such a feature because it would require them to reverse-engineer the Types code to see how it is done internally.

For the time being, data cannot be imported into checkboxes fields.

I suggest you pay close attention to the changelogs of the Types plugin updates to see when support for saving checkboxes fields programmatically is added.

#1312843

Hi Nigel,
just to inform you, I figured out a way to do this relatively easily:
using All-import-PRO (to be able to import data into custom fields) and the All-import Toolset addon (to be able to import parent ID into relationship) I'm able to import my data as before (before relationship handling was thoroughly updated).

To be more specific: I exported some posts to see how checkboxes are stored, depending on what option is selected. I then created my Excel file to print out the correct string (i.e.: "a:1:{s:64:"wpcf-fields-checkboxes-option-dea449fdcce92fe8044a555332cb325e-1";a:1:{i:0;s:1:"4";}}") depending on the option I want to select. Import this part using custom fields option in all-import-pro and you're done.

Thanks anyway,
M.

#1312845

My issue is resolved now. Thank you!

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