Support

Home Forums Event Espresso Premium Hiding questions based on ticket types (revisited)

Hiding questions based on ticket types (revisited)

Posted: January 9, 2020 at 11:42 am


Phil Wildcroft

January 9, 2020 at 11:42 am

Hi,

In https://eventespresso.com/topic/hiding-questions-based-on-ticket-types/, Josh guided me towards changing the attendee_info_single_template.php filee so that the ticket number was embedded in a div class. This meant questions could be hidden based on the ticket type. This was done on the basis that the same change would be in the next release so my local change would get overwritten but by the same code.

I said that the change worked but I’ve now realised that it doesn’t (doh!). The reason is that for a single ticket using this template, the attendee information and other questions aren’t in the div with the ticket type embedded. That div gets closed before they’re output. So it needs a further change, which is just moving a </div> down a few lines.

The file is modules/single_page_checkout/reg_steps/attendee_information/attendee_info_single.template.php

Original code is:

            </table>
        </div>
    </div>

    <?php
    // Display the forms below the table.
    foreach ($registrations as $registration) {
        if ($registration instanceof EE_Registration) {
            // Attendee Questions.
            $reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link());
            echo ${$reg_form};
        } // if ( $registration instanceof EE_Registration )
    } // end foreach ( $registrations as $registration )

    echo $default_hidden_inputs;
} // end if ( count( $registrations ) > 0 )

?>

<div class="clearfix">

My working code is:

            </table>
        </div>

    <?php
    // Display the forms below the table.
    foreach ($registrations as $registration) {
        if ($registration instanceof EE_Registration) {
            // Attendee Questions.
            $reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link());
            echo ${$reg_form};
        } // if ( $registration instanceof EE_Registration )
    } // end foreach ( $registrations as $registration )

    echo $default_hidden_inputs;
} // end if ( count( $registrations ) > 0 )

?>
    </div> <!-- moved div -->

<div class="clearfix">

I haven’t re-indented so it’s clearer how small the change is.

Any chance of getting that into the release? It is necessary to make this behaviour work.

Phil


Josh

  • Support Staff

January 9, 2020 at 8:06 pm

Hi Phil,

Nice catch on this, I’ve created a pull request so this can get fixed:

https://github.com/eventespresso/event-espresso-core/pull/2193

The support post ‘Hiding questions based on ticket types (revisited)’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso