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

This topic contains 55 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 2 years, 12 months ago.

Viewing 15 posts - 16 through 30 (of 56 total)
  • Author
    Posts
  • #22027
    davidalexander
    davidalexander
    Participant

    Perfect. It’s working fine. Only one thing, if we select a date like 10/05/1019 in the search settings option, we will get only the events which event start date equal to the date. But we need to show the events, which starts on 05/05/2019 and ends in 12/10/2019. Because the event is in between 05/05/2019 and 12/10/2019.

    #22032
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Make sure, that the filter is set to the correct criteria (after the date): https://i.imgur.com/dAuBCMq.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #22033
    davidalexander
    davidalexander
    Participant

    Hi,
    But it’s not working as we needed. If we set this as after date, suppose the user searched for events after 10/05/1019, they will not find the vent start in 05/05/2019 and ends in 12/10/2019.

    #22034
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Of course not, because events starting after 10/05/1019 does not include events starting at 05/05/1019, because that starts before that date, and not after. The matching date does not compare between two dates, it matches the selected custom field for that date.
    Maybe a filter on event ending date would be better for you – events ending before the selected date, that includes the currently running events, as well as events that start later, but end before the selected date.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #22039
    davidalexander
    davidalexander
    Participant

    Can you customise the code to get the events in the searching date if the date is in between the start and ed date of events. Can you change the date search query in plugin’s file

    #22044
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Sure, it was possible with minor changes. I have changed one of the functions within the child theme directory, plase keep it there:

    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]);
          }
        }
      } else {
        $val = '';
        foreach ( $args['post_meta_filter'] as $k => $v ) {
          if ( $v['key'] == '_event_start' ) {
            $val = $args['post_meta_filter'][$k]['value'];
          }
        }
        $val1 = date('Y-m-d', strtotime($val) - 24 * 60 * 60);
        $val2 = date('Y-m-d', strtotime($val) + 24 * 60 * 60);
        $args['post_meta_filter'] = array(
          array(
            'key' => '_event_start',
            'value' => $val2,
            'operator' => 'datetime <'
          ),
          array(
            'key' => '_event_end',
            'value' => $val1,
            'operator' => 'datetime >'
          )
        );
      }
      return $args;
    }
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #22055
    davidalexander
    davidalexander
    Participant

    Great thanks Ernest. It’s working perfect.

    #22241
    davidalexander
    davidalexander
    Participant

    Hi,
    I have added load more results option in ajax result. And set up the limit as 6. But, by default when the page loads it shows only one event, and when we click on the load more option it will show next 6 events etc. I need to show first 6 events by default.

    #22242
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    It is because of the removed duplicates. The only possible solution here is to increase the limit, and hope that less duplicates remain. Because the duplicates must be removed after the search process, the results number can be different from the limit set.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #22245
    davidalexander
    davidalexander
    Participant

    Perfect. Thanks.
    One more question, I have added a meta field event type for all events. And I have added this meta value for filtering.
    When it first loads it loads events for the particular category (another meta field) you are on. If you then do a search or filter (even by event or exhibitions ( event type)) the results are from all categories. Could you take a look pls. Thanks
    https://lmg.alexandermarketing.co.uk/lotherton/whats-on/

    #22247
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Maybe those are items that does not have categories assigned. Try turning off this option: https://i.imgur.com/Q5X3WGv.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #22260
    davidalexander
    davidalexander
    Participant

    Hi,
    It’s not working yet. I have checked with the way you mentioned.
    https://lmg.alexandermarketing.co.uk/lotherton/whats-on/

    All the events have event category and event type. I need to sort out events under a category with the type( event or exhibition). Can you please check once again.

    Could you please customise the plugin code for me.

    #22267
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Maybe I am missunderstanding the problem, I have tried a few tests, but I am getting the correct results I think. Selecting the ‘Exhibitions’ gives me only 10 results, which seems to be correct, as on the back-end there are 10 events associated with the category ‘Exhibitions’. I am not seeing those results when selecting ‘Events’, so it seems to be okay. (?)

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #22268
    davidalexander
    davidalexander
    Participant

    Hi,

    If we look at https://lmg.alexandermarketing.co.uk/lotherton/whats-on/ as the example.

    When the page first loads it loads only Events and Exhibitions relating to the Venue ‘Lotherton’
    However, when you then select either the Events or the Exhibitions link it pulls back results for all other venues and not just those for Lotherton.

    So when I click Events from this page I should only see ‘Lotherton’ events. Same for ‘Exhibitions.

    Thanks

    #22269
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Okay, I see the issue now. I think the problem is caused by using the filter (checkbox) that is invisible, instead of an inclusion option. Instead of the current configuration, try something like this:
    – Turn off the checkbox, as it is not needed: https://i.imgur.com/pfNZkaI.png
    – Use the category inclusion option: https://i.imgur.com/EI7WLa7.png
    That should restrict them correctly.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 15 posts - 16 through 30 (of 56 total)

You must be logged in to reply to this topic.