Forums › Forums › Search & Filter Pro › TypeError: Cannot read property 'split' of undefined tag not being clickable
- This topic has 10 replies, 2 voices, and was last updated 6 years, 2 months ago by
Trevor.
-
Anonymous(Private) November 21, 2019 at 2:54 pm #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:3Most 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.
Anonymous(Private) November 26, 2019 at 9:19 am #227650Any 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(Private) November 27, 2019 at 3:57 pm #227802The 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(Private) November 28, 2019 at 9:48 am #227911Good 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 ContainerandInfinite 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 theInfinite Scroll Container.As I check the example I see a
search-filter-results-listwhich for me isalloy-resultsand asearch-filter-result-itemwhich by me is calledalloy-itemThis 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(Private) November 29, 2019 at 3:48 pm #227989The 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(Private) January 6, 2020 at 1:25 pm #230244I’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-itemresulted 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.phphttps://gist.github.com/mvaneijgen/b96a9ddb55f00881ecb936caa8312687I doubt that you guys use that class name in S&F.js, but it seems like the only explanation.
-
AuthorPosts