Lead Commerce offers web developers and designers many ways to search their website from searching products and pages to particular page template. The available searches are as follows:
NOTE: The default search does not search attributes. All other searches search attributes that have been marked as external.
All results are posted to the flex file “result.flex†by using the search loop. All search type results can be called with the following example loop:
<ul> {% loop result %} {% if result.content_type == 'page' %} <li>Page: <a href="{result.page_url}">{result.page_name}</a></li> {% else %} <li>Product: <a href="{result.product_url}">{result.product_name}</a></li> {% endif %} {% endloop result %} </ul>
As seen from the example above, all searches uses LOOP result. The variables within each loop are however different.
This loop requires pagination. Please see the section about pagination on how to implement and what variables are accessible using pagination.
All searches have a few output tags available to them.
Output Tag | Description |
{search_performed} | Returns a boolean value (true or false) if a search has been performed. |
{search_type} |
Returns what type of search was performed.
Page Search: page Product Search: product Default Search: default Template Search: template slug |
{search_term} | Returns the searched value |
Page Output Tags | See Page Loop Documentation |
NOTE: If you want to return the number of search results, use {pagination_total_items} as defined in the Pagination Documentation.