• Hi There,

    For out customer we use the sort on sku:

    add_filter( ‘aws_search_results_products’, ‘aws_search_results_products’ );
    function aws_search_results_products( $products ) {
    usort($products, function ($item1, $item2) {
    $a = $item1[‘sku’];
    $b = $item2[‘sku’];
    if ($a == $b) {
    return 0;
    }
    return ($a < $b) ? -1 : 1;
    });
    return $products;
    }

    ++

    Works good. Only our customer asks us if it possible:

    Relavance on title, this products needs to show first. (sorting on the sku needs to be disabled)

    When the searchterm is found in the description, can the search results be sorted on sku.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hello,

    So, as I understand, you want the following:

    first show all products that has searched words in the title and that sort all other products by SKU.

    Is that right?

    Thread Starter Adriders

    (@adriders)

    Yes, this is exact what we mean.

    Plugin Author ILLID

    (@mihail-barinov)

    Sorry, can’t find any way to to do that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘SKU – sort – ralavance’ is closed to new replies.