1 Show Active Registration Discount Codes Shared by Jeff Richmond, The Well Community Church 14 days ago 13.0 Administration / Finance, Event Beginner Description Most of our staff are only allowed to edit registration instances, which is mostly fine except that we often got questions about what discount codes were active or how many times a code has been used. Since they're not able to edit templates to see current discount codes, we wanted to provide a way for them to still get the details they need at a glance. This recipe adds an expandable panel above the instances grid that shows details for all of the active or scheduled discount codes. How-To Go to your internal Event Registrations page found at Internal Homepage > Tools > Website > Event Registration by default Add a new HTML block in the Main zone between the existing Registration Template Detail and Registration Instance List blocks. Block Settings: Block Title: Template Discounts Enabled Lava Commands: Rock Entity HTML Content: {%- assign regTemplateID = PageParameter.RegistrationTemplateId | Default:'0' | AsInteger %} {%- if regTemplateID > 0 %} {%- assign today = 'Now' | Date | AsDateTime %} {%- assign thisYear = today | Date:'yyyy' %} {%- assign discountCount = 0 %} {%- capture discounts %} {%- registrationtemplatediscount where:'RegistrationTemplateId == {{ regTemplateID }}' sort:'AutoApplyDiscount desc, StartDate, EndDate' disableattributeprefetch:'true' securityenabled:'false' %} {%- for discount in registrationtemplatediscountItems %} {%- if discount.EndDate == null or discount.EndDate > today %} {%- assign discountCount = discountCount | Plus:1 %} <tr> <td>{{ discount.Code | Upcase }}</td> <td>{{ discount.DiscountString }}</td> <td> {%- if discount.AutoApplyDiscount == true %} <i class="fa fa-check"></i> {%- endif %} </td> <td> {%- assign futureStart = false %} {%- if discount.StartDate != null and discount.StartDate > today %} {%- assign futureStart = true %} {%- assign startDate = discount.StartDate | Date:'M/d' %} {%- assign year = discount.StartDate | Date:'yyyy' %} {%- if year != thisYear %}{% assign startDate = discount.StartDate | Date:'M/d/yy' %}{% endif %} {%- endif %} {%- assign futureEnd = false %} {%- if discount.EndDate != null %} {%- assign futureEnd = true %} {%- assign endDate = discount.EndDate | Date:'M/d' %} {%- assign year = discount.EndDate | Date:'yyyy' %} {%- if year != thisYear %}{% assign endDate = discount.EndDate | Date:'M/d/yy' %}{% endif %} {%- endif %} {%- if futureStart == true and futureEnd == true %} Valid {{ startDate }} to {{ endDate }} {%- elseif futureStart == true %} Starts {{ discount.StartDate }} {%- elseif futureEnd == true %} Ends {{ endDate }} {%- endif %} </td> <td> {%- assign limits = '' %} {%- if discount.MaxUsage > 0 %} {%- capture limits %}Max Uses: {{ discount.MaxUsage }}{% endcapture %} {%- endif %} {%- if discount.MinRegistrants > 0 %} {%- if limits != '' %}{% assign limits = limits | Append:', ' %}{% endif %} {%- capture limits %}{{ limits }}Min Registrants: {{ discount.MinRegistrants }}{% endcapture %} {%- endif %} {%- if discount.MaxRegistrants > 0 %} {%- if limits != '' %}{% assign limits = limits | Append:', ' %}{% endif %} {%- capture limits %}{{ limits }}Max Registrants: {{ discount.MaxRegistrants }}{% endcapture %} {%- endif %} {{ limits }} </td> <td> {%- registration expression:'RegistrationInstance.RegistrationTemplateId == {{ regTemplateID }} && DiscountCode == "{{ discount.Code }}"' count:'true' disableattributeprefetch:'true' securityenabled:'false' %} {%- assign useCount = count %} {{ 'Use' | ToQuantity:useCount }} {%- endregistration %} {%- registrationregistrant expression:'Registration.RegistrationInstance.RegistrationTemplateId == {{ regTemplateID }} && Registration.DiscountCode == "{{ discount.Code }}"' count:'true' disableattributeprefetch:'true' securityenabled:'false' %} {%- if count != useCount %} <small class="text-muted">({{ 'Registrant' | ToQuantity:count }})</small> {%- endif %} {%- endregistrationregistrant %} </td> </tr> {%- endif %} {%- endfor %} {%- endregistrationtemplatediscount %} {%- endcapture %} {%- if discountCount > 0 %} <div class="panel-group"> <div class="panel panel-block panel-collapsible"> <div class="panel-heading p-0"> <h4 class="panel-title"> <button type="button" class="btn btn-block text-left px-3 py-2 panel-title collapsed" data-toggle="collapse" data-target="#collapse1" aria-expanded="false"> <i class="fa fa-tag"></i> Active/Scheduled Discounts <span class="badge badge-info ml-1">{{ discountCount }}</span> <i class="fa fa-chevron-down pull-right"></i> </button> </h4> </div> <div id="collapse1" class="panel-collapse collapse"> <div class="panel-body"> <div class="grid grid-panel"> <div class="table-responsive"> <table class="grid-table table table-condensed table-striped table-hover small"> <thead> <tr> <th scope="col">Code</th> <th scope="col">Discount</th> <th scope="col">Auto Apply</th> <th scope="col">Valid Dates</th> <th scope="col">Limits</th> <th scope="col">Usage</th> </tr> </thead> <tbody> {{ discounts }} </tbody> </table> </div> </div> </div> </div> </div> </div> {%- endif %} {%- endif %} That's it! Go to a registration template that has active discounts, and you should now see a new "Active/Scheduled Discounts" panel. Clicking on the title will expand the panel to reveal all of the discount details. If there currently aren't any active discounts, the panel will not show up. Follow Up Please don't hesitate to leave a comment below or hit me up on Rock Chat (@JeffRichmond) if you have questions or find any issues with this recipe. If you come up with better or more efficient ways of doing anything in this recipe, please let me know. Thanks! Change Log 2025-02-07 - Initial Version