Home › Forums › Basel support forum › Filter Refreshes Too Fast
Filter Refreshes Too Fast
- This topic has 15 replies, 2 voices, and was last updated 6 years, 5 months ago by Artem Temos.
-
AuthorPosts
-
June 20, 2018 at 5:17 pm #63916
antonchaik88ParticipantHi, when selecting items to filter by, the whole page will refresh right away. How can I configure it to pause before reloading, so that a user may click 2 or 3 items (for example, filter by red, green, blue) before being forced to wait for a reload?
June 20, 2018 at 7:09 pm #63930
Artem TemosKeymasterHi,
That is how WooCommerce filters widgets work. There is no way to make multiple choice first.
Regards
June 21, 2018 at 5:41 pm #64146
antonchaik88ParticipantHello,
I see that when selecting an item, the whole page does not reload, and instead, does some kind of ajax call to fetch products matching the new query.Where is the code that handles the click event for those elements? Perhaps I can add code to delay 3ms before sending the query, which will reset after each filter click.
June 21, 2018 at 5:59 pm #64157
Artem TemosKeymasterYou can edit it in our theme
js/functions.js
. But even with the delay, it will not work as you are requesting.June 21, 2018 at 6:54 pm #64175
antonchaik88ParticipantWhy will it not work?
June 21, 2018 at 8:21 pm #64181
Artem TemosKeymasterBecause WooCommerce filters are simple links, you can click two links at the same time.
June 21, 2018 at 8:26 pm #64183
antonchaik88ParticipantI am planning to unassign the href attribute, and return false on click, start the timer, then build the url up based on the links the person clicks. After no clicks are seen for 3s, then load the page.
I see the links, but the page doesn’t reload. I see only the shop part reloads with ajax, so are you handling that, or is that built into wordpress? I would need to make sure it does the same ajax load.
June 21, 2018 at 8:28 pm #64184
antonchaik88ParticipantI also do not see functions.js
I see only theme.min.js loaded inside the js folder of the basel theme dir.
June 21, 2018 at 8:58 pm #64187
antonchaik88ParticipantI see in the minimized code you have the pjax call. I can’t find where you assemble the url to replace the current url. Can you point me to that?
Also, where can I get the non min code?June 22, 2018 at 6:23 am #64211
Artem TemosKeymasterYou need to disable JS minification in Theme Settings -> Performance and then customize our AJAX calls in the file
js/functions.js
.June 23, 2018 at 3:09 am #64419
antonchaik88ParticipantOk,
Looks like I have to use the non minified version anyway because there’s an error when using the minified version that shows up in the console.
Uncaught TypeError: a is not a function
at theme.min.js?ver=4.1.1:formatted:7211
at theme.min.js?ver=4.1.1:formatted:7209
at theme.min.js?ver=4.1.1:formatted:7210June 23, 2018 at 8:29 am #64449
Artem TemosKeymasterYou need to update the theme to the latest version first.
June 23, 2018 at 7:47 pm #64511
antonchaik88ParticipantOk I will look into it.
Where can I find your logic for creating the url for filters? For example, for an attribute called “size” and multiple selections, it might be:
“filter_size=43-5-2%2C40-2%2C42-5-2%2C42-2&query_type_size=or”
and for “simple-color”:
“filter_simple-color=black,white”
But I don’t see where the parsing code is for this?
For example, person adds a new size, filter_size query needs to update. Where does that happen?
June 23, 2018 at 8:48 pm #64512
Artem TemosKeymasterThese URLs are built in the file
inc/widgets/class-widget-layered-nav.php
July 13, 2018 at 6:01 pm #67368
antonchaik88ParticipantI am still trying to work this out and it’s proving very difficult.
You have a function: get_page_base_url( $taxonomy ) which I believe creates the url for each item in the layered nav. You then use this as a base, and then add the filter item to the url, or if it’s selected, remove from the list of filters inside the link.What would be the best way to do the following:
1) For every filter item selected, add that item to an array
2) Have a submit button that spins off the query
3) Once clicked, it would send the list of clicked items — How can I link them up in php?
4) Returns a link to the client, which then I call pjax on to actually do the filtering.Also, get_page_base_url( $taxonomy ) is protected. I’d like to reuse some of this code, any advice?
July 13, 2018 at 7:24 pm #67377
Artem TemosKeymasterSorry, but it require advanced code customization and this service is out of our theme support scope.
-
AuthorPosts
Tagged: filter refreshing
- You must be logged in to create new topics. Login / Register