Add sort option on Service Portal for Catalog search results.

santosh22
Tera Contributor

I am trying to create sortby(Relevance, Newest, Alphabetical) buttons on catalog search page in service portal. My display results are Catalog name, short description, catagory bubbles. 

I have tried achieving it by cloning OOTB widget and embedding widget with modifications.  But, that process is too complex and is not working. 

My html code:

<div ng-class="::{'hidden-xs' : options.hide_xs}">
    <div class="panel panel-{{::c.options.color}}">
      <div class="panel-heading"> 
        <div class="row content_block no-margin">
          <div class="count text sc-text-res-padding" ng-class="(c.title.length > 45) ? 'col-md-12 col-xs-12 col-sm-12' : 'col-md-5 col-xs-5 col-sm-5'">
            <h3>{{c.title}}</h3>
          </div>
          <div class="sorting">
              <span class="inline">
                <span class="text sort-label">${Sort By}</span>
              </span>
              <span class="pipe inline">
                |
              </span>
              <span class="sort-list inline">
                <ul class="list-inline">
 
                  
                  <button class="transparent-button link-color" ng-class="{'active':c.selected_order == 'relevancy'}" aria-label="${Sort by} ${relevance}" ng-click="c.updateResultOrder(data.relevency_data)">${Relevance}</button>
                    <button class="transparent-button link-color" ng-class="{'active':c.selected_order == item.id}" aria-label="${Sort by} ${Newest}" ng-click="c.updateResultOrder(item)">${Newest}</button>
                  <button class="transparent-button link-color" ng-class="{'active':c.selected_order == item.id}" aria-label="${Sort by} ${Alphabetical}" ng-click="c.updateResultOrder(item)">${Alphabetical}</button>
                    <span class="order-icons" ng-show="c.selected_order == item.id">
                      <span ng-hide="item.order_desc"><i class="fa fa-caret-up" aria-hidden="true"></i>
                      </span>
                      <span  ng-show="item.order_desc"><i class="fa fa-caret-down" aria-hidden="true"></i>
                      </span>
                    </span>
                </ul>
              </span>
            </div>
          </div>

need help with client controller & server code. 

Thanks & regards in advance.

3 REPLIES 3

cynlink1
Tera Expert

santosh - I need to fulfill the same requirement. Were you able to come up with a working solution? If yes, would you be willing to share the solution?

Hey, I had raised a HI ticket on this. SN said that it's not possible to sort the search results. Reason is, global search has multiple tables(catalog,knowledge,idea,etc.) If we try sorting the results, it doesn't know which table to sort. I would suggest you to do the same.

Ok, thank you for responding.