Search Templates
Search is an important tool in the users quest for information. Here you can find how to integrate with Aurora and return the relevant information.
Introduction
Searching within Aurora is made easy by allowing you to interact with a simple form.
<div class="template_search">
<form method="get" action="/products/search" class="template_search_form">
<fieldset>
<legend>{site_text page="Header" part="Sub-title: Product Search" }</legend>
<p><label for="productsearch">{site_text page="Header" part="Label: Search" }</label><input type="text" class="template_search_input textfield" id="productsearch" name="search" />
<input class="template_button" type="submit" name="submit_search" {site_text page="Header" part="Link: Search" type="value"} /></p>
<input type="hidden" name="submit_search" />
</fieldset>
</form>
<div class="template_quicksearch_container"></div>
</div>
This example will allow visitors to search for their products upon submitting the form.
Autocomplete
If you want results returned before your visitor has submitted the form, you can pass data over to Aurora via this method. Javascript is provided purely for demonstration purposes and you are free to use whatever you wish, providing you pass the relevant parameters.
$.getJSON('/products/search/s:'+$this.val(), { ajax: true, items_per_page: '5', search: $this.val() }, function (responseJson) {
if(responseJson[0] > 0) {
$('.template_quicksearch_container').show().html(responseJson[1]);
} else {
$('.template_quicksearch_container').hide();
}
});
End result
Users are redirected to the search page, which is the same page Product (Category) Listings. You can pass additional variables into this page, to help give feedback to your visitors.
Updated about 2 years ago