Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Live Filter on Posts Widget on Category Page not working.
- This topic has 12 replies, 2 voices, and was last updated 5 years, 3 months ago by
yonahs61332.
-
AuthorPosts
-
March 1, 2021 at 3:19 pm #31863
yonahs61332
ParticipantHere is a link to a temporary Admin Login: https://www.pharmashaul.com/wp-admin/?wtlwp_token=ef0021b5419eef7fe7bef8bb233b414b
(BTW, my site is designed to look on a specific tablet, so please ignore how it looks on a regular screen)I am trying to create a filter for a my category pages, for example: https://www.pharmashaul.com/product-category/t20-c4/
I am trying to implement on a Posts widget that is set to “Current Query” and using Ele Custom Skin for the grid layout.I have created the filter on the backend and in the “test area” it works fine, giving the proper results
But on my page it does not filter the products at all. I have set the CSS classes to asp_es_1 per your instructions and still nothing.Can you please help me?
March 1, 2021 at 3:22 pm #31864Ernest Marcinko
KeymasterHi,
Sure! Please note that filtering elementor widgets only works on single pages, not on archive pages. Archive pages run completely different queries and currently are not supported yet. We are working on a solution, but there are a lot of issues due to wordpress core limitations.
The custom skin may not be an issue, but we can only guarantee working instances on the native Elementor widgets, as we can not prepare for add-on custom behaviors. Usually they are fine though.
March 1, 2021 at 3:27 pm #31865yonahs61332
ParticipantDo you have a suggestion on how I can get around this?
I don’t understand how I can make this work without using the Category page as that is the base of my query.
Can your Search filter take parameters (ie check a box) based on the Querystring?March 1, 2021 at 4:04 pm #31867yonahs61332
ParticipantI believe the way to do it is using the “asp_query_args” filter, but I am not sure what to do.
That way, the Category part of the query would be filtered (thanks to the querystring parameters) before the widget processes the other checkboxes in the filterCan you give me some quick code on how to do it?
Thanks
March 1, 2021 at 4:09 pm #31868Ernest Marcinko
KeymasterWell, trying custom coding this is probably not something I recommend, so I would probably move to a single page if possible.
You can do preset the filter states though, this tutorial can help you with that.
Here you can also find some example for the asp_query_args filter. That one is to change the search arguments for the plugin. However in your case you want to change the arguments of the category archive page based on the query arguments of the search.
You could use theglobal $wp_query;variable within that filter, and then use the $args variable to replicate that within the$wp_query. That is not an easy task – as you have to detect which query is indeed the archive query, then pass all the arguments correctly.March 1, 2021 at 4:46 pm #31869yonahs61332
ParticipantI took a look at the “filter state” tutorial and my result is this long (and ugly) link:
https://www.pharmashaul.com/test-page/?p_asid=1&p_asp_data=1¤t_page_id=221&woo_currency=ILS&qtranslate_lang=0&filters_changed=1&filters_initial=0&aspf%5Bmorphology__2%5D%5B0%5D=Hybrid&aspf%5Bmorphology__2%5D%5B1%5D=Indica&aspf%5Bmorphology__2%5D%5B2%5D=Sativa&aspf%5Bcountry__3%5D%5B0%5D=Israel&aspf%5Bcountry__3%5D%5B1%5D=Canada&aspf%5Bgrower__4%5D%5B0%5D=Aphria%2FCanndoc&aspf%5Bgrower__4%5D%5B1%5D=Canndoc&aspf%5Bgrower__4%5D%5B2%5D=Organigram&aspf%5Bgrower__4%5D%5B3%5D=Peace%20Naturals%2FCronos&aspf%5Bgrower__4%5D%5B4%5D=Seach&aspf%5Bgrower__4%5D%5B5%5D=Teva%20Adir&aspf%5Bgrower__4%5D%5B6%5D=Univo&aspf%5B_price__5%5D%5Blower%5D=150.00&aspf%5B_price__5%5D%5Bupper%5D=300.00&asp_gen%5B%5D=title&customset%5B%5D=product&termset%5Bproduct_cat%5D%5B%5D=19Now, the only part of the link that I need is the Product Category number (19 here). The rest of the checkboxes are defined in the settings.
Can I use a shorter link to only define that one checkboxMarch 2, 2021 at 11:18 am #31885Ernest Marcinko
KeymasterI’m afraid probably not possible. You would have to compile mod_rewrite rules to resolve shorter URLs to this URL – which is insanely difficult, given these many arguments.
March 2, 2021 at 3:46 pm #31904yonahs61332
ParticipantOK, That is not a problem but the filter state is not working:
This is search id 1
The Console gives me this link:
https://www.pharmashaul.com/test-page/?p_asid=1&p_asp_data=1¤t_page_id=221&woo_currency=ILS&qtranslate_lang=0&filters_changed=1&filters_initial=0&aspf%5B_price__5%5D%5Blower%5D=0.00&aspf%5B_price__5%5D%5Bupper%5D=1000.00&asp_gen%5B%5D=title&customset%5B%5D=product&termset%5Bproduct_cat%5D%5B%5D=19When I load the page, I get results that include (Lemon Kush) which is not in that category (it is in T15 / C3). (this is the the link for T20/C5)
Comparing this to what happens when I load the page without any parameters it works fine. If I check off T20/C5 I get 7 results and T15/C3 gives me the 8th item
March 2, 2021 at 4:18 pm #31910Ernest Marcinko
KeymasterPlease check point 5) of the documentation link. That link only sets the filter states, but it does not trigger the search, so only the filters are set, but the results are the default from elementor. You need this:
var id=1; ASP.api(id, 'getStateURL')+'&asp_s=&asp_id='+id;That link variation should do it.
March 3, 2021 at 10:25 am #31933yonahs61332
ParticipantI have tried that and its still not working:
https://www.pharmashaul.com/test-page/?p_asid=1&p_asp_data=1¤t_page_id=221&woo_currency=ILS&qtranslate_lang=0&filters_changed=1&filters_initial=0&aspf%5B_price__5%5D%5Blower%5D=0.00&aspf%5B_price__5%5D%5Bupper%5D=1000.00&asp_gen%5B%5D=title&customset%5B%5D=product&termset%5Bproduct_cat%5D%5B%5D=17&asp_s=&asp_id=1This link when first loaded shows the correct 3 products that belong in the category, but if I then change the category in the filter on the right side. and remove T15/C3 and add T10//C2 only as in the attached image, i still get the 3 results from T15/C3 + the new one for T10/C2
(I have add a Category element to illustrate the problem on the page)Its as if the parameters in the Querystring are always applied even if I undo them in the filter on the page.
I only want the parameters to set the initial display, but after that the Filter should take overMarch 3, 2021 at 10:37 am #31936yonahs61332
Participantand just to clarify, when I do the same thing on a page with no parameter the filter works perfectly
March 3, 2021 at 11:16 am #31940Ernest Marcinko
KeymasterCan you please maybe try this variation?
var id=1; ASP.api(id, 'getStateURL').replace('?p_asid=', '?asp_ls=&p_asid=')+'&asp_s=&asp_id='+id;March 3, 2021 at 11:18 am #31942yonahs61332
ParticipantThat worked
Thanks
-
AuthorPosts
- You must be logged in to reply to this topic.