Close

Conditional Filters - Show filter #3 and #4 when a option in #1 or #2 is selected

ChrisKaun
6 years ago
#13826 Quote
Avatar
  • 9
Hey, lets say I have four filter options. On start I only want to display #1 and #2 of those filter options. If a filter in #1 or #2 is selected filter #3 and #4 should dropdown.
It should still be possible for the user to open filter #3 and #4 manually, even if there is no filter in #1 or #2 selected.
Is this in any way possible?
Boyko
6 years ago
#13829 Quote
Avatar
  • Moderator
  • 1570
ChrisKaun wrote:
Hey, lets say I have four filter options. On start I only want to display #1 and #2 of those filter options. If a filter in #1 or #2 is selected filter #3 and #4 should dropdown.
It should still be possible for the user to open filter #3 and #4 manually, even if there is no filter in #1 or #2 selected.
Is this in any way possible?


Hi ChrisKaun,

I am not sure what exactly you mean by filter option. Is it an attribute filter i.e Color or the specific filter options that are i.e Red, Blue etc.
Can you give a better example with some of the existing pages where we already have Ajax Filters (using some of our demo stores).
Regards,
Nop-Templates.com Team
ChrisKaun
6 years ago
#13841 Quote
Avatar
  • 9
Hey,
example of our shop (https://shop.lundp.de/tinte-toner.
We sell printer catridges but not every catridge is available for every printer.
We want to close the filter options for "Füllmenge" and "Farbe" on page load. When the customer picks any filter in the "Druckertyp" option, we want to unfold "Füllmenge" and "Farbe".
We will soon have ~50+ attribute values in "Füllmenge", thats why we first want the customer to select a printer so that the number of "Füllmenge" values that can be picked is reduced.
Boyko
6 years ago
#13842 Quote
Avatar
  • Moderator
  • 1570
ChrisKaun wrote:
Hey,
example of our shop (https://shop.lundp.de/tinte-toner.
We sell printer catridges but not every catridge is available for every printer.
We want to close the filter options for "Füllmenge" and "Farbe" on page load. When the customer picks any filter in the "Druckertyp" option, we want to unfold "Füllmenge" and "Farbe".
We will soon have ~50+ attribute values in "Füllmenge", thats why we first want the customer to select a printer so that the number of "Füllmenge" values that can be picked is reduced.


Hi ChrisKaun,

There is no such functionality out of the box so you will have to make some customization to have it working this way. You can hide the two options by default with css and show them only when the client selects "Druckertyp".
Regards,
Nop-Templates.com Team
ChrisKaun
6 years ago
#13854 Quote
Avatar
  • 9
Any hints how to achieve this?
I would write some javascript to remove the "closed" class when a list-item is checked. Is there any event that I can use from ajax filters in my script?
Boyko
6 years ago
#13867 Quote
Avatar
  • Moderator
  • 1570
ChrisKaun wrote:
Any hints how to achieve this?
I would write some javascript to remove the "closed" class when a list-item is checked. Is there any event that I can use from ajax filters in my script?


Hi ChrisKaun,

Yes, there is an event after each filtration that you can use:

nopAjaxFiltersFiltrationCompleteEvent

Hope this helps!
Regards,
Nop-Templates.com Team
ChrisKaun
6 years ago
#13895 Quote
Avatar
  • 9
Hey,
I'm still struggling with this.
I tried to add the 'closed' class to those toggleControl via javascript but adding/removing this class does not trigger the hide/show effect of the filter.
How can I achieve this?
Boyko
6 years ago
#13901 Quote
Avatar
  • Moderator
  • 1570
ChrisKaun wrote:
Hey,
I'm still struggling with this.
I tried to add the 'closed' class to those toggleControl via javascript but adding/removing this class does not trigger the hide/show effect of the filter.
How can I achieve this?


Hi ChrisKaun,

I believe you want to completely hide the two panels until the client selects something from the first filters. You can simply hide the two panels with css as I suggested i.e set the style to be "display:none" directly in the css or Custom Head styles in the administration. Then after the filtration you can set "display:block" to those two panels and they will appear.
Regards,
Nop-Templates.com Team