- Posts: 78
- Thank you received: 6
Help for search by keywords
2 years 4 months ago #362041
by nico1979
Help for search by keywords was created by nico1979
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
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
Please Log in or Create an account to join the conversation.
2 years 4 months ago #362044
by nicolas
Replied by nicolas on topic Help for search by keywords
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.
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.052 seconds