doulu1867 2017-10-11 21:24
浏览 92

Magento 2 - 如果只有一个结果,则重定向搜索

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 !

  • 写回答

2条回答 默认 最新

  • dousui3124 2017-10-12 12:50
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型