Hi,
I am using Magento 2, CE 2.4
I have the problem that I would like to add a text on top of the product listing depending on what has been selected in the Layered Navigation.
I am half-way succeeding, but the text appears only after reloading the page. The Layered Navigation changes the page in the background and my code doesn't catch this event.
Is there a hook that can be applied somewhere to catch any select-event that happens on the Layered Navigation?
An example to compare Search and Layered Navigation:
- If you search for a option - say "digital", then the URL will change to something like
domain.com/catalogsearch/result/?q=digital
and the whole page is reloading.
I can catch this in my Vendor/Theme/Magento_Catalog/templates/product/list.phtml
and get my text to show accordingly
- If I select the term "digital" in a drop-down of the Layered Navigation, then the URL will change to something like
domain.com/shop/?system=digital
but only the items are reloading - not the whole page
My code is therefore not able to catch this change and text is not showing
If I reload the page, then my code "sees" the string in the URL and my text is displayed.
--> how can I catch this event the without having to reload the page?
Thanks for any help on this.