Color filters and de Sort function

  • O-O
    Participant
    4 years, 7 months ago #17745

    Hi There,

    I have a question. We have sorted all our products with our own algorithm in the sort.

    But now when I go to a categorie, and choose a color in the filter color. It looks like the sort function stops working and the colors are now showed according to the algorithm.

    Can you please help me how to fix this?

    wpsolr
    Keymaster
    4 years, 7 months ago #17755

    If you mean that selecting a filter cancel the sort currently selected, then it is the way WPSOLR is working.

    Eventually, you can select your sort algorithm field as the default one in screen “2.5 sort”

    O-O
    Participant
    4 years, 7 months ago #17819

    We have set the sort to our algorithm except the problem still exists.

    wpsolr
    Keymaster
    4 years, 7 months ago #17827

    I’m not sure I understand the problem.

    O-O
    Participant
    4 years, 7 months ago #17929

    So we have set our algorithm as default sort setting. But when I go to a category and select a color. It looks like the sort is not going by algorithm anymore. As if the color filter changes this.

    wpsolr
    Keymaster
    4 years, 7 months ago #18102

    When I start a search, I can see that the default sort is “Relevancy”, not your own sort. It seems your sort is not the default one in screen “2.5 Sort”

    O-O
    Participant
    4 years, 7 months ago #18105

    When I go to the settings in the wpSolr it seems fine. Can you see in here what could be wrong?

    https://ibb.co/fvKDsdr

    wpsolr
    Keymaster
    4 years, 7 months ago #18121

    Your configuration looks correct indeed.

    I’ll have to test in my own environments.

    O-O
    Participant
    4 years, 7 months ago #18150

    Thank you! Hope you can find the problem

    wpsolr
    Keymaster
    4 years, 7 months ago #18158

    I checked in depth the WooCommerce code, but could not find a way to force the WooCommerce sortby drop down list with a default value. I could not even make work the standard WooCommerce default sortby value (defined in the customizer).

    The default sortby is applied by WPSOLR. But it is not displayed as selected in the WooCommerce dropdown list.

    In woocommerce_catalog_ordering() of file wc-template-functions.php:
    $default_orderby = wc_get_loop_prop( ‘is_search’ ) ? ‘relevance’ : apply_filters( ‘woocommerce_default_catalog_orderby’, get_option( ‘woocommerce_default_catalog_orderby’, ” ) );
    $orderby = isset( $_GET[‘orderby’] ) ? wc_clean( wp_unslash( $_GET[‘orderby’] ) ) : $default_orderby; // WPCS: sanitization ok, input var ok, CSRF ok.

    The 2 lines above show that the default orderby is always ‘relevance’ for search, unless ‘orderby’ url query parameter is set by a previous user selection.

    • This reply was modified 4 years, 7 months ago by wpsolr.
Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.