The SellerDeck main help describes how to include your own variables in the search results. The same variables can also be included in filter results. However since these pages are controlled by Javascript, a small snippet of Javascript must be used instead of the code described in the help. This article describes the general method through a worked example.
1. Select 'Library' from the ‘Design’ menu and click the 'Variables' tab.
2. Create two variables with the names 'text' and 'image', then set them up as in the images below: -
NB 'Searchable' and 'Upload' must be ticked in the variable's definition in the Library.
3. Select the 'Layouts' tab, right click on the top entry 'Library' and select 'Find' from the menu, and in the 'Search for Text' field enter 'Standard Search Results RWD', and open the layout selected.
4. Add the following code, and click 'OK': -
So that it looks like the image below: -
5. Right click in the 'Library' again, select 'Find' and enter the layout name 'Javascript Header Functions' and open the layout selected.
6. Add the following code, and click 'OK': -
7. So that it looks like the image below: -
8. Click ‘OK’, then ‘Close’ and upload the site.
The method can also be used to insert multiple variables. You can also include the Product Reference using the variable SearchResultProductReference, but this requires the following Javascript change and the variable must not have the attribute 'searchresultvariable="true"'.
9. Open your site folder in Windows Explorer and find the file 'actinicsearch.js'.
10. Open the file in Notepad and find the following line:
11. Insert the following line of code immediately below it:-
12. Save and close the file and upload the site.
For example, to include both the 'Brand' and the 'Product Reference', with an appropriate label for each, you would add the following script functions:
and the following calls (which can be put in separate places in the layout if required):
1. Select 'Library' from the ‘Design’ menu and click the 'Variables' tab.
2. Create two variables with the names 'text' and 'image', then set them up as in the images below: -
NB 'Searchable' and 'Upload' must be ticked in the variable's definition in the Library.
3. Select the 'Layouts' tab, right click on the top entry 'Library' and select 'Find' from the menu, and in the 'Search for Text' field enter 'Standard Search Results RWD', and open the layout selected.
4. Add the following code, and click 'OK': -
Code:
<Actinic:ScriptFunctionCall>Template2('<actinic:variable searchresultvariable="true" name="image" />')</Actinic:ScriptFunctionCall>
Code:
<Actinic:ScriptFunctionCall>Template1('<actinic:variable searchresultvariable="true" name="text" />')</Actinic:ScriptFunctionCall>
5. Right click in the 'Library' again, select 'Find' and enter the layout name 'Javascript Header Functions' and open the layout selected.
6. Add the following code, and click 'OK': -
Code:
<script type="text/javascript"> function Template2(vimage) { var first = '<img src="' + vimage +'" />'; return (first); } </script> <script type="text/javascript"> function Template1(vtext) { var sResult = 'text:' + vtext; return (sResult);} </script>
8. Click ‘OK’, then ‘Close’ and upload the site.
The method can also be used to insert multiple variables. You can also include the Product Reference using the variable SearchResultProductReference, but this requires the following Javascript change and the variable must not have the attribute 'searchresultvariable="true"'.
9. Open your site folder in Windows Explorer and find the file 'actinicsearch.js'.
10. Open the file in Notepad and find the following line:
Code:
sTemplate = sTemplate.replace(/(<Actinic:S_STOCK><\/Actinic:S_STOCK>)/ig, objProductDetails.m_nStockLevel);
Code:
sTemplate = sTemplate.replace(/(<Actinic:S_PRODREF><\/Actinic:S_PRODREF>)/ig, objProductDetails.m_sProdRef);
For example, to include both the 'Brand' and the 'Product Reference', with an appropriate label for each, you would add the following script functions:
Code:
<script type="text/javascript"> function Template1(vSearchResultProductReference) { var sResult = 'Ref: ' + vSearchResultProductReference; return (sResult); } function Template2(vbrand) { var sResult = 'Brand: ' + vbrand; return (sResult); } </script>
Code:
<Actinic:ScriptFunctionCall>Template1('<actinic:variable name="SearchResultProductReference" />')</Actinic:ScriptFunctionCall>
Code:
<Actinic:ScriptFunctionCall>Template2('<actinic:variable searchresultvariable="true" name="brand" />')</Actinic:ScriptFunctionCall>