Search code examples
business-catalyst

Business Catalyst Product Search and Results


Using the business catalyst search feature seems to return results with an or function, so that any item that meets any criteria is displayed as a result. Is there any way to change this to an and function, so that only the items that meet all the criteria will be displayed?


Solution

  • Solved this by doing a product list dump that cancels the template to get all the data on the page without displaying anything. Then used liquid/json to label products in divs according to what is in their names and added an isotope filter for sorting.

    http://revivalfloatspa.businesscatalyst.com/producttest

    Example code:

    {module_productlistdump catalogId="-1" sortType="Alphabetical" template ="" collection="book"}
    {% for item in book.items %}
        {% capture Pname %}
        {{item.name}}
        {% endcapture %}
            {% if Pname contains 'Massage' %}
                {% if Pname contains '9AM' %} 
                    <div class="color-shape tall 9AM purple massage">
                    <p><a href=" {{ item.url }} "> {{item.name}}</a></p></div>
                {% elsif Pname contains '10AM' %}
                    <div class="color-shape tall 10AM purple massage">
                    <p><a href=" {{ item.url }} "> {{item.name}}</a></p></div>
                {% endif %}
            {% elsif Pname contains 'Float' %}
                {% if Pname contains '9AM' %} 
                    <div class="color-shape tall 9AM purple float">
                    <p><a href=" {{ item.url }} "> {{item.name}}</a></p></div>
                {% elsif Pname contains '10AM' %}
                    <div class="color-shape tall 10AM purple float">
                    <p><a href=" {{ item.url }} "> {{item.name}}</a></p></div>
            {% endif %}
        {% endif %}
    {% endfor %}
    

    requires jquery and isotope.