Support

Home Forums Event Espresso Premium simplified ticket selector template

simplified ticket selector template

Posted: April 10, 2019 at 4:51 am


lhammond

April 10, 2019 at 4:51 am

I am looking at the sample custom ticket selector template found here as an example of how I can change the output of the inside of each row for my ticket selector, but this is excessively complicated for my needs, and I am getting confused about which aspects are actually needed to add an event to the MER cart.

Can you tell me how I could display a simplified version of the ticket selector for my multi-event listing page that just shows a drop down to select the number of tickets, and an Add button? Each of our events only offers one kind of ticket for one datetime, so we can safely just select the first ticket for each event.

I have gotten pretty close using CSS to hide some parts of the default ticket selector, but I still can’t get it to display as I want it to, because the form elements are creating extra space, and the Add button is showing below the drop-down instead of next to it. Also, for the events that are sold out, the Sign Up for the Waitlist button has huge spaces around it (also because of the form and hidden elements, I think), and I don’t know how to change the text on that button, either.

Also, if I make a custom template for my ticket selector, is that the same selector that gets used in the shopping cart? Is there a way to specific different templates of the ticket selector for use on different pages?


Tony

  • Support Staff

April 12, 2019 at 11:33 am

Hi there,

There’s a lot of logic within the ticket selector and if you get any of it wrong it will break the ticket selector in various different situations so I’d advise against customizing the output using your own template.

The template you’ve linked to is over 3 years old and may not work with the latest changes within EE (which is another reason I’d advise against your own template, you’ll need to monitor any changes to core and apply them to your templates).

I’d recommend taking a look at the method used to process the ticket selector submit within \event-espresso-core-reg\modules\ticket_selector\ProcessTicketSelector.php

Work through the processTicketSelections method and it will give you all of the details required by that function to process the ticket submission.

You can then either customize the templates to suit, keeping the required data (I don’t recommend this), or create your own form to submit the required data and structure that however you prefer.

Then just override the espresso_load_ticket_selector() function and call your custom function to output the custom ticket selector and you’ll have a customized output that you have much more control over.

Also, if I make a custom template for my ticket selector, is that the same selector that gets used in the shopping cart?

As far as I’m aware, there is no ticket selector on the shopping cart?

If you mean the Qty fields for each ticket then no, it does not use the ticket selector and would need to be changed separately.


lhammond

April 18, 2019 at 3:08 am

Thanks, I will go take a look at that code.

However, one super helpful change to the core code would be to make the ticket selector output it’s display using div tags that are easier to format with CSS, instead of tables. Because I am stuck with tables, I can’t customize the output without essentially modifying or overriding core code, which I am trying to get away from (we already had to do that in EE3 and I really don’t want to have to do that as we transition to EE4!). Could you put that on a feature request list, please?

Alternately, do you know of any way in CSS to remove the table, tr and td tags but leave the content?


Tony

  • Support Staff

April 18, 2019 at 2:28 pm

May I ask why changing the output to div’s would make this easier to style?

We would have to apply similar styles to divs to output the ticket selector the way we do currently, so if you wanted to then style those, you’d need to remove all of the styles applied to those divs anyway, which you can do with tables.

For example: table, tr, thead, tbody {display:block}; td {display:inline};

Sets tables to display as blocks (like Divs) and td’s inline (like spans).

Alternately, do you know of any way in CSS to remove the table, tr and td tags but leave the content?

Remove the tags themselves with CSS? No. You can style them, but not remove them.

The support post ‘simplified ticket selector template’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 2 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!