Home › Forums › WoodMart support forum › Relevansi plugin + Ajax Search for Everyone
Relevansi plugin + Ajax Search for Everyone
- This topic has 50 replies, 2 voices, and was last updated 2 years, 2 months ago by WASIPLtd_Website.
-
AuthorPosts
-
June 26, 2018 at 6:46 pm #64927
newsprinceParticipantDear xtemos team.
I find a way to integrate Relevanssi plugin with your ajax form so that if someone uses a Relevanssi plugin can now search on all product information.
Relevanssi plugin works just find on its own with your theme BUT on your AJAX search form doesn’t load the corresponding products. Let’s say for example i search “blue jeans” with blue the attribute of product jeans. Your form doesn’t bring any results unless you hit enter then the search is done via Relevanssi plugin.
But you can integrate relevansi plugin on your ajax form by simply putting a line of code in search.php file.
So on
/wp-content/themes/woodmart/inc/classes/search.php
On line 71
after
$results = new WP_Query( apply_filters( ‘woodmart_ajax_get_results’, $query_args ) );
put that line of code
relevanssi_do_query( $results );
Now the AJAX search form brings the results from relevansi plugin so now the search term blue jeans bring the product results.
If you want please implement it on future updates. It’s an one line of code and the rest of your theme users can now make more advanced search with the free relevansi plugin
Thank you.
Please note, for the modification to work Relevanssi plugin must be active.
June 27, 2018 at 6:09 am #64967
Artem TemosKeymasterHello,
Thank you very much for the information. We will investigate this in the future.
Regards
June 27, 2018 at 10:10 am #65026
insidewebParticipantThank you for this feature sir. Seems working fine!
June 27, 2018 at 1:12 pm #65055
Artem TemosKeymasterThank you for the information.
June 27, 2018 at 1:45 pm #65066
newsprinceParticipantSide note for everyone that want to try it.
To index the variation sku if the product is variable, so that the results will show the corresponding product you must add this snippet too on functions.php or with a snippet plugin.
https://www.relevanssi.com/knowledge-base/indexing-product-variation-skus-main-product/
add_filter('relevanssi_content_to_index', 'rlv_index_variation_skus', 10, 2); function rlv_index_variation_skus($content, $post) { if ($post->post_type == "product") { $args = array('post_parent' => $post->ID, 'post_type' => 'product_variation', 'posts_per_page' => -1); $variations = get_posts($args); if (!empty($variations)) { foreach ($variations as $variation) { $sku = get_post_meta($variation->ID, '_sku', true); $content .= " $sku"; } } } return $content; }
Thank you
November 12, 2018 at 9:08 am #88883
newsprinceParticipantUpdate:
Woodmart version 3.2 changed file search.php location and made some modifications.
Now you have to go to folder:
/wp-content/themes/woodmart/inc/modules
edit the search.php file and add after line 233 add:
relevanssi_do_query( $results );
That’s it.
November 22, 2018 at 8:13 am #90970
BrandboutikParticipantBrilliant Sir! Worked like a charm 🙂
January 11, 2019 at 10:44 am #101334
mbiehlParticipantSorry, I can not php
How should I exactly add it?
233 $results = new WP_Query( apply_filters( ‘woodmart_ajax_get_results’, $query_args ) );
234 $relevanssi_do_query ($ results);January 11, 2019 at 11:26 am #101343
newsprinceParticipantYes like that but you have to install the Relevanssi plugin also
January 11, 2019 at 11:27 am #101345
newsprinceParticipantGo to folder and open the file
/wp-content/themes/woodmart/inc/modules/search.php
January 11, 2019 at 2:17 pm #101407
mbiehlParticipantI have it installed and can not get it to work
In the attachment times the file
Thanks for your supportJanuary 11, 2019 at 2:18 pm #101409January 11, 2019 at 4:07 pm #101448
newsprinceParticipantYou have a space between $ and results.
relevanssi_do_query($results);
Copy paste this.
January 13, 2019 at 4:42 pm #101669
ggeekyParticipantHi,
sorry to bother.
I’ve tried to implement this plugin following your instruction but I can’t get it to work.
Do you know of any other alternative? Thank you.January 14, 2019 at 8:42 am #101737
newsprinceParticipantIt is working. Other people tried it too and works. We use it on our shop constantly. Just insert this line of code and then activate the relevanssi plugin. You have to setup the plugin to index the right properties of the products.
I attach the file.
Attachments:
You must be logged in to view attached files.January 14, 2019 at 12:21 pm #101769
ggeekyParticipantThank you. The issue was in the settings of the plugin.
I very much appreciate your help.
Have a good oneJune 3, 2019 at 11:57 am #126921
[email protected]ParticipantAwesome topic this thank you very very much @newsprince
June 13, 2019 at 10:45 am #128377
[email protected]ParticipantHi since the new update im getting problems with relevansi.
Notice: Undefined offset: relevanssi/lib/common.php on line 975
this happends when you use the view more option. anybody here know how to fix this?
June 13, 2019 at 10:53 am #128378
newsprinceParticipantIt’s just a notice. I don’t think it breaks the functionality. Try to contact relevansi plugin developer.
June 13, 2019 at 11:08 am #128380
[email protected]Participantthx for your quick reply. do you have this problem aswell? i see that this line is no longer present in the search.php file.
apply_filters( ‘woodmart_ajax_get_results’, $query_args ) );
June 13, 2019 at 11:12 am #128381
newsprinceParticipantAlways use the latest search.php file from woodmart theme and just add the code
relevanssi_do_query($results);
after
$results = new WP_Query( apply_filters( 'woodmart_ajax_search_args', $query_args ) );
The line is present in latest file, what do you mean it is not?
June 13, 2019 at 11:22 am #128384
[email protected]Participantok thx!. i was searching the file for ‘woodmart_ajax_get_results’ but could not find it so thats why i made a wrong assumption, sorry for that. still getting the bug but asked relevansi developer what to do. thx agian!
example
http://rj.development.bladewp.com/?s=geloofsopbouw&post_type=productJune 13, 2019 at 11:26 am #128385
[email protected]Participantfyi i’m only getting this bug with debug being enabled.
June 13, 2019 at 1:41 pm #128426
newsprinceParticipantIt’s a notice. I don’t think affects functionality.
July 10, 2019 at 9:57 am #132110
FilsterParticipantHi,
is this trick still working?I have Relevanssi plugin activated and add this line:
relevanssi_do_query($results);
after
$results = new WP_Query( apply_filters( 'woodmart_ajax_search_args', $query_args ) );
but still got not Relevanssi working on the ajax woodmart search?
Thank you 🙂
July 10, 2019 at 10:20 am #132116
newsprinceParticipantYes it is working. Did you create the relevanssi index with your product attributes etc?
July 10, 2019 at 10:44 am #132119
FilsterParticipantHi, thank you for your quick reply newsprince.
Yes I built the relevanssi index. I already see the users search terms in the “users search” page of relevanssi, but on using I don’t get results.
Are we ok that with relevanssi I should be able to search post and not only product?It isn’t the first time I use Relevanssi, so I don’t figured out what am I missing.
July 10, 2019 at 11:00 am #132124
newsprinceParticipantIt works with the Woodmarts default ajax search form that searches for products. Try that.
July 10, 2019 at 11:01 am #132125
FilsterParticipantmmm, I thought it was a setting like this in woodmart:
header builder => see attachmentSo I think that Relevanssi doesn’t get through this parameter? 🙁
Attachments:
You must be logged in to view attached files.July 10, 2019 at 11:07 am #132131
newsprinceParticipantYou want to search products or posts? I don’t get it what you try to accomplish.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register