Super Search 3.x

Legacy documentation for Super Search 3.x.

Super_Search:Forget_Last_Search template tag

By default, the Super_Search:Form tag remembers the last search a user conducted so that when they return to a search form on the site, the search variables they submitted can be recalled and the search form repopulated. If you wish to provide an option for the user to clear the history of their last search, you can provide a link that points to a template with the Super_Search:Forget_Last_Search function in it. This will cause the search form on the site to be cleared or reset.

{exp:super_search:forget_last_search} content {/exp:super_search:forget_last_search}

Variables

The following variable is available for use:

message

{message}

This variable returns a message indicating the success or failure of the action.

Conditionals

The following conditionals are available for use:

if failure

{if failure}{/if}

This conditional will show its contents if the action fails for any reason.

if success

{if success}{/if}

This conditional will show its contents if the action succeeds.

Examples

The following code should be a complete example for using this function:

{exp:super_search:forget_last_search}
    {if success}
        <h3>Successful!</h3>
    {/if}
    {if failure}
        <h3>Error!</h3>
    {/if}
    <p>{message}</p>
{/exp:super_search:forget_last_search}

Setup

To implement this feature from your search form, your code would look something like this:

{exp:super_search:form
    return="supersearch/results"
}
    <h3>Search for Products:</h3>
<!-- Begin Forget Last Search link -->
    <p>
        <a href="{path='supersearch/forget_last_search'}">
            Forget Last Search?
        </a>
    </p>
<!-- End Forget Last Search link -->
    <p>
        <label for="keywords">Keywords:</label>
        <input
            type="text"
            name="keywords"
            id="keywords"
            value="{super_search_keywords}" />
    </p>
    <p>
        <label for="price-from">Price from:</label>
        <input
            type="text"
            name="price-from"
            id="price-from"
            value="{super_search_price-from}" />
        <label for="price-to">to:</label>
        <input
            type="text"
            name="price-to"
            id="price-to"
            value="{super_search_price-to}" />
    </p>
    <p>
        <input type="submit" name="submit" value="Search!" />
    </p>
{/exp:super_search:form}