Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Doubt about preselected subcategory on archive page and problem
- This topic has 22 replies, 2 voices, and was last updated 5 years, 1 month ago by
jordi82.
-
AuthorPosts
-
February 18, 2021 at 12:01 pm #31657
jordi82
ParticipantHi!
I have a doubt with your plugin. As you can see on my site https://web-temp.es/ecocesta/, I have a drop-down megamenu, which when you hover on “Productos” and click on “Alimentación” takes you to a portfolio of articles (custom post type created by me).
Well, my question is if there is any way to make when you click on a subcategory (“Aceites, especias y salsas”) for example, it takes you to the same portfolio but with that subcategory selected. That is, if I click on the global category “Alimentación”, the portfolio will load me showing all the products. But if I click on a subcategory, let it load that portfolio with the preselected subcategory.For the other hand I have another problem with the logic of the filters.
For some reason, when in the settings I select that the checkboxes appear unmarked by default, it does not work correctly and they appear marked, making the option “all of the selected terms must match EXACTLY”, not working correctly. Since you need the checkboxes not to start selected.
I hope you can help me with this 🙂
Many thanks and regards!
February 18, 2021 at 12:02 pm #31658jordi82
ParticipantYou cannot access this content.
February 18, 2021 at 5:45 pm #31672Ernest Marcinko
KeymasterHi,
It is actually possible to get pre-selected configurations with a single search. I will reference this reply for your case.
It is actually possible to preset the fields via this API call.
In short:
1. You open the developer console on each page where the search is present, for example https://web-temp.es/ecocesta/productos-ecologicos/alimentacion/ page, on most browsers it is the F12 button.
2. Change the filter states however you want them – check/uncheck the checkboxes etc..
3. Now, getting the state URI. Your search ID for that search bar is 1, so you type in to the console:ASP.api(1, 'getStateURL')and it will print out the page URL with some query arguments: https://i.imgur.com/Jdcekk7.png
4. Visiting that URL will preset the filters exactly as you changed them before. Use this for your desired button as the URL.
5. You can repeat this proces as many times as you want with as many different variations you need.As for the checkbox issue, I cannot tell, I tried to log-in, but I can’t access that site back-end unfortunately.
February 19, 2021 at 10:52 am #31682jordi82
ParticipantYou cannot access this content.
February 19, 2021 at 3:14 pm #31692Ernest Marcinko
KeymasterThank you, now I could log in 🙂
The reason they don’t appear unchecked is because you have manually selected some, and the checkbox states in the selection override that: https://i.imgur.com/n78tzD7.png
If you uncheck that, it will resolve that.The missing results are due to the other two options: https://i.imgur.com/MPchceC.png
Those are actually post categories, and are not defined for the post type you are searching (articulos). So selecting either of them will yield no results, as nothing matches either of them.February 22, 2021 at 10:33 am #31720jordi82
ParticipantYou cannot access this content.
February 22, 2021 at 1:28 pm #31726Ernest Marcinko
KeymasterIndeed, sorry about that, I didn’t notice.
I believe I found the issue, it was this option. It was disabled, so the unselected boxes were still taken into consideration (it overrides the logic).
I believe it should be okay now.February 22, 2021 at 1:55 pm #31728jordi82
ParticipantHi Ernest,
It works! but it cause that now when I click on “Alimentación” on my menu, all my “Artículos” appear, regardless of the category that they have.
It may be that I have to change something in the settings? I’ts strange because before it dind’t happen
Regards!
February 22, 2021 at 1:57 pm #31729Ernest Marcinko
KeymasterOpps, sorry, I may have enabled auto populate for testing, I am not sure if you had that feature enabled. Try turning that off, I think that is it.
February 22, 2021 at 2:06 pm #31730jordi82
ParticipantHi Ernest
That is 🙂
·But when I turning off that option, now when I click on any subcategory, it appears selected but it does not perform the search 🙁 hahaha
February 22, 2021 at 2:12 pm #31732Ernest Marcinko
KeymasterBecause that option triggers the search initially. Without that the options are selected, but not actually triggered (to replace the items in the elementor widget). Without that only the default items in the elementor widgets are displayed.
March 4, 2021 at 3:41 pm #31998jordi82
ParticipantHi Ernest,
First apologies for not answering earlier, I’ve been quite busy…
Regarding what we talked about earlier, it works! Thanks a lot 🙂
But now it turns out that I have another problem. For some reason, for checkboxes there is no option to “see all categories”, so what I do is show the parent category at the beginning (“Alimentación”).
The problem is that when I click on a child category, these articles also have the parent category, so then all of them are shown … Is there a way to bypass that parent category once a child category is clicked?
I hope I have explained myself well
Regards!
March 4, 2021 at 4:19 pm #32004Ernest Marcinko
KeymasterGreat!
The problem is that when I click on a child category, these articles also have the parent category, so then all of them are shown … Is there a way to bypass that parent category once a child category is clicked?
I think I don’t fully understand that. Can you give me an example?
March 4, 2021 at 4:33 pm #32008jordi82
ParticipantSure!
If you enter in my site https://web-temp.es/ecocesta/ and hover on “Productos” and click on Alimentación, it filter all my products with parent category Alimentación, but if you filter then f.e “Aceites, especias y salsas” it should show only the Products with this subcategory, but show all because these products also have the parent category Alimentación.
March 4, 2021 at 4:36 pm #32009jordi82
ParticipantI have also noticed that the results of the filters vary depending on whether in the mega menu I click on one subcategory or another.
You can do the test by going to the mega menu and clicking on “Aceites, especias y salsas”, and once the web is loaded, filter with the radio buttons.
And then do the same but clicking on “Legumbres, Pasta y semillas”, and filter with radio buttons. You will see that the result of the filters is different.
-
AuthorPosts
- You must be logged in to reply to this topic.