Skip Navigation

[Resolved] Missing half of the relatioshep when Importing csv

This support ticket is created 5 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.

This topic contains 9 replies, has 2 voices.

Last updated by Cesar 5 years, 10 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#453151

Hi,
I'm importing some data for my site.
I have a Parent CPT: Artist
and a Child CPT: Work

I'm importing Works in bulk with a csv, just like in your doc (as I succesfully did before)
I'm using _wpcf_belongs_parent-post-slug_id to import the child parent relationship (first time I try)

My problem is that I have all Works related to the specific Artist, but when checking Artist I can't see any Work associated to it.
So i did import successfully the parent relationship but I can't see the Child from my Parent.

Is there something I'm missing?
Is there a {{ _wpcf_belongs_CHILD-post-slug_id }} I can use?

Thanks!

#453303

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Dear Cesar,

There might be a problem when you migrate the data from one site to another, for example:
The parent post parent-A in the original website, which is using post ID 123, but after you import the data into new website, the post ID turns to be 456, but you still use the using value 123 for custom field "_wpcf_belongs_parent-post-slug_id", then the post relationship lost.

I suggest you import the parent post first, then use the new post IDs in new website to setup the value of custom field "_wpcf_belongs_parent-post-slug_id"

#453342

I'm not migrating the site, I'm importing data from a CSV file and my id were double checked, they match. Please read my question:

"So i did import successfully the parent relationship but I can't see the Child from my Parent."

I do have 1 relationship but the other is missing. That's something that would not happen in the situation you are describing

I did check how the rel is displayed and test them all with same result

#453349
Captura de pantalla 2016-11-04 a las 10.50.43.png
Captura de pantalla 2016-11-04 a las 10.50.15.png

I just tried the same in a new site, just in case it was related with something else (plugins or whatever) but I got same results
Attached you can see 2 screenshots from the same Post relationship, when editing Exhibition(Exposición) from Work (Obra) CPT, Work Relationship is missing, but, as you see it is visible when you check it from Work.
So
Work --> Exhibition is OK
Exhibition --> Work is NOT

Could you please confirm that this is the default behaviour I could expect from Types?
Maybe we found a bug in the import process from your supported plugin

Thanks for your time

#454075

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I can not duplicate same problem, please provide a downloadable URL for below two files:
1) Dashboard-> Export/Import-> Types, click the button "Export Types data"
2) The CSV file you are using, you can provide a demo CSV file which can duplicate same problem

I need to duplicate same problem and debug in my localhost, thanks

#454437

Hi, thanks for your support.
I did what you ask and upload it to drive

drive.google.com/drive/folders/0B7FnMY0HjVpEZHVnakpwVG5nRXc?usp=sharing

thanks

#454725

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Thanks for the details, please check the CSV file you provided:
toolset_example - Hoja 1,

the column name "_wpcf_belongs_parent-post-slug_id" should be "_wpcf_belongs_artistas_id".

You only need to replace the "parent-post-slug" with the actual slug of parent post type, in this case it is:
_wpcf_belongs_artistas_id

I just tested in my localhost, it works fine.

#454839

Thanks so much!!!
So sorry for the misunderstanding.

I will try it

How should that be for a Many to Many relationship?

Should I import the csv for the Children CPT or can Import the relationship to one of the Parent and it will handle the relationship.

Thanks again, you've being so helpful. I really appreciate it

#455189

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

For many-to-many relationships, there are two parent post types + one child post type, so in the child posts, there are two custom fields which values is the parent post ID. for example:
Parent post type A (parent-post-a) + Parent post type B (parent-post-a)
-- Child post type C
There are two custom fields in the child post:
1) _wpcf_belongs_parent-post-a_id, the value is it's parent post (Parent post type A)
2) _wpcf_belongs_parent-post-b_id, the value is it's parent post (Parent post type B)

#455266

Many thanks, that was clear enough.