All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Pagination and if statement not working

Jess 5 May 2015 21:05 question, complete

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}

{title}

{/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

  1. 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}}?

  2. 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

  3. Low 23 May 2015 08:20

    If, instead of the low_search:results, you use the calendar:events tag, does the conditional work then?

  4. 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 :-)

    Low 27 May 2015 19:04

    Correct, it would break the {low_search_...} vars, but you can see if the conditional itself works or not, as that would be parsed by the calendar:events tags. If if the conditional doesn't parse in the native calendar:events tag, it won't either in the low_search:results tag. That could be an indication that you might need to change your approach.

    Jess 27 May 2015 19:13

    Oh, I see, yes, I have this working on my home page, where the search is not involved and it works just fine. Here is a piece of my code for that:

    {exp:calendar:cal
    category="110"
    date_range_start="today"
    date_range_end="12 months"
    orderby="event_start_date"
    event_limit="8"}

    {if event_thumbnail_img}

    {title}

    {/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 calendar_no_results}
    There are no events.

    {/if}

    {/exp:calendar:cal}

    Low 27 May 2015 19:29

    I'll need to take a look myself. Please send SuperAdmin login credentials to hi at gotolow dot com if you can.

    Jess 27 May 2015 19:57

    Hi, Low! I've just been working locally now, so will need to get it up on our testing server. Will let you know when that is up and running.

  5. 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?

    Low 27 May 2015 19:05

    Low Events is a different premium add-on which you would normally use as an alternative to Solspace Calendar. My guess is you haven't got Low Events installed, right?

    Jess 27 May 2015 19:10

    Ah, yes, I have low calendar, not low events - sorry, about that!

    Low 27 May 2015 19:12

    Solspace Calendar, even. :)

    Jess 27 May 2015 19:21

    Sorry, I meant I purchased "low search", not "low events". I guess I am getting confused. Thanks for all of your help and time!

  6. 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"}'}