This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

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 MarcinkoErnest 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:

[php]$priority_select AS priority,[/php]

2. ..and change that line to:

[php](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,[/php]

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