Support

Home Forums Event Espresso Premium Show Sold Out tickets in listing

Show Sold Out tickets in listing

Posted: July 2, 2020 at 6:50 pm


mobile kino 2

July 2, 2020 at 6:50 pm

Hello,

We have created a custom template to show the available events, and to not show the expired events, successfully.

We now have the issue that the sold out events are not being listed on the template.

Here is our code:


// set up show expired = false
$where = array(
'Datetime.DTT_EVT_end' => array( '>=', current_time( 'mysql' )),
'status' => 'publish',
);

// run the query
if ( class_exists( 'EE_Registry' ) ) :
$events = EE_Registry::instance()->load_model( 'Event' )->get_all( array(
$where,
'limit' => 100,
'order_by' => 'Datetime.DTT_EVT_start',
'order' => 'ASC',
'group_by' => 'EVT_ID'
));

I understand that because the status is “published”, it won’t show the sold out tickets, however – I can’t seem to find around your documentation as it not very simple to look into it.

If you could please help me, with my query code. Just need changing it so that we an also list the sold out events too. (But not the expired ones)

Thank you


Tony

  • Support Staff

July 3, 2020 at 9:29 am

Hi there,

You just need to change the status param to include both the ‘publish’ and ‘sold_out’ status, so change:

'status' => 'publish',

To

'status' => array('IN', array('publish', EEM_Event::sold_out)),

You can find some details on using IN (and other operators) within where_params here:

https://github.com/eventespresso/event-espresso-core/blob/master/docs/G–Model-System/model-query-params.md#different-operators

You must be logged in to reply to this support post. Sign In or Register for an Account

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: publish

Updated by  Tony 1 month, 1 week ago ago

Topic Tags

Tagged: 

Notifications

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