I'm trying to custom the default Magento 2 search engine. I would like to automatically redirects to the product page when search returns only one result. I tried to override the Result/Index controller but nothings worked.
Thanks for your help !
I'm trying to custom the default Magento 2 search engine. I would like to automatically redirects to the product page when search returns only one result. I tried to override the Result/Index controller but nothings worked.
Thanks for your help !
You need to use the configuration, no need to devellop anything additionnal. Here is a link to a good resource : https://www.magestore.com/magento-2-tutorial/how-to-manage-search-term-in-magento-2/
If you really need to redirect programmatically, I advise you to use dependency injection more than override.