Forums Forums Search & Filter Pro TypeError: Cannot read property 'split' of undefined tag not being clickable

Viewing 10 posts - 1 through 10 (of 11 total)
  • Anonymous
    #227222

    I’ve the same problem as https://support.searchandfilter.com/forums/topic/uncaught-typeerror-cannot-read-property-split-of-undefined/

    On my local dev site everything is fine, but on my staging server this is the error I get when click on an item.

    search-filter-build.min.js?ver=2.4.6:2 Uncaught TypeError: Cannot read property 'split' of undefined
        at HTMLFormElement.getQueryParamFromURL (search-filter-build.min.js?ver=2.4.6:2)
        at HTMLFormElement.getPagedFromURL (search-filter-build.min.js?ver=2.4.6:2)
        at HTMLDivElement.<anonymous> (search-filter-build.min.js?ver=2.4.6:2)
        at HTMLDocument.dispatch (jquery.js:3)
        at HTMLDocument.r.handle (jquery.js:3)
    getQueryParamFromURL @ search-filter-build.min.js?ver=2.4.6:2
    getPagedFromURL @ search-filter-build.min.js?ver=2.4.6:2
    (anonymous) @ search-filter-build.min.js?ver=2.4.6:2
    dispatch @ jquery.js:3
    r.handle @ jquery.js:3

    Most of the issues in the other topic are private, so I can’t seem to find what is going wrong or how to fix it.

    Trevor
    #227224

    In that other thread, the user updated all other plugins first, then disabled them all, tested, it was working OK, enabled them one by one, and everything worked then. Maybe you could do the same, checking as you go?

    Anonymous
    #227230

    The only way t fix it for me is disabling S&F which fixes the issue. Disabling all other plugins doesn’t seem to have an effect.

    Trevor
    #227232

    Are you able to send me a live link/URL to your search page so I can take a look?

    Anonymous
    #227322
    This reply has been marked as private.
    Anonymous
    #227650

    Any tips on how to fix it? Weirdly enough I don’t have any issues on my local machine. I did have to fix the database on my staging server because somehow S&F didnt create the tabels so I had to manually create the tables in phpMyAdmin

    CREATE TABLE wp_search_filter_term_results (
                            id bigint(20) NOT NULL AUTO_INCREMENT,
                            field_name varchar(255) NOT NULL,
                            field_value varchar(255) NOT NULL,
                            field_value_num bigint(20) NULL,
                            result_ids text NOT NULL,
                            PRIMARY KEY  (id),
                KEY field_name_index (field_name),
                KEY field_value_index (field_value),
                KEY field_value_num_index (field_value)
    
                    )
    
    CREATE TABLE wp_search_filter_cache (
                            id bigint(20) NOT NULL AUTO_INCREMENT,
                            post_id bigint(20) NOT NULL,
                            post_parent_id bigint(20) NOT NULL,
                            field_name varchar(255) NOT NULL,
                            field_value varchar(255) NOT NULL,
                            field_value_num bigint(20) NULL,
                            field_parent_num bigint(20) NULL,
                            term_parent_id bigint(20) NULL,
                            PRIMARY KEY  (id),
                KEY field_name_index (field_name),
                KEY field_value_index (field_value),
                KEY field_value_num_index (field_value_num)
                    )
    Trevor
    #227802

    The tables creation issue will not be the cause. The link you gave is in maintenance Mode.

    What happens if you switch back to normal pagination?

    I ask because I see that the Infinite Scroll Container is not set, but it should be. Maybe the markup/structure of your archives needs an extra container? Take a look in our plugin folder, inside the templates folder, there is an exemplar results PHP file for infinite scroll. In that, the Ajax Container is not shown, as it is outside/cotains that code.

    Anonymous
    #227911

    Good to know. It was not a the moment I shared it, but I set it back because the client requested it. I’ve disabled it again.

    When I switch to Pagination the same happens.

    I don’t really get what the difference is beween Ajax Container and Infinite Scroll Container. When I create a S&F I just enable and disable them until it works and most of the time it works when I don’t use the Infinite Scroll Container.

    As I check the example I see a search-filter-results-list which for me is alloy-results and a search-filter-result-item which by me is called alloy-item

    This last part I don’t really get

    > In that, the Ajax Container is not shown, as it is outside/cotains that code.

    What does the Ajax container need to contain? I though it needs to contain the items in the result, because that is the part that refreshes right?

    Trevor
    #227989

    The template structure would look something like this:

    <div class='name_of_ajax_container_class'
    if ( $query->have_posts() )
    {
    	?>
    	<div class='name_of_infinite_scroll_container_class'>
    	<?php
    		while ($query->have_posts())
    		{
    			$query->the_post();
    			
    			?>
    			<div class='name_of_infinite_scroll_post_selector_class'>
    				// post output here
    			</div>
    			
    			<?php
    		}
    	?>
    	</div>
    <?php
    }
    else
    {
    	?>
    	<div class='name_of_infinite_scroll_container_class' data-search-filter-action='infinite-scroll-end'>
    		<span>End of Results</span>
    	</div>
    	<?php
    }
    </div>
    Anonymous
    #230244

    I’ve fixed the issue, but I have no idea why it is happening. With a lot of trail and error I’ve found that my class .alloy-item resulted in the bug. This class is no used anywhere (not in CSS nor in JS in my theme), but removing this class results in no more console warning. This is what it looked liked

    <div <?php post_class('col-lg-4 col-md-6 alloy-item alloy-item-berichten'); ?>>

    And changing it to, fixes the issue.

    <div <?php post_class('col-lg-4 col-md-6 alloy-item-berichten'); ?>>

    Here is the full code of the post type template content.php https://gist.github.com/mvaneijgen/b96a9ddb55f00881ecb936caa8312687

    I doubt that you guys use that class name in S&F.js, but it seems like the only explanation.

Viewing 10 posts - 1 through 10 (of 11 total)