- May 6, 2021 at 12:24 pm #33095
SFTP Port: 29841
We are using the Ajax Pro Plugin search page.
Search for Iphone: https://xxxx.com/?post_type=product&s=iphone&asp_active=1&p_asid=1&p_asp_data=1¤t_page_id=909&woo_currency=EUR&qtranslate_lang=0&filters_changed=0&filters_initial=1&asp_gen%5B%5D=title&asp_gen%5B%5D=content&asp_gen%5B%5D=excerpt&customset%5B%5D=product_variation&customset%5B%5D=product
In the results we are currently seeing all the products related to the keyword ‘iphone’. Our clients are happy with the logic and functionality provided by your plugin, however we have one last thing that we would like to do. We would like to put the ‘Out of stock’ items to the bottom of the search results. Is there a way this can be done when executing the sql query? We do not want to loop through the results and order them after the sql query has been executed through a foreach in php since this site has a lot of products and if the query returns a lot of results we might end up facing memory issues.
From the rest of the ordering logic attached we do not want to change anything, when it comes to primary and secondary logic, since it would result in changing the logic of the search on the header.
Attachments:You must be logged in to view attached files.May 6, 2021 at 12:37 pm #33100
Ernest MarcinkoKeymasterMay 6, 2021 at 5:50 pm #33105
Yes we already tried that but unfortunately we would loose our current secondary logic which is by pricing DESC. If we had 3 conditional logic for ordering we would be able to do so however with 2 we would change the current product ordering.
We do not mind hooking to any of the plugin’s filters if there is no way to do it through plugin settings.
May 7, 2021 at 8:15 am #33110
- This reply was modified 1 year ago by niumalta96.
In that case, you can still try the group priorities feature. Try creating a rul group and set the priority to 101. Then the rule should be on the “_stock_status” custom field: https://i.imgur.com/Qo7Tqmb.png
After saving the groups, the items in stock should be prioritized, and the primary/secondary ordering applied by group basis.
To make direct changes to the final query, you can use these hooks.Best,
If you like my products, don't forget to rate them on codecanyon :)
May 7, 2021 at 9:11 am #33115
Ok perfect. Thank you, will let you know in case we have any other issues.
You must be logged in to reply to this topic.