My Sellerdeck Account | Free Trial

Sellerdeck Community and Knowledge Base

Go Back   Sellerdeck Community > Knowledge Base > Content Management

Search powered by Google
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Useful Thread? Display Modes
  #1  
Old 26-Jul-2016, 03:50 PM
G.W.Green G.W.Green is offline
Administrator
Join Date: Sep 2005
Full Name: G.W.Green
Posts: 482
Thanks: 0
Thanked 66 Times in 42 Posts
How do I add my own variables to the filter results?

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.

NB 'Searchable' and 'Upload' must be ticked in the variable's definition in the Library.

We will use the 'brand' variable as an example, but the same method will work with any variable you have added yourself.
  1. Select 'Library' from the ‘Design’ menu and click the 'Layouts' tab.
  2. Scroll down and expand the 'Search Results' layout type.
  3. Double-click the ‘Standard Search Result’ layout.
  4. In the ‘Layout Code’ window, position the cursor at the top of the layout and paste the following:
    Code:
    <script type="text/javascript">
    		function Template1(vbrand)
    		{
    		var sResult = 'Brand: ' + vbrand;
    		return (sResult);
    		}
    </script>
    (Instead of 'brand' you would use the name of your own variable).

  5. Now click where you want your variable to appear, and insert the following:
    Code:
    <Actinic:ScriptFunctionCall>Template1('<actinic:variable searchresultvariable="true" name="brand" />')</Actinic:ScriptFunctionCall>
    (Again, substitute your own variable name for 'brand')

  6. 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"'.
  7. Open your site folder in Windows Explorer and find the file 'actinicsearch.js'.
  8. Open the file in Notepad and find the following line:
    Code:
    sTemplate = sTemplate.replace(/(<Actinic:S_STOCK><\/Actinic:S_STOCK>)/ig, objProductDetails.m_nStockLevel);
  9. Insert the following line of code immediately below it:
    Code:
    sTemplate = sTemplate.replace(/(<Actinic:S_PRODREF><\/Actinic:S_PRODREF>)/ig, objProductDetails.m_sProdRef);
  10. 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:

Code:
<script type="text/javascript">
		function Template1(vSearchResultProductReference)
		{
		var sResult = 'Ref: ' + vSearchResultProductReference;
		return (sResult);
		}
		function Template2(vbrand)
		{
		var sResult = 'Brand: ' + vbrand;
		return (sResult);
		}
</script>
and the following calls (which can be put in separate places in the layout if required):
Code:
<Actinic:ScriptFunctionCall>Template1('<actinic:variable name="SearchResultProductReference" />')</Actinic:ScriptFunctionCall>
Code:
<Actinic:ScriptFunctionCall>Template2('<actinic:variable searchresultvariable="true" name="brand" />')</Actinic:ScriptFunctionCall>
Reply With Quote
The Following 2 Users Say Thank You to G.W.Green For This Useful Post:
fergusw (27-Jul-2016), maroni35 (02-Aug-2016)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 11:10 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.