Tagged: ajax, custom search, Toolset
-
AuthorPosts
-
September 5, 2018 at 11:53 am #1006054
Hi Team
I use Toolset in the Enfold-Theme.
https://toolset.com/I have 2 problems with a ‘Custom Search’.
– ‘AJAX results update when visitors change any filter values’ doesn’t work
– ‘Reset-Button’ to clear the form – does nothingI tested with all plugins disabled, caching disabled, css and js not minified…
Now, before you direct me to the plugin-developer, let me point out that this Custom Search (with automatic value changes) works fine (with Twenty13, Twenty14, Twenty15…) when Enfold (or child-theme) is disabled – so it might be theme-related.Is it possible that AJAX is not fired on a regular page?
Did I forget a specific theme setting?
Maybe you have an idea how to make it work.
Thank you.September 5, 2018 at 2:35 pm #1006147Hey mm3np22f,
I’m not sure if the code breaks the ajax function but I get a javascript error on your website. This code:
<script type="text/javascript"> jQuery( document ).ready( function( $ ) { var extra_css = $( "#views-extra-css" ) ? $( "#views-extra-css" ).text() : null; if( extra_css ) { $( 'head' ).append( '<style>' + extra_css + '</style>' ); $( "#views-extra-css" ).remove(); } $( 'head' ).append( $( "#views-extra-css-ie7" ).html() ); $( "#views-extra-css-ie7" ).remove();}); </script>
is loaded before the jquery.js script and triggers following error:
ReferenceError: jQuery is not defined
Please move it to the footer or remove it and check the ajax search again.
Best regards,
PeterSeptember 5, 2018 at 3:59 pm #1006190Thanks Dude
I moved it to the footer and the js-error is gone.
The 2 problems mentioned above persist.Any other ideas?
September 6, 2018 at 4:58 am #1006434Hi,
The filter works properly when I test it. The reset button works as well. Please purge the cache and then test it again.
Best regards,
IsmaelSeptember 6, 2018 at 10:41 am #1006530Hi Ismael
Thank you for testing it.
Sure, the filter works, but not as intended.
The values in the second dropdown are updated after you click the ‘Search’-Button. They should be updated immediately without clicking the button (see working example in clip in Private Content).
As for the Reset-Button: I replaced it with a ‘regular’ link. I added the original ‘not-working’ Reset-Button again for your testing puposes.
Thanks for your support.
ThomasSeptember 6, 2018 at 2:47 pm #1006624Hi,
Please create us an admin account and I’ll look into it. I can’t promise a solution but maybe it’s a simple js script issue (missing selector, missing code, etc.) If possible set up a test website because I’ll switch the theme, activate and deactivate plugins, etc.
Best regards,
PeterSeptember 6, 2018 at 3:39 pm #1006660This reply has been marked as private.September 7, 2018 at 9:46 am #1006994Hi,
I found the culprit. The search function requires wp_mediaelement script which is not loaded by default by Enfold (because of performance reasons and to decrease the loading times). To fix the issue add this code to the child theme functions.php:
add_filter( 'avf_enqueue_wp_mediaelement', 'avia_always_load_mediaelement', 10, 2); function avia_always_load_mediaelement($condition, $options) { $condition = true; return $condition; }
and replace line 419 in enfold/functions.php:
$condition2 = ( version_compare( get_bloginfo( 'version' ), '4.9', '>=' ) ) && $condition;
with
$condition = apply_filters( 'avf_enqueue_wp_mediaelement', $condition, $options ); $condition2 = ( version_compare( get_bloginfo( 'version' ), '4.9', '>=' ) ) && $condition;
The next theme update will already contain this change – you don’t need to modify the enfold/functions.php again.
Best regards,
PeterSeptember 7, 2018 at 2:18 pm #1007122Hi Peter
Perfect. Thank you. Great support!September 7, 2018 at 2:21 pm #1007125Hi,
Glad I could help you :)
Best regards,
Peter -
AuthorPosts
- The topic ‘Toolset – Custom Search – Problem with Enfold (AJAX?)’ is closed to new replies.