Support

Home Forums Event Espresso Premium How to customize Archive page with filter based

How to customize Archive page with filter based

Posted: July 29, 2019 at 8:30 am

Viewing 11 reply threads


Dairywomensnetwork

July 29, 2019 at 8:30 am

I have need help to fix list pages layout like with filter, Please review below screens:
https://www.screencast.com/t/3bl5jXpDFhN

Filter : Categories, Locations, Date
OR
Tags


Tony

  • Support Staff

July 30, 2019 at 8:59 am

Hi there,

If you are using our models to pull the events into that custom listing you basically just need to feed the selection into the models.

We don’t provide support for custom coding, but can help point you in the right direction.

The documentation for the model system can be found here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

You need to set up the where conditions and pass them to the models, take a look at the examples here:

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


Dairywomensnetwork

August 13, 2019 at 3:49 am

if (!empty($search)) {
$where[‘EVT_name’] = array(‘LIKE’, $search);
}

“DWN2020 Conference” : not working when search with half word.


Dairywomensnetwork

August 13, 2019 at 3:57 am

Solved :
$where[‘EVT_name’] = array(‘LIKE’, ‘%’.$search.’%’);


Tony

  • Support Staff

August 13, 2019 at 4:14 am

Just noting that the above is correct.

If you want results based on partial-string matches you need to pass the wildcard characters in the locations you want to use them (usually the beginning and end of the search string) as you have done above.


Dairywomensnetwork

August 20, 2019 at 4:25 am

Can you help me for state-based event list filter?

$where['Venue_Meta.STA_ID'] = 81;

I have tried above this code but not working. I have check document also but there has not this logic.

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


Dairywomensnetwork

August 20, 2019 at 5:07 am

espresso_venue_id($event_id)
not wroking on event listing page. Can you help me get vanue id using event id on listing?


Josh

  • Support Staff

August 20, 2019 at 7:26 am

That should actually be something like:

EEM_Event::instance()->get_all(
    array(
        array('Venue.STA_ID'=>81)
    )
);

espresso_venue_id($event_id)
not wroking on event listing page.

Are you sure you have $event_id set?


Dairywomensnetwork

August 20, 2019 at 8:42 am

Are you sure you have $event_id set?

Yes, I have set but this function not working on an event for a loop.

I have customized but can you help me with this function.
espresso_venue_id($event_id)

my custom code after this not working form ref of admin side code. I suggest you please create well document with all king of conditions argument with filter opitons,

foreach ($events as $event):
            $evt_venues = $event->venues();
            $evt_venue = $evt_venues && is_array($evt_venues) ? reset($evt_venues) : null;
            $VNU_ID = $evt_venue instanceof EE_Venue ? $evt_venue->ID() : null;
            if(!empty($VNU_ID)):
                $venue = EEH_Venue_View::get_venue($VNU_ID);
                if(isset($venue) && !empty($venue)):
                    $state = $venue->state_obj();
                    if(is_object($state)):
                        $state_list[$state->get('STA_ID')] = $state->get('STA_name');
                    endif;
                endif;
            endif;
        endforeach;


Josh

  • Support Staff

August 20, 2019 at 8:52 am

It sounds like the trouble you’re having is because you’re trying to use functions that are only available on the frontend. Those will not work on the admin side.

You can use the model classes helper method directly, like this one, instead of “View”-based helper methods intended for the front end only. e.g.
$venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID);


Dairywomensnetwork

August 21, 2019 at 1:52 am

you have not got my point I have need value id using event id.


Tony

  • Support Staff

August 21, 2019 at 5:14 am

In the code above, your using an instance of EE_Venue to pull the ID from that EE_Venue, to then pull an instance of EE_Venue?

To explain:

$evt_venues = $event->venues();

venues() pulls an array of all venues linked to the event (an associative array with the key being the venue ID and the value being the EE_Venue object), right now the UI only allows for a single venue to be selected but it’s possible to add more, hence the array.

$evt_venue = $evt_venues && is_array($evt_venues) ? reset($evt_venues) : null;

This sets $evt_venue to be either an instanceof EE_Venue from the $evt_venues array or null.

$VNU_ID = $evt_venue instanceof EE_Venue ? $evt_venue->ID() : null;

Uses $evt_venue to pull the ID of the venue if its an instance of EE_Venue or sets it to null.

if(!empty($VNU_ID)): $venue = EEH_Venue_View::get_venue($VNU_ID);

Uses $VNU_ID you just pulled from an EE_Venue object, to pull an instance of EE_Venue that matches that VNU_ID…

This means $evt_venue and $venue will be identical and most of that code isn’t needed.

espresso_venue_id() is expected to be ran on the front end rather than the admin as it’s a template tag.

you have not got my point I have need value id using event id.

The point Josh is making is your going about this the wrong way, espresso_venue_id() isn’t expected to be used as you are trying to use it.

Why do you need only the Venue ID? I’m assuming its to pull the Venue object as there’s nothing else of value with just the VNU_ID

Is the only value you have at that point the Event ID? No EE_Event object?

You can use the EEM_Venue model to pull a specific venue object linked to an Event ID and from that you could get the ID, but I’m assuming you actually just want the Venue object, not the ID?

Viewing 11 reply threads

The support post ‘How to customize Archive page with filter based’ 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