Pagination and if statement not working
Hello,
I cannot get the pagination working when using the calendar:method="events" parameter; however, when I remove it, it works just fine, but then my event_start_date and event_end_date tags do not render properly.
Another issue I have is that the if statement for if a date range is is identical to display only one date and if not display the range does not work. It works fine when using the regular Solspace Calendar plugin. Do you have any idea why this might be happening? The code I am using for the results to display is below:
{exp:low_search:results
query="{segment_2}"
calendar:method="events"
keywords:lang="en"
collection="col_events"
paginate="both"
orderby="event_start_date"
limit="1"
}
{if count == 1}
You searched for {low_search_keywords}.
Search results: {absolute_results}
{/if}
{if event_thumbnail_img}
{/if}
{if {event_start_date} == {event_end_date}}
{event_start_date format="%M %j, %Y"}
{if:else}
{event_start_date format="%M %j, %Y"}—{event_end_date format="%M %j, %Y"}
{/if}
{title}
{event_short_summary}
{paginate}
Page {current_page} of {total_pages} pages {pagination_links}
{/paginate}
{if low_search_no_results}
No results for “{low_search_keywords}.”
{exp:low_search:suggestions keywords="{low_search_keywords}" keywords:lang="en" limit="2"}
{if suggestion_count == 1}Did you mean{/if}
{suggestion}{if suggestion_count != total_suggestions} or {if:else}?{/if}
{if no_suggestions}Check your spelling or try a different search term.{/if}
{/exp:low_search:suggestions}
{/if}
{/exp:low_search:results}
Thank you in advance for your help.
Kind regards,
Jess
Replies
Low 6 May 2015 15:45
Does pagination work when using event_limit="1" rather than limit="1"?
Also, can you try the conditional {if event_start_date == event_end_date} rather than {if {event_start_date} == {event_end_date}}?
Jess 22 May 2015 21:24
Hello, thanks so much for your help :-)
The event_limit worked for the pagination issue, but unfortunately removing the extra brackets did not work for the date range issue. I am still getting a same-date range in the results. For example: Nov 13, 2015-Nov 13, 2015.
If you have any other ideas as to what could be causing it, please let me know.
Kind regards,
Jess
Low 23 May 2015 08:20
If, instead of the low_search:results, you use the calendar:events tag, does the conditional work then?
Jess 27 May 2015 18:10
Hello, replacing the low_search:results with the calendar:events tag breaks the search and tags I have like low_search_keywords are not pulled in, I assume because the calendar:events tag doesn't recognize them?
I also tried to wrap the chunk of code where the range is referenced with a exp:calendar:events tag, within the low_search:results tag and it looks like it breaks the loop. I am getting the same event multiple times.
If you have any other ideas, please let me know :-)
Jess 27 May 2015 18:58
Hello again, Low,
One thing to add to my last post - I just noticed that I might need to use the Low Event fieldtype for my if statement to work, but I do not see an option for that fieldtype in my database (please see attached image). Should I be getting an option to select Low Events as a fieldtype in my channel field settings?
Jess 30 Jul 2015 19:02
Hello, I fixed this issue by formatting the date in the if statement like this:
{if '{event_start_date format="%Y%m%d"}' == '{event_end_date format="%Y%m%d"}'}