Define PHP variable from a seperate API if statement

Hi I’m the author of Multi Rating Pro. The simplest way to do this is to put this logic within the rating-result.php template file.

You can call the API function passing in your own result_type and then check this in the template.

if ( class_exists( 'MRP_Multi_Rating_API' ) ) {
    MRP_Multi_Rating_API::display_rating_result( array(
            'rating_item_ids' => 1,
            'show_count' => false,
            'result_type' => 'my_result_type'
    ) );
}

and then in rating-result.php template file, add the following as required:

if ( $result_type == 'my_result_type' ) {       

    $score_result = $rating_result['adjusted_score_result'];

    $value1 = 1;
    $value2 = 20;
    $value3 = 21;
    $value4 = 40;
    $value5 = 41;
    $value6 = 60;
    $value7 = 61;
    $value8 = 80;
    $value9 = 81;
    $value10 = 100;

    switch ( $score_result ){
        case ( $score_result >= $value1 && $score_result <= $value2 ):
            echo "within range 1";
            break;
        case ( $score_result >= $value3 && $score_result <= $value4 ):
            echo "within range 2";
            break;
        case ( $score_result >= $value5 && $score_result <= $value6 ):
            echo "within range 3";
            break;
        case ( $score_result >= $value7 && $score_result <= $value8 ):
            echo "within range 4";
            break;
        case ( $score_result >= $value9 && $score_result <= $value10 ):
            echo "within range 5";
            break;
        default:
            echo "within no range";
            break;
    }       
}

Hope this helps.