Doubt about preselected subcategory on archive page and problem

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Doubt about preselected subcategory on archive page and problem

This topic contains 22 replies, has 2 voices, and was last updated by jordi82 jordi82 3 years ago.

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #31657
    jordi82
    jordi82
    Participant

    Hi!

    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!

    #31658
    jordi82
    jordi82
    Participant
    You cannot access this content.
    #31672
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31682
    jordi82
    jordi82
    Participant
    You cannot access this content.
    #31692
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31720
    jordi82
    jordi82
    Participant
    You cannot access this content.
    #31726
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Indeed, 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31728
    jordi82
    jordi82
    Participant

    Hi 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!

    #31729
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Opps, 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31730
    jordi82
    jordi82
    Participant

    Hi 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

    #31732
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Because 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #31998
    jordi82
    jordi82
    Participant

    Hi 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!

    #32004
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Great!

    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?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #32008
    jordi82
    jordi82
    Participant

    Sure!

    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.

    #32009
    jordi82
    jordi82
    Participant

    I 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.

Viewing 15 posts - 1 through 15 (of 23 total)

You must be logged in to reply to this topic.