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

    (@mihail-barinov)

    Hi,

    Please use following code snippet

    add_filter( 'aws_search_results_products', 'my_aws_search_results_products' );
    function my_aws_search_results_products( $products ) {
        usort($products, function ($item1, $item2) {
            $a = intval( $item1['f_price'] * 100 );
            $b = intval( $item2['f_price'] * 100 );
            if ($a == $b) {
                return 0;
            }
            return ($a < $b) ? -1 : 1;
        });
        return $products;
    }

    You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.

    Also after adding this code you will need to go to the plugin settings page and click ‘Clear cache’ button.

    Regards

    Thread Starter ellounta

    (@ellounta)

    Really thank you so much!
    and one more i dont want to show the products without prices. I have the pro were can i find it?
    Thank you!!

    Plugin Author ILLID

    (@mihail-barinov)

    Please try following code

    add_filter( 'aws_search_results_products', 'my_aws_search_results_products2', 10, 2 );
    function my_aws_search_results_products2( $products_array, $s ) {
        $new_array = array();
        foreach ( $products_array as $product  ) {
            if ( ! isset( $product['f_price'] ) || intval( $product['f_price'] ) !== 0  ) {
                $new_array[] = $product;
            }
        }
        return $new_array;
    }
    • This reply was modified 4 years, 1 month ago by ILLID.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Results by short prices’ is closed to new replies.