Support

Home Forums Event Espresso Premium Sold Out not showing in events-table

Sold Out not showing in events-table

Posted: August 8, 2014 at 6:42 am

Viewing 7 reply threads


Alexander Müller

August 8, 2014 at 6:42 am

hey!

I’ve a problem with the events-table:
If a event is sold out, there’s NO “sold out” in the events-table. It shows the normal “Book now” button. On my calendar view it works.

here the button should say “sold out” but doesn’t: http://www.alexander-mueller.at/amfweb/kursliste/ (it’s the course on 5. september)

here it works like it should: http://www.alexander-mueller.at/amfweb/calendar/
(if you go to september and hover over the “workshop schönbrunn”.)

do you have a solution for my problem?

I’m currently running Event Espresso – 3.1.36.5.P Version 3.9.2 and don’t want to update because of some changes to the core files!

thanks a lot!


Lorenzo Orlando Caum

  • Support Staff

August 10, 2014 at 5:17 pm

Hi Alexander,

Please see Dean’s sample code here:

https://eventespresso.com/topic/displaying-sold-out-on-custom-table-layout/#post-39550


Lorenzo


Alexander Müller

August 11, 2014 at 3:03 am

hey!

unfortunately it’s not that easy. Firstly, I don’t have the espresso_tables.php – secondly I’ve modified my tables as you can see in the provided link. Is it maybe just the code-snippet that controls the way it interacts with the open spots, that I can paste into events-table/Index.php?

I’m a little confused 🙂

thanks!


Tony

  • Support Staff

August 11, 2014 at 3:28 am

Hi Alexander,

The Custom Template Add-on (which you are using with a customised template) already contains code to handle Sold Out events.

On the original template this would be lines 47-51

if ( ! has_filter( 'filter_hook_espresso_get_num_available_spaces' ) ){
	$open_spots		= apply_filters('filter_hook_espresso_get_num_available_spaces', $event->id); //Available in 3.1.37
}else{
	$open_spots		= get_number_of_attendees_reg_limit($event->id, 'number_available_spaces');
}

Then lines 80-86

if($open_spots < 1 && $event->allow_overflow == 'N') {
	$live_button = __('Sold Out', 'event_espresso');
	$cart_link = '';
} else if ($open_spots < 1 && $event->allow_overflow == 'Y'){
	$live_button = !empty($event->overflow_event_id) ? '< a href="'.espresso_reg_url($event->overflow_event_id).'">'.__('Join Waiting List', 'event_espresso').'' : __('Sold Out', 'event_espresso');
	$cart_link = '';
}

As you have modified your template you’ll need to see why your template is not using the code already provided to display Sold Out events.


Alexander Müller

August 11, 2014 at 3:35 am

hi tony!

I’m not using a custom template – it’s the normal espresso-table template that’s included! I’ve just modified the ‘espresso-tables/Index.php’ regarding the tableheaders and added the start and endtime of the events! take a look at http://www.alexander-mueller.at/amfweb/kursliste/ – you see the third one is sold out, but the button still says “Buchen” (“Book now” in german!).

I have exactly this code you’ve posted in this template and did not change it! As you can see in the event-calender view, if you hover on an events, it works correctly: It says “Sold out!” only in the table-view the problem happens!

br,
Alex.


Tony

  • Support Staff

August 11, 2014 at 4:33 am

On Line 47 you’ll have:

if ( ! has_filter( 'filter_hook_espresso_get_num_available_spaces' ) ){

Remove the ! from that statement.

if ( has_filter( 'filter_hook_espresso_get_num_available_spaces' ) ){

That should then work as expected.


Alexander Müller

August 11, 2014 at 4:56 am

tony, you’re the best!
thanks a lot!


Tony

  • Support Staff

August 11, 2014 at 5:45 am

No Problem 🙂

I’ll mark this thread resolved, if you have any further questions please feel free to open up another thread.

Viewing 7 reply threads

The support post ‘Sold Out not showing in events-table’ 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