0

I have two different types of events that show up on the same template. If the event is a multi-day event, I classify it as such using a category. If it is a single day event, it is classified as another event.

I am running into issues trying to get a section that I have added for future events to work. According to the Solspace website, I can use the {exp:calendar:occurrences} tag to make this happen, & it works great for one group, but not the other.

I have my main /calendar template where I have two sets of codes set up.

<!-- Multi Day Events -->
{if category =="124"}
{embed="/site/calendar_multi"}
{/if}
<!-- End Multi Day Events-->

<!-- Single Day Events-->
{if category !="124"}
{embed="/site/calendar_single"}
{/if}
<!-- End Single Day Events-->

The /site/calendar_single looks like this:

    {exp:calendar:events
            orderby="title"
            sort="asc"
            event_id="{segment_3}"
            category="54"
            limit="1"
            dynamic="off"}

    <div class="typography">
    <div class="title_entryBIGG" style="width:98%;margin-top:10px:">
        <br/>
        <br/>

    <a href="/calendar_download/event/{segment_3}" target="_blank" class="btn btn-default btn-sm pull-left" role="button">
    <span class="glyphicon glyphicon-export" aria-hidden="true"></span>Export Event
    </a>

        {if hours != ""}
            <span style="float:right;margin-top:-50px;text-align:right;"><h5>Continuing Education Hours<br><span style="color:#2079b5;font-size:300%;">{hours}</h5></span></span>
        {/if}

    {if title_online == ""}
            <h5 class="title" style="margin-top:65px;font-size: 350%;">{event_title}</h5>
    {/if}

    {if title_online != ""}
    <h5 class="title" style="margin-top:65px;font-size: 350%;">{title_online}</h5>
    {/if}
    <br>
    <h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Next Occurrence</b>: 
       {exp:calendar:occurrences event_id="{segment_3}" show_months="6" date_range_start="today" occurrences_limit="1" }
       {occurrence_start_date format="%l, %F %j, %Y from %g:%i%a"} - {occurrence_end_date format= "%g:%i%a"}
       {/exp:calendar:occurrences}
    </h2>

    {if events_price != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Price</b>: {events_price}</h2>{/if}

    {if instructor_name != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Instructor</b>: {instructor_name}</h2>{/if}

    {if course_number != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Course</b> #: {course_number}</h2>{/if}

    {if provider_number != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Provider</b> #: {provider_number}</h2>{/if}
    {if event_location != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Location</b>: {event_location}</h2>{/if}


    {if register != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>To Register</b>: <a href ="{site_url}login/my_account/"> Click Here </a></h2>{/if}
    <hr>
    {if calendar_uploads != ""}
    <ol class="document_upload">
    {calendar_uploads}
    <li><a href="{cell_1}">{cell_2}</a></li>
    {/calendar_uploads}
    </ol>
    {/if}

    {if event_summary != ""}<p class="details_copy" style="font-size=125%;">{event_summary}</p>{/if}
    <br><br>
    {if cancellation_policy =="CE"} <h3 style="text-align: center;"><span style="color:#b22222"><strong>CANCELLATION POLICY:  Full refund if written notification is received by 48 hours before class starts.  NO REFUNDS will be issued after 24 hours prior to class. Transfer to another class can be made up to 24 hours before class begins.  The new class cannot be refunded.</strong></span></h3>{/if}
    {if cancellation_policy =="Designation"} <h3 style="text-align: center;"><span style="color:#b22222"><strong>Cancellation Policy:&nbsp; Full refund if written notification is received 2 weeks prior to class start date. Otherwise, a $25.00 cancellation fee will be deducted from your refund. NO REFUNDS will be issued is cancellation occurs within 1 week of class start date.</strong></span></h3>{/if}
    <br><br>

    <!-- Future Dates -->

    <div class="panel panel-default">
    <div class="panel-heading">
    <h3 class="panel-title">Future Dates</h3>
    </div>
    <div class="panel-body">
            {exp:calendar:occurrences
              event_id="{segment_3}"
              occurrences_offset="1" 
              date_range_start="21 month"
              date_range_end="12 months"
              dynamic="off"
            }
            {if calendar_no_results}
            There are currently no future dates/times for this item within the next 12 months. We have many other classes and events on the <a href="/calendar_list">calendar</a> in the meantime. 
            {/if}       
    <ul class="list-group" style="margin-bottom:0px;">      
            <li>
             {occurrence_start_date format="%l, %F %j, %Y - %g:%i%a"}
            </li>
            {/exp:calendar:occurrences}
        </ul>
    </div>
    </div>
    </div>
    </div>
    <!--End of Future Dates -->

{/exp:calendar:events}

The /site/calendar_multi looks like this:

{exp:calendar:events
        orderby="title"
        sort="asc"
        event_id="{segment_3}"
        limit="1"
        category="124"
        dynamic="off"}

<div class="typography">
<div class="title_entryBIGG" style="width:98%;margin-top:10px:">
    <br/>
    <br/>

<a href="/calendar_download/event/{segment_3}" target="_blank" class="btn btn-default btn-sm pull-left" role="button">
<span class="glyphicon glyphicon-export" aria-hidden="true"></span>Export Event
</a>

    {if hours != ""}
        <span style="float:right;margin-top:-50px;text-align:right;"><h5>Continuing Education Hours<br><span style="color:#2079b5;font-size:300%;">{hours}</h5></span></span>
    {/if}
    {if title_online == ""}
        <h5 class="title" style="margin-top:65px;font-size: 350%;">{event_title}</h5>
{/if}

{if title_online != ""}
<h5 class="title" style="margin-top:65px;font-size: 350%;">{title_online}</h5>
{/if}
<br>
<h2 class="title" style="margin-top:-10px;margin-bottom:5px;border-bottom:none;"><b>Class Dates</b>:<br> 
   {exp:calendar:occurrences event_id="{segment_3}" show_months="6" date_range_start="today" }
   <ul style="margin-bottom:-25px;">
   <li style="margin-top:-25px;">{occurrence_start_date format="%l, %F %j, %Y from %g:%i%a"} - {occurrence_end_date format= "%g:%i%a"}</li>
</ul>
   {/exp:calendar:occurrences}
</h2>

{if events_price != ""}<h2 class="title" style="margin-top:35px;margin-bottom:5px;border-bottom:none;"><b>Price</b>: {events_price}</h2>{/if}

{if instructor_name != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Instructor</b>: {instructor_name}</h2>{/if}

{if course_number != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Course</b> #: {course_number}</h2>{/if}

{if provider_number != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Provider</b> #: {provider_number}</h2>{/if}
{if event_location != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>Location</b>: {event_location}</h2>{/if}


{if register != ""}<h2 class="title" style="margin-top:0px;margin-bottom:5px;border-bottom:none;"><b>To Register</b>: <a href ="{site_url}login/my_account/"> Click Here </a></h2>{/if}
<hr>
{if calendar_uploads != ""}
<ol class="document_upload">
{calendar_uploads}
<li><a href="{cell_1}">{cell_2}</a></li>
{/calendar_uploads}
</ol>
{/if}

{if event_summary != ""}<p class="details_copy">{event_summary}</p>{/if}
{if cancellation_policy =="CE"} <h3 style="text-align: center;"><span style="color:#b22222"><strong>CANCELLATION POLICY:  Full refund if written notification is received by 48 hours before class starts.  NO REFUNDS will be issued after 24 hours prior to class. Transfer to another class can be made up to 24 hours before class begins.  The new class cannot be refunded.</strong></span></h3>{/if}
{if cancellation_policy =="Designation"} <h3 style="text-align: center;"><span style="color:#b22222"><strong>Cancellation Policy:&nbsp; Full refund if written notification is received 2 weeks prior to class start date. Otherwise, a $25.00 cancellation fee will be deducted from your refund. NO REFUNDS will be issued is cancellation occurs within 1 week of class start date.</strong></span></h3>{/if}

{/exp:calendar:events}

On my multi-day events, I am still getting the "There are currently no future dates/times for this item within the next 12 months. We have many other classes and events on the calendar in the meantime" at the end of my entries. The formatting is stripped out, but the code is showing up. I am about to pull my hair out! Any ideas?

1

For future/upcoming events and their occurrences, use {exp:calendar:cal}. It's the only tag that will calculate events and occurrences chronologically. Details on why {exp:calendar:cal} is the tag to use can be found in this very recommended read:

https://solspace.com/docs/calendar/getting_started/

If you want events/occurrences for the next 6 months, for example, you would do something like this:

{exp:calendar:cal
    date_range_start="today"
    date_range_end="+6 months"
    pad_short_weeks="n"
    /* your other parameters */}

    ... Your upcoming event data ...

{/exp:calendar:cal}
| improve this answer | |
0

Does the future events section work stand alone?

I think the issue may be that you have nested tags.

Try making your future events loop into an embed and pass it segment_3.

{embed='future_events' entry_id="{segment_3}"}

then

{exp:calendar:occurrences event_id="{embed:entry_id}" etc....}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.