Support

Home Forums Event Espresso Premium modify EED_Ticket_Selector.module.php for events that are sold out

modify EED_Ticket_Selector.module.php for events that are sold out

Posted: February 6, 2017 at 2:07 am

Viewing 3 reply threads


adasch

February 6, 2017 at 2:07 am

Hi there,
I recently updated to the lastes version of EE4. It seems there are a lot of changes concerning the ticket selector.

I modified the EED_Ticket_Selector.module.php, knowing that this was not update safe. Now I have some trouble.

Ok, what I wanted to do:
When an event is sold out, the “regiser now” button is replaced with a “show details” button. I wanted to replace this “destails” butten with a “sold out” label (not a button!).

In my previous version of EE4 I modified EED_Ticket_Selector.module.php:
I commented out line 291
//&& $_event_active_status != EE_Datetime::sold_out
And I replaced line 299

//return ! is_single() ? EED_Ticket_Selector::display_view_details_btn( self::$_event ) : '';
return ! is_single() ? '<span class="label-soldout">Kurs ist ausgebucht</span>' : '';

Everything was fine.

Now, with 4.9.29p I couldn’t find these line in EED_Ticket_Selector.module.php. It seems you guys changed a lot in that area.

Can you help me to find these lines again OR show me a better (and update safe) way to achieve what I’m trying to do?

Thant would be great!
Thanks a lot.
Andy


Josh

  • Support Staff

February 8, 2017 at 11:16 am

Hi Andy,

The safe way to achieve avoids modifying core plugin files. Instead, you make use of the available hooks and put your custom code into a functions plugin.

Along with that, I recommend to not change the html for the button. Changing the text is fine and won’t break things, and you can even conditionally load in some styles to make the button look less button-like and more label-like.

So you can add this code to your plugin:

then you add some CSS like this to your custom stylesheet:

.status-sold_out .view-details-btn {
 background-color: #FCB93C;
 color: #fff;
 border: 0;
 padding:.5em 1.5em .5em;
 text-shadow: 0 -1px 0  rgba(0,0,0,0.25);
}


adasch

February 9, 2017 at 6:17 am

Hi josh,
thanks a lot. This works.

Except one little thing: although I can add some CSS code to make it look less than button, it still IS a button. Which means I still can click it.
I’d like to have just a label “sold out” whith no possibility to click on.


Josh

  • Support Staff

February 9, 2017 at 8:29 am

OK, you can add another little function will disable the input when the event is sold out:

https://gist.github.com/joshfeck/5ae6ccfa208ac384fe8d4d80039be8a5#file-disable_view_details_button_when_sold_out-php

Viewing 3 reply threads

The support post ‘modify EED_Ticket_Selector.module.php for events that are 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