This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Issue with result group by meta key

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Issue with result group by meta key

Viewing 15 posts - 31 through 45 (of 56 total)
  • Author
    Posts
  • #22275
    davidalexanderdavidalexander
    Participant

    Hi,
    Events from all venues issue is fixed by changing the settings as you mentioned. But, there is one another problem, on first load all the events are showing. However, when you then select either the Events or the Exhibitions link it pulls only one or two results for each.
    In the lotherton page https://lmg.alexandermarketing.co.uk/lotherton/whats-on/
    there are total 13 results on first load. But, in the event type search result there is only 2 results were shown. All these 13 events have either Event or Exhibition category is added.

    The All option is also not working. Please take a look on this https://lmg.alexandermarketing.co.uk/kirkstall-abbey/whats-on-at-kirkstall-abbey/. All/ Exhibition/Event are showing no result.

    #22279
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    What is the limit set under the General Options -> Limits panel? Because after the initial auto populate, that limit is used. Try changing that to the same number as you have under the auto populate panel.

    #22282
    davidalexanderdavidalexander
    Participant

    Hi,
    I have tried with that. But it’s not working. I have enabled-random results in auto populate option and changed all the limits to the same. But no any changes found.
    Also, the ALL option is not working. When we click on the all, we need to display the events as same as the first load

    #22283
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Indeed, I see what the problem is now. Since that is no longer the auto populate request, the date filter is now in effect, that is why it reduces the results count.

    #22284
    davidalexanderdavidalexander
    Participant

    Ok. Can you please disable the date filtering on the event type filtering on first time. As we done the same on first page load before. Which means, disable the date filter on page loading date filter needs to work only after we change or select the date

    #22286
    Ernest MarcinkoErnest Marcinko
    Keymaster

    That might be impossible, as there is no way to tell from the server side if the filters have changed or not, or if this is the first request from this session, that is the problem. The auto populate can be distinguished, as it sends an additional parameter, but this is more problematic.
    The only way I could resolve this, is to check if the date filter has the current date, to assume it has not been changed – but then if the user selects the current date, then it will have no effect. I am honestly not sure if there is any way around this unfortunately. Let me know if you prefer that solution.

    #22287
    davidalexanderdavidalexander
    Participant

    We have done the same for first page load before.
    You have added the following function to do the same.

    add_filter(‘asp_query_args’, ‘asp_reset_date_filter’);
    function asp_reset_date_filter($args) {
    if ( isset($_POST[‘autop’]) ) {
    foreach ( $args[‘post_meta_filter’] as $k => $v ) {
    if ( $v[‘key’] == ‘_event_start’ ) {
    unset($args[‘post_meta_filter’][$k]);
    }
    }
    }
    return $args;
    }

    Did you remember this, I am saying to do the same for event type.

    #22288
    Ernest MarcinkoErnest Marcinko
    Keymaster

    I know, I am referring to that code. But that relies on checking if it is the first request (if it is auto populate). Once the user changes the filters, it is no longer the first request, and it cannot be determined if the date filter had been changed in any way, as it already has a value either way.

    #22307
    davidalexanderdavidalexander
    Participant

    Hi, I need to change the date format in events display.
    There is a settings to change date formats, date display styles etc on events manager plugin itself. We need to do the same format in this result.

    The events are still showing ‘seconds’ in the times, also different formats on some, See, https://lmg.alexandermarketing.co.uk/whats-on/
    Time is still showing as HH:MM:SS and events that are just one day still have the same date repeated as beginning + ending rather than just the one date.

    Time should be 12 hr and use am and pm

    When you load the What’s On page it is showing random dates

    #22312
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    By default that follows the wordpress date formatting, however it is possible to specify a custom date format as well. It is still an experimental feature, but it might work. Try changing the advanced description field, by adding the date_format argument, like so:

    <p class="event-date">{_event_start_date date_format="d/m/Y"} - {_event_end_date date_format="d/m/Y"} - {_event_start_time date_format="g:i a"} - {_event_end_time date_format="g:i a"}</p>
    <p class="event-desc">{descriptionfield}</p>

    I have taken this from the events calendar configuration, so I think this should be correct.

    #22314
    davidalexanderdavidalexander
    Participant

    Date format is changed. but it’s only worked for single events. It’s not working for repeating events. Please do check https://lmg.alexandermarketing.co.uk/whats-on/.

    Also what about the duplicate date issue. If the start and end date is same, we need to show only a single date.

    #22328
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    In that case using a custom code would be better, as there is no way of adding conditional tags within those fields. It should not be too complicated though. I see you have a solution incorporated directly within the plugin files already. Let me know if you prefer a different solution.

    #22330
    davidalexanderdavidalexander
    Participant

    Is there any different solution, otherwise this is fine.

    Also, on this page https://lmg.alexandermarketing.co.uk/whats-on/, here we are listing events from all venues. We have added the ordering as event_start ascending. but it’s not working fine. It’s working for all other pages.

    Also, events that have passed are still showing. Is there a way to only show events that are either today or in the future? For exampleon https://lmg.alexandermarketing.co.uk/abbey-house-museum/whats-on-abbey-house-museum/ there are plenty of events that have already been on.

    #22341
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Sure.

    1. First restore the original plugin code of the results file.
    2. Then simply use this as the advanced description field (restore to default):

    {descriptionfield}

    3. Plus use this custom code in the theme/child theme functions.php file:

    add_filter('asp_results', 'asp_show_dates_in_res', 10, 1);
    function asp_show_dates_in_res($results) {
      foreach ( $results as $k=>&$r ) {
          // Get the dates
    			$event_date_from = date('F d, Y', strtotime(get_post_meta( $r->id, '_event_start_date', true)) );
    			$event_date_to = date('F d, Y', strtotime(get_post_meta( $r->id, '_event_end_date', true)) );
    			$event_time_from = date('g:i a', strtotime(get_post_meta( $r->id, '_event_start_time', true)) );
    			$event_time_to = date('g:i a', strtotime(get_post_meta( $r->id, '_event_end_time', true)) );
          
          // Date part
    			if ($event_date_from == $event_date_to) {
    				$add = '<p class="event-date">' . $event_date_from . '</p>';
    			} else { 
    				$add = '<p class="event-date">' . $event_date_from.' - '.$event_date_to . '</p>';
    			}
          
    			if ($event_time_from == $event_time_to) {
    				$add .= '<p class="event-date">' . $event_time_from . '</p>';
    			} else if($event_time_from == '12:00 am' && $event_time_to == '11:59 pm') {
    				$add .= '<p class="event-date">' . 'All day' . '</p>';
    			} else { 
    				$add .= '<p class="event-date">' .  $event_time_from.' - '.$event_time_to . '</p>';
    			}
    
    			$add .= '<p class="event-desc">' . $r->content .'</p>';
          
          $r->content = $add;
      }
      
      return $results;
    }

    That’s it, this will work with future updates as well.

    #22344
    davidalexanderdavidalexander
    Participant

    Ok Thanks.
    What about this,
    on this page https://lmg.alexandermarketing.co.uk/whats-on/, here we are listing events from all venues. We have added the ordering as event_start ascending. but it’s not working fine. It’s working for all other pages.

    Also, events that have passed are still showing. Is there a way to only show events that are either today or in the future? For exampleon https://lmg.alexandermarketing.co.uk/abbey-house-museum/whats-on-abbey-house-museum/ there are plenty of events that have already been on.

Viewing 15 posts - 31 through 45 (of 56 total)
  • You must be logged in to reply to this topic.