Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #1171599

    Hi!
    In my sorting options in WooCommerce there are now both english and swedish options and this makes it a bit confusing, not to mention it does not look very professional. I have tried some php snippets found on the web but have not found any that works. Also read that Enfold overrides the original WooCommerce sorting, is that true?

    So my question is, can I delete or change/customize the sorting options in the store?

    Hem

    Regards, Roger

    #1171705

    Hey Technohead,

    Thank you for using Enfold.

    Looks like some of the text in the select or sort option don’t have any translations yet. Please install the following plugin and try to translate the strings or text manually.

    // https://wordpress.org/plugins/loco-translate/

    Best regards,
    Ismael

    #1171931

    Hi Ismael and thanx for a prompt reply!
    I’m sorry I was not clear about the question. I wonder if it’s possible to have only the Swedish sorting options like they are in WordPress Woocommerce menu. See linked screenshot. I’d like to get rid of all the english ones except maybe “random” :)

    Then I can try to translate that with the plugin you mentioned. (for some reason “popularity” is not translated so guess I’ll need to translate that too)

    Regards,
    Roger

    Screenshot

    #1172622

    Hi,

    Sorry for the delay. You can hide the other options with this css code.

    .sort-param li ul li:nth-child(n+6):nth-child(-n+11) {
        display: none !important;
    }

    Best regards,
    Ismael

    #1172705

    Hi Ismael!

    Thank you, that almost did the trick! :)
    Now it looks like this.

    – Default
    – Custom
    – Namn
    – Pris
    – Datum

    I’d like to change the “Custom” option to the “Random” sorting option instead.
    Then I can try to translate “Default” and “Random”.

    So it would look like this.
    – Default
    – Random
    – Namn
    – Pris
    – Datum

    Regards,
    Roger

    #1173425

    Hi,

    Thank you for following up.

    Instead of using the css, try this filter in the functions.php file.

    /* 
     * Filter to customize the sorting options for frontend dropdown
     * 
     * Filter is located: config-woocommerce\config.php    function avia_woocommerce_frontend_search_params
     */
    function my_wc_product_order_dropdown_frontend( array $product_order )
    {	
         unset( $product_order['popularity'] );
         unset( $product_order['rating'] );
         unset( $product_order['relevance'] );
         unset( $product_order['id'] );
         unset( $product_order['menu_order'] );
    
         return $product_order;
    }
    add_filter( 'avf_wc_product_order_dropdown_frontend', 'my_wc_product_order_dropdown_frontend', 10, 1 );

    This will disable the Custom sort and leave the Random option.

    Best regards,
    Ismael

    #1173432

    Hi again!
    I pasted the code into the child theme functions.php but got this error message.

    “Dina ändringar i PHP-kod har återställts till tidigare version på grund av ett fel i rad 37 i filen wp-content/themes/enfold-child/functions.php. Vi ber dig korrigera och försöka att spara en gång till.

    syntax error, unexpected ‘&’, expecting ‘]’

    #1173773

    Hi,

    Thank you for the update.

    Did you get the code from your email? Please try to copy it directly from this forum to avoid the conversion of symbols, which what probably breaks the code.

    Best regards,
    Ismael

    #1173880

    Hi!
    Yes of course, that did the trick. Thank you!
    Is there another way to translate the “Default” and “Random” options? I can’t get Loco Translate to work. Says WooCommerce is 100% translated to Swedish already.

    Regards,
    Roger

    #1174732

    Hi,

    Glad it’s working. The sort options are added by theme, so you have to translate the theme or the avia_framework text domain. Go to the Themes tab of the plugin, click Enfold, then look for the language that requires translation.

    Thank you for your patience.

    Best regards,
    Ismael

    #1182365

    Hi again Ismael!
    Unfortunately I cannot find the source string I want to translate in Enfold with Loco Translate. I´m afraid this is a little over my head. Is there any way you could help me with this? Just want the sorting options “Random” translated to “Slumpmässig” and “Default” translated to “Standard” I´d be very happy if this is possible :)

    Regards, Roger

    #1182953

    Hi,

    . Is there any way you could help me with this?

    Yes, of course. Can we have access to the dashboard and the file server? We may need to add the translations manually in the language files.

    Best regards,
    Ismael

    #1186280

    Hi!
    Thank you, I really appreciate that. Credentials attached.
    Will it still work if I update the theme?
    Regards, Roger

    #1186630

    Hi,

    We added the translations of the “Default” and “Random” strings directly in the sv_SE.po file and used POEdit to compile it. The sort buttons should be properly translated now. Please don’t forget to remove the browser cache prior to checking the page.

    Thank you for your patience.

    Best regards,
    Ismael

    #1186664

    Hi Ismael,

    That is just brilliant, thank you a million!
    Will the translations remain when updating Enfold as well?

    Regards,
    Roger

    #1187174

    Hi,

    You’re welcome!

    Yes, the translations should still work after the update because we added a language or locale path in the child theme directory.

    Best regards,
    Ismael

    #1191623

    Thank you again, that worked like a charm!
    You can close this thread now.
    /Roger

    #1191966

    Hi Technohead,

    Great :)

    We are closing the thread.

    If you need further assistance please let us know in a new one.

    Best regards,
    Victoria

Viewing 18 posts - 1 through 18 (of 18 total)
  • The topic ‘Confusing sorting options in WooCommerce and Enfold’ is closed to new replies.