
-
AuthorPosts
-
March 24, 2019 at 6:23 pm #1082286
Hello
I would like my products to be sorting in random order, so that when you visit the site multiple times you see different products in the top each time.
I would this https://kriesi.at/support/topic/random-order-for-product-grid/ post in the forum, telling me to add some code and go into settings and change it. However the settings pane seems to have changed since the fix in this post, as I don’t have the “display” options tab.
thanks in advance.
March 26, 2019 at 7:13 pm #1083201Hey saabendtsen,
The display options have moved to the customizer, please check there.
Here is a thread about it
https://wordpress.org/support/topic/display-options-on-customizer/Best regards,
VictoriaMarch 29, 2019 at 7:30 am #1084474Alright I found it thanks.
However adding the code from this thread https://kriesi.at/support/topic/random-order-for-product-grid/ does not allow me to choose random sorting. How can I get this ?
The code that I tried adding is this below here, which i added to functions.php in my child theme.
add_filter('avia_product_slide_query', 'avia_product_slide_query_mod', 10, 2); function avia_product_slide_query_mod($params, $grid, $test) { $params['orderby'] = 'rand'; return $params; }
-
This reply was modified 6 years, 3 months ago by
saabendtsen.
March 31, 2019 at 9:52 pm #1085176Hi,
That filter is going to change the product sorting directly. It’s not going to add a random sorting option in the element editor if that is what you’re expecting.
Best regards,
IsmaelApril 1, 2019 at 5:27 pm #1085583Right – that was some other code which was supposed to do that. However this doesn’t work for me either, the sorting stays at what I choose in the customizer.
Adding the ‘random’=>’rand’, to this function
"name" => __("Sorting Options", 'avia_framework' ), "desc" => __("Here you can choose how to sort the products. Default setting can be set at Woocommerce -> Setting "id" => "sort", "type" => "select", "std" => "dropdown", "no_first"=>true, "subtype" => array( __('Let user pick by displaying a dropdown with sort options (default value is defined at Defau __('Use defaut (defined at Woocommerce -> Settings -> Default product __('Sort alphabetically', 'avia_framework' ) =>'title', __('Sort by most recent', 'avia_framework' ) =>'date', __('Sort by price', 'avia_framework' ) =>'price', 'random'=>'rand', __('Sort by popularity', 'avia_framework' ) =>'popularity')),
in enfold/config-templatebuilder/avia-shortcodes/product_grid.php was supposed to give me random as a option, which however doesn’t work either.
Are there other ways to show the products by random ?
-
This reply was modified 6 years, 3 months ago by
saabendtsen.
April 4, 2019 at 12:03 am #1086689Hi,
Try to replace that modification.
'random'=>'rand',
.. with:
__('Sort randomly', 'avia_framework' ) =>'rand')),
And then select the “Sort randomly” option.
Please note that there are hosting providers that disable this sorting option because of the performance cost of the running the query.
// https://wpengine.com/support/about-order-by-rand/
Best regards,
IsmaelApril 4, 2019 at 8:29 am #1086850The modified rand didn’t help.
I am guessing it is disabled by my hosting provider. Thanks for the help though, you can consider this closed now.
April 4, 2019 at 3:25 pm #1087086Hi saabendtsen,
Hmmm… that is weird, I hope you find a solution.
I am closing this one.
Best regards,
Victoria -
This reply was modified 6 years, 3 months ago by
-
AuthorPosts
- The topic ‘Random sorting in product grid’ is closed to new replies.