Reply To: Primary result ordering sort by price.

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Primary result ordering sort by price. Reply To: Primary result ordering sort by price.

#10153
Ernest Marcinko
Ernest Marcinko
Keymaster

Hi!

It probably won’t be the same, because the sorting is done after the relevance search as a post-process.

It is unfortunately not possible to sort the query by a custom field value without changing the source code. If you use the regular engine, then you can try the following:

1. Open up the wp-content\plugins\ajax-search-pro\includes\classes\search\class-asp-search-cpt.php file and go to line 328:

$priority_select AS priority,

2. ..and change that line to:

(SELECT IF(meta_value IS NULL, 0, meta_value) FROM $wpdb->postmeta WHERE $wpdb->postmeta.meta_key='_price' AND $wpdb->postmeta.post_id=$wpdb->posts.ID) AS priority,

However this will still not guarantee the same results, but it should be different from the current a bit.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)