Home › Forums › Ticket Products › Event Tickets Plus › Move Ticket Form to list view
- This topic has 16 replies, 3 voices, and was last updated 10 years, 2 months ago by
Josh.
-
AuthorPosts
-
February 3, 2016 at 4:20 pm #1067301
Matt Gray
ParticipantHi,
I have the Event Ticket Plus plugin and have just figured how to move the Ticket Form to beneath the main content on the single event page, however it’d be really useful to be able to lose the single event page altogether and just have the ticket form, quantity, but it now etc on the mini event view on the list view here: http://new.aquaphysical.com/classes/category/floatfit-classes
Is that possible, and how would I go about doing that?
Going to the single page view is just an unnecessary extra click at the moment.
Thanks!
MattFebruary 4, 2016 at 8:41 am #1067741Josh
ParticipantHey Matt,
Thanks for reaching out to us!
You can add to that section by duplicating the “add_action” portion to move the form within the single-event view and changing the first argument for the add_action to “tribe_events_after_the_content”.
Let me know if this helps.
Thanks!
February 4, 2016 at 9:02 am #1067761Matt Gray
ParticipantHi Josh,
Thanks for your reply – sorry I’m not particularly au fait with how this works – could you spell it out a bit more please?
I tried changing it to this, but it didn’t work?
tribe_etp_move_tickets_purchase_form( 'tribe_events_after_the_content', 5 );I want it to end up on the list view please…
Thanks again,
MattFebruary 4, 2016 at 9:11 am #1067767Matt Gray
ParticipantIn fact, that did work – thanks!
I was looking at an event without a ticket… stupid me!
Where’s the template to change what’s displayed in the ticket form, and can this be different in different places that it’s placed?
I also have a shortcode displaying top 3 events here: http://new.aquaphysical.com/floatfit
How would I add it there too, or would you suggest just using the Events PRO shortcode instead of the one provided with Avada template?
Cheers,
MattFebruary 5, 2016 at 10:41 am #1068382Josh
ParticipantHey Matt,
There is only a single template for outputting the ticket form. The simplest approach for customizing for the different views would by to use CSS to target the different elements that you don’t want to display.
I’m not too familiar with the Avada shortcode here. However, if I were a betting man I’d say they probably do something similar to what we do with our PRO plugin and packaging the widgets as shortcodes. With this, you can try following the same steps above but using the “‘tribe_events_after_list_widget'” hook this time and seeing if that works for that shortcode.
Thanks!
February 12, 2016 at 7:44 am #1072165Matt Gray
ParticipantHi Josh,
Thanks for helping – makes sense RE shortcode.Back to the moving of the ticket form, it’s successfully moved here: http://aquaphysical.mattgraydesign.co.uk/classes/category/floatfit-classes
But I need it on the single page as well…
How do you successfully move it to these two places?
tribe_etp_move_tickets_purchase_form( 'tribe_events_after_the_content', 5 );tribe_etp_move_tickets_purchase_form( 'tribe_events_single_event_after_the_content', 5 );It’s only doing either/or at the moment?
Thanks,
MattFebruary 15, 2016 at 10:30 pm #1073527Josh
ParticipantHey Matt,
Thanks for following up here. I’m glad things are working on the archives now!
I’m a bit confused on the need for the single here. Check out this item for moving the form on the single event template and let me know if this helps in addressing the issue.
Thanks!
February 16, 2016 at 9:06 am #1073865Matt Gray
ParticipantThanks… the need is that I want people to be able to buy directly from the list page as well as from the individual event.
Currently it’s moved from the sidebar to the list view only, but I can’t work out how to have it on the archive as well as on the single page view.
i.e.
Shows here: http://aquaphysical.mattgraydesign.co.uk/classes/category/floatfit-classes
But not here: http://aquaphysical.mattgraydesign.co.uk/class/cheshire-lido-manchesterCan it be on both?
Currently this is what I have added:
/* * Moves the front-end ticket purchase form, accepts WP action/hook and optional hook priority * * @param $ticket_location_action WP Action/hook to display the ticket form at * @param $ticket_location_priority Priority for the WP Action */ function tribe_etp_move_tickets_purchase_form ( $ticket_location_action, $ticket_location_priority = 10 ) { $etp_classes = array( 'Tribe__Tickets_Plus__Commerce__EDD__Main', // 'Tribe__Tickets_Plus__Commerce__Shopp__Main', // As of ETP v4.0 Shopp will generate errors when referenced, if not active. Uncomment this line if you have Shopp Active 'Tribe__Tickets_Plus__Commerce__WPEC__Main', 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ); foreach ( $etp_classes as $ticket_class ) { if ( ! class_exists( $ticket_class ) ) break; $form_display_function = array( $ticket_class::get_instance(), 'front_end_tickets_form' ); if ( has_action ( 'tribe_events_single_event_after_the_meta', $form_display_function ) ) { remove_action( 'tribe_events_single_event_after_the_meta', $form_display_function, 5 ); add_action( $ticket_location_action, $form_display_function, $ticket_location_priority ); } } } /* * TO MOVE THE TICKET FORM UNCOMMENT ONE OF THE FOLLOWING BY REMOVING THE // */ /* * Uncomment to Move Ticket Form Below Related Events */ //tribe_etp_move_tickets_purchase_form( 'tribe_events_single_event_after_the_meta', 20 ); /* * Uncomment to Move Ticket Form Below the Event Description */ tribe_etp_move_tickets_purchase_form( 'tribe_events_after_the_content', 5 ); /* * Uncomment to Move Ticket Form Above the Event Description */ //tribe_etp_move_tickets_purchase_form( 'tribe_events_single_event_before_the_content' );Uncommenting a second line doesn’t allow it to show in both places…
Thanks,
MattFebruary 17, 2016 at 6:43 pm #1074730Josh
ParticipantHey Matt,
That snippet should be specifically for moving the form on the single view. You can control the difference (if I’m understanding correctly) by using conditionals to wrap the statement for where you would like them to display.
So, you could use:
if( is_archive() ) {...}around the expression for the category listing and:
if( is_singular( 'tribe_events' ) ) {...}around the expression for the single event view.
Let me know if this helps.
Thanks!
February 18, 2016 at 4:27 am #1074830Matt Gray
ParticipantThis reply is private.
February 19, 2016 at 10:24 pm #1078708Josh
ParticipantHey Matt,
Unfortunately we have a strict policy against logging into client site. I’ve removed the login information for your security.
I believe using the conditionals should work, however I can do some testing here to make sure they are working as expecting here.
Thanks!
February 22, 2016 at 5:21 am #1079664Matt Gray
ParticipantOh sorry – didn’t realise.
If you could try, that’d be great please…
I’m not too au fait with creating functions, so if you could just give me a block of code to copy/paste in to my functions.php that’d be much appreciated!
Thanks v much,
MattFebruary 22, 2016 at 7:08 am #1079716Vivianne
Participant@Matt:
I need exactly the same thing!
I need a cart-form in my list-view so clients can book without going to the single-event page.
But I didn´t understood where exactly you did what.
Could you explain for me again, which code I need to change in which file?
That would be so great!February 22, 2016 at 7:11 am #1079718Vivianne
Participant@Josh:
If I use the code from here in my theme´s functions.php my page goes blank.
I work with WooCommerce – is there something special to consider?February 23, 2016 at 5:27 pm #1081140Josh
ParticipantHey Matt,
You can add the ticket form to the list view as well as move on the single view by utilizing the following snippet in your theme’s functions.php file:
https://gist.github.com/BeardedGinger/39744d77e3efb1667e74
Vivianne, if this helps you in your situation, awesome! If not, would you mind opening a new thread so we can address every issue/question directly and fully.
Thanks!
-
AuthorPosts
- The topic ‘Move Ticket Form to list view’ is closed to new replies.
