Skip Navigation

[Resolved] MMA Database Design with the help of Toolset

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

Problem:

I'm trying to create a functional MMA fights. (example.png)

I created CPTs -tournament (event), fight, fighter. But I'm stuck in some aspects. When I create a fight in backend, I choose two fighters (fight-fighters.jpg). Also I created select fields to this relationship:
- "result" (win, loss, draw)
- "method" (knockout, submissions, decision of the judges).

1. Here I have the first question. Am I on the right track? It's a little uncomfortable...After all, it's somewhat inconvenient to choose a "win" for one fighter and "loss" for another, the same for "method" .. You can get confused. Maybe I'm doing something wrong? What structure would you recommend?

2. To display the relationship fields, I had to use the view, because in the content template for the fighter, this field did not output anything. Am I doing the right thing?

Things have changed a bit in Toolset, and I want to adapt to new improvements and use the plugins correctly.

Solution:

Q1) I think your are on the right track, since one "fight" can connect to 2 "fighter" posts, and one "fighter" post can connect to multiple "fight" posts, you can setup many-to-many relationship between "fight" and "fighter" custom post types.

Q2) I have tested it in my localhost be below steps, it works fine:

1) Create two post type "fight" and "fighters", setup many-to-many "fight-fighter" relationship between them

2) Create a view, list posts of post type "fights fighters Intermediary Posts"

3) Filter by post type relationship:

Select posts in a fights fighters relationship that are related to the Post where this View is shown.

see screenshot: filter.JPG

https://cdn.toolset.com/wp-content/uploads/2018/05/904763-filter.JPG

4) in the "Loop Editor" section, display the result as below:

[wpv-post-link item="@fight-fighter.parent"] | 
[wpv-post-link item="@fight-fighter.child"] | 
[types field="result"][/types] | 
[types field="method"][/types]

Then put above view into a single "fight" post, it works fine.

Relevant Documentation:

This support ticket is created 6 years, 6 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.

Our next available supporter will start replying to tickets in about 1.29 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by Max 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#904459

Max
fight-fighters.jpg
example.png

Dear Luo

I'm testing the latest versions of plug-ins (beta). And I'm stuck, I need help. I'm trying to create a functional MMA fights. (example.png)

I created CPTs -tournament (event), fight, fighter. But I'm stuck in some aspects. When I create a fight in backend, I choose two fighters (fight-fighters.jpg). Also I created select fields to this relationship:
- "result" (win, loss, draw)
- "method" (knockout, submissions, decision of the judges).

1. Here I have the first question. Am I on the right track? It's a little uncomfortable...After all, it's somewhat inconvenient to choose a "win" for one fighter and "loss" for another, the same for "method" .. You can get confused. Maybe I'm doing something wrong? What structure would you recommend?

2. To display the relationship fields, I had to use the view, because in the content template for the fighter, this field did not output anything. Am I doing the right thing?

Things have changed a bit in Toolset, and I want to adapt to new improvements and use the plugins correctly.

Thanks

#904763
filter.JPG

Hello,

Q1) I think your are on the right track, since one "fight" can connect to 2 "fighter" posts, and one "fighter" post can connect to multiple "fight" posts, you can setup many-to-many relationship between "fight" and "fighter" custom post types.

Q2) Am I doing the right thing?
I have tested it in my localhost be below steps, it works fine:
1) Create two post type "fight" and "fighters", setup many-to-many "fight-fighter" relationship between them
2) Create a view, list posts of post type "fights fighters Intermediary Posts"
3) Filter by post type relationship:
Select posts in a fights fighters relationship that are related to the Post where this View is shown.
see screenshot: filter.JPG
4) in the "Loop Editor" section, display the result as below:

[wpv-post-link item="@fight-fighter.parent"] | 
[wpv-post-link item="@fight-fighter.child"] | 
[types field="result"][/types] | 
[types field="method"][/types]

Then put above view into a single "fight" post, it works fine.

For your reference.

#904779

Max

Luo, thanks for the information.
I created everything anew, but I do not have this option list posts of post type "fights fighters Intermediary Posts".

If I click on the checkbox "Intermediary Post Type visible in the WordPress admin menu" at the time the relationship was created, only then it appeared in Views settings. Is it normal?

#904786

Yes, it is expected result, you will need to enable the option "Intermediary Post Type visible in the WordPress admin menu".
Please provide a test site, I can setup a demo for you.

#904788

Max

Thanks for the help, and I think now there is no need to waste your time creating obvious things.
But I'll ask to leave access details active, and not close the ticket.

#904804

OK, please update this thread if you still need assistance for it. thanks

#904811

Max
adversary.png

OK. I have 2 fighters - Max and Andre. How can I show Max's Title when I look at Andre's profile?
What settings do I need to make this work?
P.S. Max and André - 2 fighters in a single fight

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/split-mma-database-design-with-the-help-of-toolset/

#905287
#905517

Max

resolved