Hi,
Thank you for getting back to us so quickly!
Regarding the AJAX mode, we have been using the Dedicated Ajax Mode
Best,
Leo
Hello again Leo,
To edit the orderby clause of the filters’ AJAX calls in the dedicated mode, try this:
if( wp_doing_ajax() && isset( $_REQUEST['awf_front'] ) && isset( $_REQUEST['awf_action'] ) && 'filter' === $_REQUEST['awf_action'] ) {
if( isset( $_REQUEST['awf_ajax_extras']['orderby_seed'] ) ) {
add_filter( 'woocommerce_shortcode_products_query', function( $args, $attrs, $type ) {
$args['orderby'] = 'RAND('. intval($_REQUEST['awf_ajax_extras']['orderby_seed']) . ')';
$args['order'] = '';
return $args;
}, 100, 3 );
}
}
Of course, you will need to take care of the seed value appearing only when the random ordering is active and any possible other conditions, but this should work as a blueprint. You could also try the posts_orderby hook, but in this case your misha_rand_order_with_seed function would have to be changed quite a bit to become applicable to the AJAX case.
Good luck!
Thank you, we will try to have a play around with the code provided to try and get it working
If you guys ever added this as a feature to the premium version i would definitely upgrade as its a great feature to add
Leo,
I will mark this as a feature request, for us to look into the possibility of adding custom orderby options at some point in the future.
Meanwhile, I hope you will find the way to hook your custom code, please let us know here if you do!
Hello Leo,
I will go ahead and close this inactive thread, but please feel free to re-open it or create a new topic if you have anything else to add to this discussion.
Have a great day!