Home › Toolset Professional Support › [Resolved] Split: Setting up a view with mixed data between two relationships – copy custom fields to another post type post custom field – session wise display for other entities
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 is split from https://toolset.com/forums/topic/split-split-split-setting-up-a-view-with-mixed-data-between-two-relationships-copy-custom-fields-to-another-post-type-post-custom-field-add-total-column-add-session-order/
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)
This topic contains 9 replies, has 2 voices.
Last updated by Minesh 1 year, 5 months ago.
Assisted by: Minesh.
You have an awesome weekend too. This is now perfect, so I'll be able to mark this one resolved now.
So now moving to the next question / ticket split, I am going to set this up for showing Women's Doubles, Mixed Doubles A, and Mixed Doubles B in addition to the Men's Doubles only that we have here. I'm looking over how everything is done here and this is my resulting question.
Within the show-all-teams view here:
hidden link
After looking over your code fully, and seeing how the loops are set up to display the table rows within a single table, I'm thinking the easiest way to show Men's Doubles, Women's Doubles, Mixed Doubles A and Mixed Doubles B in separate tables under the same session groupings is as follows:
I want to take your line of code here:
[wpv-view name="standings-by-round-matches" teamid="[wpv-post-id]"]
and set it up for conditional display. I would like to have a query filter at the top of the page that end users control. That filter would just be a dropdown select box that has Men's Doubles, Women's Doubles, Mixed Doubles A and Mixed Doubles B as the selection options. Then what I would do with your line above would be to change it as follows:
[wpv-conditional if="('?' eq 'Men's Doubles')"] [wpv-view name="standings-by-round-matches-men" teamid="[wpv-post-id]"][/wpv-conditional] [wpv-conditional if="('?' eq 'Women's Doubles')"] [wpv-view name="standings-by-round-matches-women" teamid="[wpv-post-id]"][/wpv-conditional] [wpv-conditional if="('?' eq 'Mixed Doubles A')"] [wpv-view name="standings-by-round-matches-mixed-a" teamid="[wpv-post-id]"][/wpv-conditional] [wpv-conditional if="('?' eq 'Mixed Doubles B')"] [wpv-view name="standings-by-round-matches-mixed-b" teamid="[wpv-post-id]"][/wpv-conditional]
Note that where I have inserted the ? characters above, that just means I'm unsure of what would need to be inserted there.
My problem with setting this up myself is I am unsure about how to set up this filter. I do not have a field or taxonomy for Men's Doubles, Women's Doubles, MIxed Doubles A, and Mixed Doubles B. There's no way to have this as a field or taxonomy because all of these scores are within the Matches content type, not separated as their own content type. So I wouldn't have a way to define this query filter in a way where I know how to do it. Is there any way to just set up a basic select drop-down where we provide the options without running it through any field or taxonomy and have the results from that work within the conditional provided my ? characters are replaced with how this really needs to be done?
Then once the front-end query filter is set up, I will also duplicate/rename your current standings-by-round-matches views as needed to have separate views for standings-by-round-matches-men standings-by-round-matches-women standings-by-round-matches-mixed-a and standings-by-round-matches-mixed-b. I should be able to do this step myself, unless you think I'll get some unexpected surprises stemming from the javascript code you added trying to do this.
I have gone ahead and duplicated all the views and changed all the fields as needed. I kept your original standing-by-round-matches view as is just in case I'm wrong about this being the best approach. So all I should need help on here is the above question about setting up the filter.
Hello. Thank you for contacting the Toolset support.
You can not filter the results that way as we are using the same view multiple times to display the session.
If you visit the page where we added the view to display all those content group by sessions:
=> hidden link
As you may noticed with above edit page, the views are added as given under:
<h3>Morning - 3.0</h3> [wpv-view name="show-all-teams" session="Morning - 3.0" sessionslug="morning30"] <h3>Morning - 3.5</h3> [wpv-view name="show-all-teams" session="Morning - 3.5" sessionslug="morning35"] <h3>Morning - 4.0+</h3> [wpv-view name="show-all-teams" session="Morning - 4.0+" sessionslug="morning40plus"] <h3>Afternoon - 3.0</h3> [wpv-view name="show-all-teams" session="Afternoon - 3.0" sessionslug="afternoon30"] <h3>Afternoon - 3.5</h3> [wpv-view name="show-all-teams" session="Afternoon - 3.5" sessionslug="afternoon35"] <h3>Afternoon - 4.0+</h3> [wpv-view name="show-all-teams" session="Afternoon - 4.0+" sessionslug="afternoon40plus"]
Better you create separate page for your each group for:
- Men's Doubles
- Women's Doubles
- Mixed Doubles A
- Mixed Doubles B
So you will have four pages and with all those four pages you will have to group it by session as you can see with the above example.
OK, let me see how that works. If I do it that way, I can then set up
- Men's Doubles
- Women's Doubles
- Mixed Doubles A
- Mixed Doubles B
as a WordPress menu and insert it into the page above where the view displays and figure out getting it to display as a dropdown jump-menu. Then people will be able to go to each page that way.
Great - If you need any help, please feel free to open new ticket.
Well, this is encouraging. I was able to successfully duplicate everything you've done to create the separate pages for Men's Doubles, Women's Doubles, Mixed Doubles A, and Mixed Doubles B.
hidden link
hidden link
hidden link
hidden link
I now have to double-check all the math on all of these pages, but I think I have it right. If so, at least I was able to do that without having to ask for more assistance. Getting closer, if successful.
The last step is going to be to hopefully be able to add a dropdown taxonomy filter that end users can use to filter by tournament/league on these pages. But I saw that effort fail on a page that Luo Yang previously helped us with and I had to file another ticket to ask for additional assistance from him there. I'll wait to see what he says before asking for the same here, because I have a feeling the approach is going to be the same, or it may be impossible to do because of the complexity of structure of how everything had to be set up to get this to work. I'll let you know if/when to split this into another ticket for this filter step shortly. Please keep this ticket open until then. I'm hoping we can add this filter so I won't have to create new pages and views for every tournament/leauge in here. That's going to make the Views admin page get VERY crowded over time.
I may also need additional help in this ticket if I find any math problems with the Women's, MIxed A, and MIxed B pages. I don't think that will happen though. But I always check everything before saying for sure that it is working.
It seems the result showing with all other pages is perfect.
The last step is going to be to hopefully be able to add a dropdown taxonomy filter that end users can use to filter by tournament/league on these pages. But I saw that effort fail on a page that Luo Yang previously helped us with and I had to file another ticket to ask for additional assistance from him there. I'll wait to see what he says before asking for the same here, because I have a feeling the approach is going to be the same, or it may be impossible to do because of the complexity of structure of how everything had to be set up to get this to work. I'll let you know if/when to split this into another ticket for this filter step shortly. Please keep this ticket open until then. I'm hoping we can add this filter so I won't have to create new pages and views for every tournament/leauge in here. That's going to make the Views admin page get VERY crowded over time.
==>
It's not possible to add filter to any of the views as we are using the view muiltiple times and we are already filtering the results by different sessions as you already know:
<h3>Morning - 3.0</h3> [wpv-view name="standings-by-round-men-show-all-teams" session="Morning - 3.0" sessionslug="morning30"] <h3>Morning - 3.5</h3> [wpv-view name="standings-by-round-men-show-all-teams" session="Morning - 3.5" sessionslug="morning35"] <h3>Morning - 4.0+</h3> [wpv-view name="standings-by-round-men-show-all-teams" session="Morning - 4.0+" sessionslug="morning40plus"] <h3>Afternoon - 3.0</h3> [wpv-view name="standings-by-round-men-show-all-teams" session="Afternoon - 3.0" sessionslug="afternoon30"] <h3>Afternoon - 3.5</h3> [wpv-view name="standings-by-round-men-show-all-teams" session="Afternoon - 3.5" sessionslug="afternoon35"] <h3>Afternoon - 4.0+</h3> [wpv-view name="standings-by-round-men-show-all-teams" session="Afternoon - 4.0+" sessionslug="afternoon40plus"]
So, if you add a filter to view "standings-by-round-men-show-all-teams" the filter will be displayed six times as you are adding the view "standings-by-round-men-show-all-teams" six times on the page.
So the result page should be displayed as it is which is the current result and there is no possibility to add frontend filter to the views due to the such complex structure we are using.
The math checked out perfect on all pages. So I'm quite happy I was able to duplicate what you've done here without messing it up.
That's what I figured with the front-end filter question.
I'm seeing that you have each instance of the view filtering on session through this bit of code:
session="Morning - 3.0" sessionslug="morning30"
I just wish there was a way to add something like this
tournament="#####" tournamentslug="#####"
and have ##### pull conditionally from the options in a select dropdown at the top of the page (outside of the view) providing options that match with the taxonomy terms for the Tournaments taxonomy. I'm thinking that would be the approach needed for this. I know the part about pulling conditionally from a select dropdown residing outside of the view is the part that is problematic there.
Otherwise, I now think we're all good on this for now, at least until the next tournament/league particulars force me to figure out new things structurally and/or to set up new views as needed that may reveal additional issues. I'm always amazed and appreciative of how much you guys are willing to help with these advanced use cases for Toolset. As I've said before, I hope you're getting templates and/or code snippets out of all this real-world example work you're helping with that will allow you to do bigger and better things with Toolset down the road. Thanks as always.
I suggest its better to wait as you do not have any other tournaments content and you already filtering the following view that is a child view and that is filtered with tournaments as " Inaugural Tournament":
=> hidden link
I suppose we are done here and it was pleasure to help you out and you are always welcome motivate others using Toolset and share your experience and feedback.
Yeah, I'll see what happens when we get things set up for one of these leagues or the next tournament and get results to show on that. Everything is done as needed for the Inaugural Tournament to emulate what we have in the results spreadsheet provided to me by the client to use as my goal to achieve for all of this. Now it's just a matter of making the system as flexible as it can be for handling different structures in the most automated ways possible. Hopefully tournament league structure changes won't be so drastic that they cause additional huge problems. I already know some will have different sessions than what we defined here, but I see how to set that up in what you've provided, so I should be OK there. The way the session grouping is done with code on the page itself will make that easy to define, unless there is something I'm missing with other code set up to do this.
I was testing how far I could get with adding filtering to each view set up so far. That's why I have it on the view you linked. That didn't do anything because that view doesn't display on the page. It's just feeding data to the javascript and then displayed with another view. I realized that after I tried it and remembered what that view does in what Luo Yang set up. I'm able to have that filter on all the other views except for these most complex ones that are providing Standings pages.
I also added more detailed descriptions to all the existing views to help me keep everything straight as far as what is doing what. I changed some view names as well. It was starting to make my head spin trying to keep everything straight on the Views admin page. I have some Views in there that are not used now because they were just my first draft efforts to give you something to go by with what I was wanting and what I had tried. My head spinning at keeping all these Views straight is why I was trying to get the filtering on everything because I didn't like the idea of having so many more Views needing to be added for every tournament/league. But if I have to do it that way, I have to do it that way. No problem. The way I added the descriptions and changed names will make that easier for me now.
Ok great - lets investigate further when you have all content setup with multiple tournaments.