• Resolved T_ed

    (@t_ed)


    Hello.
    If you look at page that I need help with at almost bottom of the page, you will notice strange sorting behavior. That is how rating scores will be sorted like:
    2.5 – 1.9 – 2.3 – 1.7 – 1.4 – 2 -1.3
    I am using Elementor PRO posts widget with following snippet and “sorted_by_rank” querry ID:

    add_action('elementor/query/sorted_by_rank', function ($query) {
        $query->set('meta_query', [
            'relation' => 'OR',
            ['key' => '_glsr_average', 'compare' => 'NOT EXISTS'], // this comes first!
            ['key' => '_glsr_average', 'compare' => 'EXISTS'],
        ]);
        $query->set('orderby', 'meta_value_num');
        $query->set('order', 'DESC');
    });

    So, for some posts sorting seemes to be broken.
    I have tried all repairing tools (Migrate, Reset Meta Values, Relations), that does not worked for me.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    Did you try clearing your page cache after using the “Reset Assigned Meta Values” tool?

    Thread Starter T_ed

    (@t_ed)

    Yes, regardless that I do not see cached version when logged in as admin.

    • This reply was modified 4 years, 5 months ago by T_ed.
    Plugin Author Gemini Labs

    (@geminilabs)

    Try this:

    1. Add the following snippet to your functions.php file (or use the Code Snippets plugin): https://pastebin.com/x0VFeHeY

    2. Edit the /finmaxfx-reviews/ page and use the Custom Fields Metabox to remove the _glsr_average and _glsr_ranking values (after verifying that the _glsr_average value is 2.3!). If you are using the Gutenberg Block editor, you can enable the Custom Fields panel in the Gutenberg page preferences.

    3. Once you have removed those values, load the /forex-brokers-ratings/ page and verify that the rating is now 0. If it is not, then you have a caching problem.

    4. If the rating is 0, go to the Site Reviews Tools page and run the “Reset Assigned Meta Values” tool again to recalculate the average and ranking values.

    • This reply was modified 4 years, 5 months ago by Gemini Labs.
    Thread Starter T_ed

    (@t_ed)

    Thank you for your efforts, trully fantastic support.
    Method you suggested did not worked, unfortunately after doing all steps you provided values still were incorrect. But it seems like I have found the culprit and it is zero star rating values.
    Seems like when someone leaves zero stars the plugin calculates overall values incorrectly – internally numbers and externally output are different (have no idea how is this possible). I modified zero star review to higher value and that did the trick. I will recheck my guess again with another post to make sure I am right with that and come back to let you know the result.
    It was not the cache, I purged it several times, tried another browser, incognito mode, disabled caching plugin – all with no result.

    • This reply was modified 4 years, 5 months ago by T_ed.
    Thread Starter T_ed

    (@t_ed)

    Yes, the zero stars reviews caused the problem. I changed them to 1 star, then used “Reset Assigned Meta Values” tool and everything is fine.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Sorting bug’ is closed to new replies.