Announcement

Collapse
No announcement yet.

How do I add code to the filter results?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How do I add code to the filter results?

    I have added this code to product summary and product page images to show a 'grade' overlay:

    Code:
     <actinic:block if="%3cactinic%3avariable%20name%3d%22GradeIconShown%22%20%2f%3e">
    <actinic:block if="%3cactinic%3avariable%20name%3d%22GradeAB%22%20%2f%3e%20%3d%3d%20%27Grade%20A%27">
    <img class="gradeab" src="gradea.jpg" alt="Grade A" />
    </actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22GradeAB%22%20%2f%3e%20%3d%3d%20%27Grade%20B%27">
    <img class="gradeab" src="gradeb.jpg" alt="Grade B" />
    </actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22GradeAB%22%20%2f%3e%20%3d%3d%20%27Grade%20C%27" >
    <img class="gradeab" src="gradec.jpg" alt="Grade B" />
    </actinic:block>
    </actinic:block>
    I am struggling to add it to Filtered Search Results.

    Just adding it to the Search Result Layout does not work and using https://community.sellerdeck.com/for...filter-results displays code as text without rendering it.

    Please can someone advise how it may best be done?

    Thank you
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    #2
    My query is now more specific.

    Using the 'image' code in the KB article above I have added three images to the standard search result:

    Code:
     <Actinic:ScriptFunctionCall>Template2('<actinic:variable searchresultvariable="true" name="imagea" />')</Actinic:ScriptFunctionCall>
    
    <Actinic:ScriptFunctionCall>Template3('<actinic:variable searchresultvariable="true" name="imageb" />')</Actinic:ScriptFunctionCall>
    
    <Actinic:ScriptFunctionCall>Template4('<actinic:variable searchresultvariable="true" name="imagec" />')</Actinic:ScriptFunctionCall>
    With the corresponding code in the Javascript Header Functions:

    Code:
     <script type="text/javascript">
    function Template2(vimagea)
    { var first = '<img class="gradeab" src="' + vimagea +'" alt="Grade A" />'; return (first); }
    </script>
    <script type="text/javascript">
    function Template3(vimageb)
    { var second = '<img class="gradeab" src="' + vimageb +'" alt="Grade B" />'; return (second); }
    </script>
    <script type="text/javascript">
    function Template4(vimagec)
    { var third = '<img class="gradeab" src="' + vimagec +'" alt="Grade C" />'; return (third); }
    </script>
    There is a variable with choices at product level to select Grade A, Grade B or Grade C

    I tried putting Blockifs round the image expressions but it does not work:

    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22GradeAB%22%20%2f%3e%20%3d%3d%20%22Grade%20A%22">
    <Actinic:ScriptFunctionCall>Template2('<actinic:variable searchresultvariable="true" name="imagea" />')</Actinic:ScriptFunctionCall>
    </actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22GradeAB%22%20%2f%3e%20%3d%3d%20%22Grade%20B%22" >
    <Actinic:ScriptFunctionCall>Template3('<actinic:variable searchresultvariable="true" name="imageb" />')</Actinic:ScriptFunctionCall>
    </actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22GradeAB%22%20%2f%3e%20%3d%3d%20%22Grade%20C%22" >
    <Actinic:ScriptFunctionCall>Template4('<actinic:variable searchresultvariable="true" name="imagec" />')</Actinic:ScriptFunctionCall>
    </actinic:block>
    I have tried making the variable within the blockif a 'Search Result Variable' but this does not work either.

    How can I add blockifs of a product variable to the Standard Search Result ?

    Thank you
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    Comment


      #3
      How can I add blockifs of a product variable to the Standard Search Result ?
      You can't.
      BlockIf's are used to selectively allow content on static HTML pages that SellerDeck generates when you upload the site.

      Search Results (and Filtered Products) use product data and a single fixed template to display products via Perl or AJAX scripting and BlockIf's won't work there.
      Possible workaround: You can access user variables in these results and use with JavaScript to alter the displayed results. Not trivial.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Thank you Norman

        Here is my workaround...

        Conclusion and Result

        The conditional blocks are rendered offline while the site is being generated, whereas the JavaScript will only run online so only one will be rendered as only first condition will ever be met.

        Make the variable drop down choices the inage filename - see image.



        Add this to the ordinary product layouts:


        Code:
        &lt;actinic:block if="%3cactinic%3avariable%20name%3d%22GradeIconShown%22%20%2f%3e"&gt;&lt;img class="gradeab" src="&lt;actinic:variable name="GradeABC" /&gt;" alt="product grade" /&gt;&lt;/actinic:block&gt;

        Add this to javascript functions:

        Code:
        &lt;script type="text/javascript"&gt; function Template5(vimaged) { var fourth = '&lt;img class="gradeab" src="' + vimaged +'" alt="Machine Grade" /&gt;'; return (fourth); } &lt;/script&gt;

        Add this to Standard Search Result Layout:


        Code:
        &lt;Actinic:ScriptFunctionCall&gt;Template5('&lt;actinic:variable searchresultvariable="true" name="GradeABC" /&gt;')&lt;/Actinic:ScriptFunctionCall&gt;

        It would be nice to be able to wrap the expression in Standard Search Result Layout with a BlockIf 'GradeIconShown' but as not possible make one of the image choices an invisible image (eg:nograde.gif).
        Jonathan Chappell
        Website Designer
        SellerDeck Website Designer
        Actinic to SellerDeck upgrades
        Graphicz Limited - www.graphicz.co.uk

        Comment

        Working...
        X