Home›Toolset Professional Support›[Resolved] 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
[Resolved] 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
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.
I just copied and pasted all the conditional code you set up to get the correct score for each team in each round and added + between them to do the calculation. I also removed all the spacing/line breaks because I feared that would interfere with the calculation functionality in some way. So I have all of this as one continual line. I'm sure there's a syntax problem in there somewhere. The result of adding this code causes the view output to completely white screen. Nothing shows on the page with this added, not even the stuff you had working before. So I removed this code on the view right now. I'll see what you have to say about this before trying to add anything different.
Here is the code snippet provided to us in another support thread for doing the calculations:
<?php
/**
* New custom code snippet (replace this with snippet description).
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
This code works perfectly with the calculations we've already set up. I'm guessing something with all the conditionals present in my attempt above is causing this to fail.
I have another question on this now, but because you're already fully familiar with what I'm going for here, I'd like to continue working with you on this instead of leaving it to the random assignment of support team members on a new ticket. So can you split this again and I keep working with you?
The next thing needed is I have added the field back to the parent view you created to show the session. But I don't want it to appear as a first column <th> and <td> as I have set it up. I just set it up that way so you could see it. I'd like it to work to group the results by session the same way you helped set it up for us here:
hidden link
Only the Session should be a header here, not the Date, not the Round, not the Game. I tried to emulate how you already did this for us with another view, but what I tried didn't work. What I tried is as follows:
I added the following code above the start of the table in the View: show-all-teams view you created:
I added and activated a custom code snippet called sorting-by-session-on-standings-by-round-page after duplicating the code you gave us called sorting-by-date-session-round-on-results-page. I duplicated that code and removed all the references to date, round and game headers in that, leaving just the session header and to use the Team session field (wpcf-session) instead of the Match session field (wpcf-session2). I changed the view ID line to
$view_ids = array( 1353 );
as well so it would execute on the view we are working on here. I thought that might work, but it didn't change anything on the output.
I'm afraid I'm just not good enough at this. I'm doing my best to learn and trying to emulate things you've already done before I ask for more help. But it seems like I hit dead ends like this more often than not. I thought I might be able to get this step to work myself.
New threads created by Minesh and linked to this one are listed below:
As I shared with previous ticket as well, we entertain only one question per ticket. This will help other users searching on the forum as well a help us to write correct problem resolution summery.
I've split the ticket with your new question and I urge you to mark resolve all tickets including this one.
My issue is resolved now. Thank you! Another very hard one, but again, awesome support.
The math worked perfectly. I did encounter a major problem with having 3 teams with similar/same names where I didn't have them assigned to the correct matches. I had to sort all of that out but corrected everything and the math is perfect. So this one is done. Thanks as always.