Tagged: sorting options, woocommerce
-
AuthorPosts
-
January 8, 2020 at 8:50 pm #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?
Regards, Roger
January 9, 2020 at 8:02 am #1171705Hey 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,
IsmaelJanuary 9, 2020 at 8:14 pm #1171931Hi 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,
RogerJanuary 13, 2020 at 4:04 am #1172622Hi,
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,
IsmaelJanuary 13, 2020 at 10:42 am #1172705Hi Ismael!
Thank you, that almost did the trick! :)
Now it looks like this.– Default
– Custom
– Namn
– Pris
– DatumI’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
– DatumRegards,
RogerJanuary 14, 2020 at 4:27 pm #1173425Hi,
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,
IsmaelJanuary 14, 2020 at 4:44 pm #1173432Hi 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 ‘]’
“January 15, 2020 at 4:09 am #1173773Hi,
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,
IsmaelJanuary 15, 2020 at 10:21 am #1173880Hi!
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,
RogerJanuary 16, 2020 at 3:40 am #1174732Hi,
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,
IsmaelFebruary 7, 2020 at 6:37 pm #1182365Hi 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
February 10, 2020 at 7:30 am #1182953Hi,
. 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,
IsmaelFebruary 20, 2020 at 10:46 am #1186280Hi!
Thank you, I really appreciate that. Credentials attached.
Will it still work if I update the theme?
Regards, RogerFebruary 21, 2020 at 7:37 am #1186630Hi,
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,
IsmaelFebruary 21, 2020 at 11:14 am #1186664Hi Ismael,
That is just brilliant, thank you a million!
Will the translations remain when updating Enfold as well?Regards,
RogerFebruary 24, 2020 at 3:46 am #1187174Hi,
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,
IsmaelMarch 9, 2020 at 7:38 pm #1191623Thank you again, that worked like a charm!
You can close this thread now.
/RogerMarch 10, 2020 at 6:31 pm #1191966Hi Technohead,
Great :)
We are closing the thread.
If you need further assistance please let us know in a new one.
Best regards,
Victoria -
AuthorPosts
- The topic ‘Confusing sorting options in WooCommerce and Enfold’ is closed to new replies.