customer_account:template_manager:template_manager_variables:result_variables
This is an old revision of the document!
Template manager - search result variables
FINDOLOGIC offers the following variables for the search result, to optimize it for your desire.
The RESULT array contains all products based on the searched query.
Variable | Type | Brief description |
---|---|---|
RESULT | array | Array of the entire search result |
QUERY | string | Search query text. |
TOTAL_RESULTS | integer | Total number of results found. |
Items of the RESULT array
You can call the RESULT array and get following informations:
Variable | Type | Brief description |
---|---|---|
ITEM.ID | string | The unique item ID as submitted in the CSV or XML. |
ITEM.ORDERNUMBER | string | The ordernumber as submitted in the CSV or XML. |
ITEM.TITLE | string | The item name with emphasis of terms found flemphasis 1) . |
ITEM.TITLE_WITHOUT_HIGHLIGHTING | string | The item name without emphasis of terms found. |
ITEM.SUMMARY | string | The short description with emphasis of terms found. |
ITEM.PRICE | number | The currently applicable gross price of the item, e.g. offer price. |
ITEM.OVERRIDDEN_PRICE | number | The normal price, RRP, etc. |
ITEM.IMAGE | string | The URL of the item thumbnail image. |
ITEM.URL | string | The URL of the item detail page. |
ITEM.TAX_RATE | number | The tax rate of the item. |
ITEM.PROPERTIES | struct | The structure with the contents of the optional columns of the CSV 2). |
ITEM.ATTRIBUTES | struct | The structure with the attributes configured to be outputted in the template. This is only recommended if you would have duplicate content in properties and attributes. |
Code example
Here is a small code example that goes threw all products and prints them out in the search result.
{foreach from=$RESULT key=I item=RESULT name=RESULTS} <li class="fl-product"> <a href="{$RESULT.URL}"> <div class="fl-product-image"> <span class="fl-vertical-align-helper"></span> <img src="{$RESULT.IMAGE}"/> </div> <p class="fl-product-title">{$RESULT.TITLE}</p> <p> <span class="fl-product-price"> {$PREFIX_CURRENCY} {$RESULT.PRICE|number_format:2:$DECIMAL_SEPARATOR:$THOUSANDS_SEPARATOR} {$POSTFIX_CURRENCY} </span> <span class="fl-product-call-to-action fl-button"> {$TRANSLATOR->translate('resultCtaButtonText')} </span> </p> </a> </li> {/foreach}
What exactly happens here?
First we are crating a Smarty foreach that iterates over all items from the RESULT array. Afterwards we are creating a list, that should have the product inside. {$PREFIX_CURRENCY}
starts the currency tag and {$POSTFIX_CURRENCY}
ends it.
A currency symbol will get added at the end of the price (e.g.€/£). The {$TRANSLATOR→translate('resultCtaButtonText')}
creates a button with the value “details”. This button supports multiple languages.
How would the search result HTML looks like?