Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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 nothing

    I 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.

    #1006147

    Hey 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,
    Peter

    #1006190

    Thanks Dude

    I moved it to the footer and the js-error is gone.
    The 2 problems mentioned above persist.

    Any other ideas?

    #1006434

    Hi,

    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,
    Ismael

    #1006530

    Hi 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.
    Thomas

    #1006624

    Hi,

    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,
    Peter

    #1006660
    This reply has been marked as private.
    #1006994

    Hi,

    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,
    Peter

    #1007122

    Hi Peter
    Perfect. Thank you. Great support!

    #1007125

    Hi,

    Glad I could help you :)

    Best regards,
    Peter

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Toolset – Custom Search – Problem with Enfold (AJAX?)’ is closed to new replies.