Support

Home Forums Event Espresso Premium Event times sold out – display sold out?

Event times sold out – display sold out?

Posted: January 16, 2013 at 10:33 am


Jess Nunez

January 16, 2013 at 10:33 am

We’ve noticed that when an event time slot is sold out ($reg_limit), it’s removed from the drop down menu as an option. We’re wondering if perhaps instead it could remain but read “Sold Out”. Possible?

Oh and thank you for such a great plugin!


Garth

  • Support Staff

January 16, 2013 at 12:48 pm

Hi Jess,

How are you today?

That’s a good little suggestion. The challenge will be to code this so that it does both (based on the preference of the user).

Also, how would you like the drop-down to display, e.g.”Date – Sold Out”?


Jess Nunez

January 16, 2013 at 1:19 pm

Hi Garth! I’m having a great day, thanks! Right, so at the moment the drop down displays the time and the number of available tickets. It would be great if when the tickets are gone it would instead display the time and “sold out”, as you said above.

I’m comfortable with editing the plugin code, and I would have tinkered with it already except my concern is if I leave the time as an option in the drop down (even though it’s sold out) I’m not sure if users would at that point still be able to purchase them.

It may be more involved than I’d hoped. I was hoping there was just a spot that checks for the $reg_limit and shows/hides the option, that I could tweak.


Josh

  • Support Staff

January 16, 2013 at 3:30 pm

Hi Jess,

You mention a drop down. Are you using one of the custom files add-on dropdown templates or something else? I can take a look at the code if I know what you are working with.


Jess Nunez

January 16, 2013 at 4:22 pm

When I create an event, I’m adding additional event times with a limit to the number of attendees – the “drop down” is being created on the registration page for users to choose from. I believe EE is doing it automatically as part of the default functionality


Josh

  • Support Staff

January 16, 2013 at 5:07 pm

Hi Jess, Thanks, I wasn’t exactly sure which dropdown we were talking about. The code that makes this happen is in /includes/functions/time_date.php starting on line 221. It’s fairly well commented there on what it’s doing on lines 225 and 226. The thing is, this is a selector box, so if that code were changed to simply make the unavailable times to display along with available times, all of them would be selectable. Newer browsers do support “disabled” options though. What’s cool about the disabled option is it can’t be selected and the browser (if supported) will gray out that option. So I’d imagine that someone could add something like:

<option value="time" disabled="disabled">Times-Sold Out</option>

Which would look like something like this in the plugin’s time dropdown function :

if ($time->available_spaces > 0){
                            $html .= 'id . '">' . event_date_display($time->start_time, get_option('time_format')) . ' - ' . event_date_display($time->end_time, get_option('time_format')) . " ($time->available_spaces " . __('available spaces', 'event_espresso') . ")" . '';}
                            else{
                             $html .= 'id . '" disabled="disabled">' . event_date_display($time->start_time, get_option('time_format')) . ' - ' . event_date_display($time->end_time, get_option('time_format')) . " ($time->available_spaces " . __('available spaces', 'event_espresso') . ")" . ' Sold Out';   
                            }

Does that help?


Josh

  • Support Staff

January 16, 2013 at 5:15 pm

ergh, I’ll try that posting that code in a gist:


Jess Nunez

January 16, 2013 at 5:58 pm

Yes!! That totally did it – you’re awesome. Thank you so much for the suggestions and detailed help!

The support post ‘Event times sold out – display sold out?’ 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