If you have a lot of registration templates and/or instances, it can sometimes be difficult to find an existing template or instance in your list of templates. This recipe shows how you can add a search option for finding existing registration templates or instances by name.

SearchButton2.png

SearchPage.png

This recipe does require the "Page Parameter Filter" plugin from Bema (thank you Bema for an awesome plugin). So, the first step is to install that plugin from your RockShop. You'll find it in the "General" section:

plugin.png

Once you've installed the plugin, navigate to your Tools > Event Registration page and add a new "Search" child page (be sure to select the Full Width template):

AddSearchPage.png

After you've added the page, you should edit the page settings for your new page and set the "Display When" option to Never (this is so that your page does not show as a tab when viewing registration instances).

display_when.png

After adding and editing the page, then add three blocks to this page

blocks.png

Once you've added the new page, you'll want to add three blocks to the new page:

  1. HTML Content
  2. Filter By Page Parameter
  3. Dynamic Data

blocks.png

Here's the HTML Content for the first block:

<div class='alert alert-info'>
    To search for an existing registration template and/or instance, enter your search parameters below and then click 'Search'.
</div>

The second block uses the new block type that you installed from the Rock Shop from Bema. Rather then using block settings, this block provides a "gear" icon that you can use to add filter attributes. Click the gear and add the following two attributes: 

  1. Title (Text Field)
  2. Active Only (Boolean)

PageParameterSettings.png

Finally for third Dynamic Data Block on the page, configure it with the following block settings:

DynamicDataBlock.png

Query:

--DECLARE @Title varchar(max) = 'Men'
--DECLARE @ActiveOnly varchar(max)

IF @Title IS NOT NULL AND @Title <> ''
BEGIN

	SELECT 
		CONCAT( '<a href="/page/403?RegistrationTemplateId=', T.[Id], '&ExpandedIds=C', T.[CategoryId], '">', T.[Name], '</a>' ) AS [Template],
		CONCAT( '<a href="/RegistrationInstance/', I.[Id], '">', I.[Name], '</a>') AS [Instance],
		CAST( I.[StartDateTime] AS Date) AS [Start],
		CAST( I.[EndDateTime] AS DATE) AS [End],
		I.[IsActive]
	FROM [RegistrationTemplate] T
	LEFT OUTER JOIN [RegistrationInstance] I ON I.[RegistrationTemplateId] = T.[Id]
	WHERE ( T.[Name] LIKE '%' + @Title + '%' OR T.[Name] LIKE '%' + @Title + '%' )
	AND ( ISNULL(@ActiveOnly,'False') != 'True' OR I.[IsActive] = 1 )
	ORDER BY T.[Name], I.[Name]

END

Parameters:

@Title=,@ActiveOnly=

You should now have a fully functional search page that can be used to find existing templates and/or instances that contain the term that you search for by entering a value into the "Title" field

You can also optionally add a "Search" button to the event registration page by adding an HTML block above the event template tree view with the following HTML content (replacing '583' with the id of the new page you created):

<div class="clearfix margin-b-sm">
    <a class="btn btn-xs btn-action" href="/page/583"><i class="fa fa-search"></i> Search...</a>
</div>