Skip Navigation

[Résolu] Many to Many Relationship with Import

Ce fil est résolu. Voici une description du problème et la solution proposée.

This support ticket is created Il y a 6 années et 8 mois. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Ce sujet contient 5 réponses, a 3 voix.

Dernière mise à jour par Minesh Il y a 6 années et 8 mois.

Assisté par: Minesh.

Auteur
Publications
#630127

I originally posted my issue here: https://toolset.com/forums/topic/planning-my-custom-posts/

Unfortunately, I was sidetracked by another project and just now circling back around to it. Since that time I've purchased an agency license under a different email.

That said I have been keeping up with the new relationship features that are in beta and am wondering how this will change the way I go about configuring my setup if at all.

Here are my priorities:

1. The ability to import a list of voters (post type Voters)
2. Import a list of elections (post type Election)
3. Connect that list of Voters to a history of elections they have voted in.
4. Have a page that allows for the filtering of the voters by which elections they have voted in. So, for example, I want to show all voters that voted in Election A, C, and D only. Checking off those elections will display only those voters.

I think reading through the documentation and the response in my previous post that I would create an intermediary post the contains the Voters post ID and the Election Post ID this post "connects" the two. However, I am unclear as to how I would get the Post ID for each post type.

#630211

1. The ability to import a list of voters (post type Voters)

Import is somewhat not the central point of Toolset (until now) and we usually referred to these options:
- CSV Importer: https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/
- Inbuilt post import of WordPress
- Module Manager or Import/Export feature for data structures built with Toolset.

Since the interest and usage of import are wide in Toolset we decided to ask the users what and where and how they want to import.
Please let us know as well, here is the poll to complete:
lien caché

2. Import a list of elections (post type Election)

See above.
This is possible, already, with the simple Post import feature of WordPress or a CSV import.
This, as long those posts are not part of a relationship.

3. Connect that list of Voters to a history of elections they have voted in.

Here the many to many relationships come into play, correct?
For that, right now, there is no tested and suggested import way.
Please see the poll above.

4. Have a page that allows for the filtering of the voters by which elections they have voted in. So, for example, I want to show all voters that voted in Election A, C, and D only. Checking off those elections will display only those voters.

Well, this will be depending on the relationship, but basically, this will be displayed in a View, something that is already possible:
https://toolset.com/documentation/user-guides/front-page-filters/

Depending on the relationship you will, for example, add a "Parent post" filter, or similar, I am not sure how you store the "Voters" against the "posts".

Please, if you need specific assistance, let me know what part you struggle exactly so I may help already before we release the new features.

#630615

Beda,

Thank you for the response and letting me know that importing is something the Toolset team is concerned with. I've completed the survey.

1. I have been able to import "Voters" using WP All Import. So that step is complete. Based on the original post that I linked to above, it was suggested that I use a many to many relationships and create another post type called Elections and link the two. I never did get that far, and now with the relationship changes coming soon, I'm not sure the best way to proceed.

2. Referenced in #1, I've stopped short of doing this because I am not sure how (if?) I can accomplish #3.

3. Yes, that is my original understanding of how this would work. However, since this may not be possible at this point, is there another way to accomplish what I am trying to do?

4. I suppose this question depends on how we can answer #3.

#630966

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

1. I have been able to import "Voters" using WP All Import. So that step is complete. Based on the original post that I linked to above, it was suggested that I use a many to many relationships and create another post type called Elections and link the two. I never did get that far, and now with the relationship changes coming soon, I'm not sure the best way to proceed.
==> good that you able to import "Voters" - I hope you completed the Survey shared by Beda.

2. Referenced in #1, I've stopped short of doing this because I am not sure how (if?) I can accomplish #3.
=> Please make sure that there is no option available to import post relationship for now, we are for now just collecting the votes from users which import plugin they would like to use.

3. Yes, that is my original understanding of how this would work. However, since this may not be possible at this point, is there another way to accomplish what I am trying to do?
=> There is no alternate option available.

Here is new post relationship Doc:
==> https://toolset.com/documentation/post-relationships/

You need to use Beta plugins to use new post relationship and you can download Beta plugins from your account's download page.

4. I suppose this question depends on how we can answer #3.
==> You can use current stable version plugins to build relationship as suggested as when we release the new relationship with stable plugins - at that time it will give you option to switch from old relationship to new relationship.

#631532

Thanks, Minesh. Yes, I did complete the survey.

I need to have something functional in the next week or two, and I suspect there will not be a solution within that time frame.

If I use the current stable version to build the Many to Many relationships (described here https://toolset.com/forums/topic/planning-my-custom-posts/) How do I get the Post ID to use in the _wpcf_belongs_[parent-slug]_id custom field?

I am also contemplating just using a custom Taxonomy for each Election. I know this is not the most efficient way to go but as I said I need to have something we can work with sooner than later.

#631828

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

If I use the current stable version to build the Many to Many relationships (described here https://toolset.com/forums/topic/planning-my-custom-posts/) How do I get the Post ID to use in the _wpcf_belongs_[parent-slug]_id custom field?
==> Well - the parent post ID is saved to postmeta table. So lets say if you have parent post A that belongs to posttype student whose ID is 999.

So - if you want to attached this parent post ID 999 to child post - you need to save postmeta key with your child post ID as:


metakey  = _wpcf_belongs_student_id 
meta value =  999

Please check following Doc if you want to import such data:
https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/import-content-csv-importer-plugin/#importing-types-post-relations