Support

Home Forums Event Espresso Premium Hide Sold Out Events from Table

Hide Sold Out Events from Table

Posted: March 23, 2016 at 4:04 pm


Dianna

March 23, 2016 at 4:04 pm

I wanted to add a price column to my table – which I was able to do when I added it to espresso-events-table-template.template.php. However, I noticed that the ones with Sold Out on the actual page went from saying “$2,250” to “FREE”. How do I hide the sold out events from my table? Or, can I keep the sold out classes that I have from changing to free?


Tony

  • Support Staff

March 24, 2016 at 5:26 am

Hi Dianna,

Did you follow a tutorial to add the price column to the table? If so can you post the link to tutorial used please?

If you copy the contents of your espresso-events-table-template.template.php, add it to http://pastebin.com/ and post the url for that paste here we can take a look.

I don’t know how you are pulling in the price for the event currently so I’m not sure how to fix it 🙂


Dianna

March 24, 2016 at 8:25 am

This is the tutorial I followed:
https://gist.github.com/lorenzocaum/ef6afefd07c9c5f6f681

I added everything step by step in my template file. However, I had to do what ErinK (mentioned in the comments) as I didn’t see the code listed in step 8.

Here is what I have: http://pastebin.com/jttzXrTW


Tony

  • Support Staff

March 24, 2016 at 12:25 pm

Hi Dianna,

So the problem with that template is that it is using a function to call the ‘available’ tickets but doesn’t take into consideration sold out events (the function then return no tickets which in that example is the same as free events)

A quick fix for the time being is to swap out line 129 from this:

<td class="starting_from_pricing event-<?php echo $post->ID; ?>"><?php echo $tickets_price_free_check; ?></td>

To this:

<td class="starting_from_pricing event-<?php echo $post->ID; ?>"><?php if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) { echo 'N/A'; } else { echo $tickets_price_free_check; } ?></td>

Which just checks if the event is sold out and echo’s ‘N/A’ if so, if not use the same as it does now. (You can change ‘N/A’ if you prefer)


Dianna

March 24, 2016 at 3:04 pm

Thanks so much! Everything looks good.


Tony

  • Support Staff

March 29, 2016 at 3:13 am

Hi Dianna,

I just wanted to let you know I provided Lorenzo with some code to fix this, it’s a little different from the above but the end result is the same.

He’s now updated the gist to include that code if you would like to update to that version (its not essential but just keeps you up to date with the latest template):

https://gist.github.com/lorenzocaum/ef6afefd07c9c5f6f681

The support post ‘Hide Sold Out Events from 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 3 years, 8 months ago ago

Topic Tags

Notifications

This topic is: resolved
Do NOT follow this link or you will be banned from the site!