Support

Home Forums Event Espresso Premium Events Table View Template: Conditional format of "Register" button

Events Table View Template: Conditional format of "Register" button

Posted: August 15, 2016 at 10:25 am

Viewing 5 reply threads


Oguzhan Altun

August 15, 2016 at 10:25 am

Hello,

I’m using the table view template for some time now, and it works great.

What I would like to do is to add a conditional format to the “Register” button, so that it turns red when there is less than 2 places left for a given course on this page:

https://www.genevaphotoclub.com/dates-prices/

I know another site who did this with EE3 – can I do that with EE4? What kind of code would I need for that?

Thanks in advance,


Lorenzo Orlando Caum

  • Support Staff

August 15, 2016 at 12:53 pm

Hello,

We share code examples as starting points when available but we cannot write custom coding for you.

I recommend reaching out to an Event Espresso professional that can help you customize the Events Table View template to your needs:

https://eventespresso.com/developers/event-espresso-pros/


Lorenzo


Oguzhan Altun

August 15, 2016 at 1:30 pm

Hi there,

I fully understand. I just need some starting points and an opinion on how difficult this should be – so that I can contract a programmer to do it.

Thank you in advance,


Tony

  • Support Staff

August 16, 2016 at 4:46 am

The EE_Event object has a spaces_remaining_for_sale() method you can use to return a value of how many spaces are available within the event. So:

$available_spaces = $event->spaces_remaining_for_sale();

Will set $available_spaces to how many spaces there are, then you can use that within the table template in an if else statement to set color based on the value.

Note that the above method is included in core however its behavior may change in the future, this is because spaces available can be difficult to calculate depending on how your event is set up (using datetime and ticket limits) so we may need to alter how it works.


Oguzhan Altun

August 16, 2016 at 2:17 pm

Thank you for the perspective, I will forward it to a programmer.

Overall, which number do you advice me to base the code to determine the capacity?

Event Datetime / Limit
Available Tickets / Qty

Would be great if you let me know when you decide to change this and how, so that I can be ready when you’re done.


Tony

  • Support Staff

August 17, 2016 at 4:33 am

Overall, which number do you advice me to base the code to determine the capacity?

It depends on your event type, how you have your ticket pricing setup, the amount of datetimes etc. In short users want to limit the events differently depending on their needs, hence why the above method may change if we find it needs to modified to suit another use case.

Would be great if you let me know when you decide to change this and how, so that I can be ready when you’re done.

You can find a list of all changes within the change log here:

https://eventespresso.com/wiki/ee4-changelog/

Viewing 5 reply threads

The support post ‘Events Table View Template: Conditional format of "Register" button’ 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