Help for search by keywords

  • Posts: 53
  • Thank you received: 3
  • Hikashop Business
5 months 1 week ago #362041

Hi,
I'm trying to make a search field (text filed) that have the following behaviors.
i.e.
In a book shop there is a book with title "The Lord of the Rings"
If I search for "Lord Rings", at first will be displayed all books with both words (i.e. "The Lord of the Rings - The two towers" "The Lord of the Rings - the fellowship of the ring" etc.) in the title, than all books that contain any word ("lord" and "rings").
How is it possible?
Thank you

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
5 months 1 week ago #362044

Hi,

It's not possible to combine both search processing modes. It's either both words, or any words. To be able to search with both modes to provide the products like you want, it would basically require running twice the products listing's main MySQL query and combine the results. This would require complex modifications to achieve, and slow the page processing, and cause issues with the pagination system.
I don't see an easy way to do that.
I think the simplest would be to directly modify the file components/com_hikashop/views/product/view.html.php in order to dynamically change the products listing loading query in the listing function to use a UNION of twice the same query, changing only the filters on the columns of the filter when the "every words" mode is selected.

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum