Configure Searches to Filter by Product or Category

You can enable users to filters search results using product and category on the home page. Users see only the articles associated with the selected product, category, or both product and category. You implement these filters by including the product category search filter widget. The filters appear only in a tree view.

  1. Edit the file:

    cp/customer/development/views/pages/home.php
  2. Add the product filter by adding this line:
    <rn:widget path= "okcs/OkcsProductCategorySearchFilter" filter_type="products"/>
  3. Add the category filter by adding this line:
    <rn:widget path= "okcs/OkcsProductCategorySearchFilter" filter_type="categories"/>

Here’s an example of how to include the product and category filter in the home page:

<rn:meta title="#rn:msg:SHP_TITLE_HDG#" template="okcs_standard.php" clickstream="home"/><div class="rn_SearchControls">
<div class="rn_Hero">
    <div class="rn_HeroInner">
        <div class="rn_HeroCopy">
            <h1>#rn:msg:WERE_HERE_TO_HELP_LBL#</h1>
        </div>
        <div class="rn_SearchControls">
            <h1 class="rn_ScreenReaderOnly">#rn:msg:SEARCH_CMD#</h1>
            <form method="get" action="/app/results">
                <rn:container source_id="OKCSSearch">
                    <div class="rn_SearchInput">
                        <rn:widget path="searchsource/SourceSearchField" initial_focus="true" label_placeholder="#rn:msg:ASK_A_QUESTION_ELLIPSIS_MSG#"/>
                    </div>
                    <rn:widget path="okcs/RecentSearches"/>
                    <rn:widget path="okcs/OkcsSuggestions"/>
                    <rn:widget path="searchsource/SourceSearchButton" initial_focus="true" search_results_url="/app/results"/>
									<rn:widget path="okcs/OkcsProductCategorySearchFilter" filter_type="products" view_type="explorer"/>
									<rn:widget path="okcs/OkcsProductCategorySearchFilter" filter_type="categories" view_type="explorer"/>
                </rn:container>
            </form>
        </div>
    </div>
</div>
<div class="rn_PageContent rn_Home">
    <div class="rn_Container">
        <rn:widget path="okcs/OkcsVisualProductCategorySelector" numbered_pagination="true"/>
    </div>
    <div class="rn_PopularKB">
        <div class="rn_Container">
            <rn:widget path="okcs/AnswerList" type="popular" target="_self" view_type="list"/> 
        </div>
    </div>
    <div class="rn_PopularKB rn_RecentKB">
        <div class="rn_Container">
            <rn:widget path="okcs/AnswerList" type="recent" target="_self" view_type="list"/> 
        </div>
    </div>
</div>