Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Issue with result group by meta key
- This topic has 55 replies, 2 voices, and was last updated 7 years ago by
Ernest Marcinko.
-
AuthorPosts
-
April 24, 2019 at 7:21 am #22275
davidalexander
ParticipantHi,
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.
-
This reply was modified 7 years, 1 month ago by
davidalexander.
April 24, 2019 at 8:26 am #22279Ernest Marcinko
KeymasterHi,
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.
April 24, 2019 at 9:46 am #22282davidalexander
ParticipantHi,
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 loadApril 24, 2019 at 9:55 am #22283Ernest Marcinko
KeymasterHi,
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.
April 24, 2019 at 10:07 am #22284davidalexander
ParticipantOk. 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
April 24, 2019 at 10:12 am #22286Ernest Marcinko
KeymasterThat 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.April 24, 2019 at 10:29 am #22287davidalexander
ParticipantWe 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.
April 24, 2019 at 10:32 am #22288Ernest Marcinko
KeymasterI 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.
April 25, 2019 at 5:57 am #22307davidalexander
ParticipantHi, 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
April 25, 2019 at 12:50 pm #22312Ernest Marcinko
KeymasterHi,
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.
April 25, 2019 at 1:22 pm #22314davidalexander
ParticipantDate 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.
-
This reply was modified 7 years, 1 month ago by
davidalexander.
April 26, 2019 at 8:04 am #22328Ernest Marcinko
KeymasterHi,
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.
April 26, 2019 at 8:06 am #22330davidalexander
ParticipantIs 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.
-
This reply was modified 7 years, 1 month ago by
davidalexander.
-
This reply was modified 7 years, 1 month ago by
davidalexander.
-
This reply was modified 7 years, 1 month ago by
davidalexander.
-
This reply was modified 7 years, 1 month ago by
davidalexander.
April 26, 2019 at 2:17 pm #22341Ernest Marcinko
KeymasterSure.
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.
April 27, 2019 at 5:53 am #22344davidalexander
ParticipantOk 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.
-
This reply was modified 7 years, 1 month ago by
davidalexander.
-
This reply was modified 7 years, 1 month ago by
-
AuthorPosts
- You must be logged in to reply to this topic.