Support

Home Forums Event Espresso Premium EVENT_SEARCH Error

EVENT_SEARCH Error

Posted: April 14, 2013 at 6:14 pm

Viewing 13 reply threads


Eric Quan

April 14, 2013 at 6:14 pm

I am currently using EE 3.1.31.1P and WP 3.5.1. I am using the event search short and when i type in a name of a event and the event doesn’t exist and click search I get an error on the result page rather than the usual “No events available…”. However when i just click search and I leave the textbox blank it gives me no errors and just tells me no events available.

Here is the error that pops-up

[code] Warning: array_slice() expects parameter 1 to be array, null given in/home/vhosts/domain/public_html/wp-content/plugins/event-espresso/templates/event_list.php on line 193

No events available…
Warning: Invalid argument supplied for foreach() in/home/vhosts/domain/public_html/wp-content/plugins/event-espresso/templates/event_list.php on line 269[/code]


Dean

April 15, 2013 at 2:36 am

Hi Eric,

Thank you for bringing this to our attention I will get a ticket raised to look into it as that error should not come up.


Tracy Rice

April 19, 2013 at 2:36 pm

Any update on this error at all?  I am getting the same behavior.


Dean

April 22, 2013 at 2:04 am

Hello,

No updates as yet, this is still in the development ticket system awaiting being looked at. Once resolved we will post an update here.


Tracy Rice

April 23, 2013 at 1:10 pm

Any ETA about this fix?  We are launching a new site with EE on Friday and would love to have the search working at the time.


Chris Reynolds

  • Support Staff

April 24, 2013 at 10:58 am

Hi Tracy —

I just took a look at this and committed a fix for testing. If what I committed works, it will be in the 3.1.33 release, but I can post the change in this thread if you wanted to make the change before that version is available.


Tracy Rice

April 24, 2013 at 1:28 pm

Yes, please do.  I’m extremely comfortable poking around plugin files…even attempted a fix myself, but couldn’t quite get 100% there.    🙂


Chris Reynolds

  • Support Staff

April 24, 2013 at 2:15 pm

I will let you know after it gets tested, which should be tonight. I don’t want to post code that’s going to break stuff 🙂


Chris Reynolds

  • Support Staff

April 26, 2013 at 1:01 pm

Hi Tracy —

Here’s the fix. It’s a really simple check to see if $events exists before displaying the results. It’s been tested by our support team and it seems to work with no ill effects, so it will be added to 3.1.33, but you can add this to your code now. The affected file is event_list.php so you can just copy event_list.php and event_list_display.php to your /uploads/espresso/templates directory and then remove those files when we release 3.1.33.

Here’s the fix:

Line 193 in event_list.php, change:

$events                    = array_slice($events,$offset,$events_per_page);

to:

if ( $events ) {
	$events                    = array_slice($events,$offset,$events_per_page);
}

Then, for the next one, right before this, on line 269:

foreach ($events as $event) {

…add the check:

if ( $events ) {
	foreach ($events as $event) {

…and don’t forget to close the bracket at the end:

     }
echo "</div>";
echo "</div>";
if ( isset( $espresso_paginate ) ) {


Tracy Rice

April 26, 2013 at 2:10 pm

Ah, this does work…but now I get “No events available…” even though there are (since they popup as the user types).  Is this just a temp fix?


Tracy Rice

May 1, 2013 at 2:24 pm

Bump…any news?


Chris Reynolds

  • Support Staff

May 1, 2013 at 4:31 pm

Can you post a link to your site so I can see what you’re talking about? This was tested and confirmed to be working and has been added to Event Espresso 3.1.33.


Tracy Rice

May 3, 2013 at 4:23 pm

Sure!  It’s here:

http://www.bravooutings.com/home/


Chris Reynolds

  • Support Staff

May 3, 2013 at 5:33 pm

I don’t see the error on your page. The search uses the terms you type to bring up suggestions based on the event title. Those suggestions link to the event.

The “No events available” message is a different issue, one that got overlooked when we were dealing with the array_slice error. I’ve created a new ticket to deal with the lack of search results.

Viewing 13 reply threads

The support post ‘EVENT_SEARCH Error’ 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