Support

Home Forums Event Espresso Premium EE4 – Event Table View – Adding Sold Out in place of Register

EE4 – Event Table View – Adding Sold Out in place of Register

Posted: September 7, 2014 at 9:42 pm


Troy Degenhardt

September 7, 2014 at 9:42 pm

Hello

I have been using EE4 Table View add-on and wish to have the ‘Register’ replaced with ‘Sold Out’ when the available spaces = 0.

Is there an easy way to complete this?

http://www.mediateaustralia.com.au/upcoming-events/


Tony

  • Support Staff

September 8, 2014 at 2:40 pm

Hi Troy,

To do this you’ll need to modify the Event Table Template.

Which template are you using within the Event Table? If you are unsure, just post the full shortcode you are using.


Troy Degenhardt

September 8, 2014 at 5:32 pm

Thanks Tony – the shortcode is [ESPRESSO_EVENTS_TABLE_TEMPLATE template_file = espresso-events-table-template-toggle.template.php].


Dean

September 9, 2014 at 2:26 am

Hi,

Perhaps Tony knows a better way to do this, but one way would be to edit the /wp-content/plugins/ee4-events-table-template/templates/espresso-events-table-template-toggle.template.php file and just above where it says

//Create the register now button
		$live_button 		= 'ID.'" href="'.$registration_url.'">'.$button_text.'';

add

if( $post->DTT_sold == $post->DTT_reg_limit) {
	$live_button = 'ID.'" href="'.$registration_url.'">Sold Out';;
}

Now this has limitations: it will only work for an event with a single datetime (it works via the primary datetime, so if a second ticket expires it wont be marked as sold out).

Also, updates to the addon will over write these changes.


Tony

  • Support Staff

September 9, 2014 at 3:10 am

Mine’s slightly different.

Same file Dean mentioned: /wp-content/plugins/ee4-events-table-template/templates/espresso-events-table-template-toggle.template.php

(you can add the same code to the other template if you want to use it within that too)

On line 10 add:

$sold_out_button_text	= !isset($sold_out_button_text) ? __('Sold Out', 'event_espresso') : $sold_out_button_text;//for sold out events

It will look like this – http://take.ms/5t2t3

Then after line 93 add this:

if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {
	$live_button	= 'ID.'" class="a_register_link_sold_out" href="'.$registration_url.'">'.$sold_out_button_text.'';
}

Which will look something like this – http://take.ms/KWQqE

Sold out events will show ‘Sold Out’ by default.

You can add sold_out_button_text=”No more tickets” to the shortcode to use custom text for the Sold out events.

You can also style the link using something like:

.a_register_link_sold_out {
color: red;
}

This should also work with multiple datetimes but is currently under testing, if it works well it will be included within the next update to the events table template.

The support post ‘EE4 – Event Table View – Adding Sold Out in place of Register’ 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