A
A
Andrey2021-12-22 09:26:18
JavaScript
Andrey, 2021-12-22 09:26:18

Why is opencart search not working?

I can’t find the reason, the search in the header on the site
doesn’t work somewhere in js, but I just can’t understand why, when entering a search phrase, it doesn’t transfer to the search result, that is
, when you press the search button or enter, it leads to an empty search page,
although , if you enter a query on the search page below, in a different form, everything works
here is the default template search.tpl

<div id="search" class="input-group">
  <input type="text" name="search" value="<?php echo $search; ?>" placeholder="<?php echo $text_search; ?>" class="form-control input-lg" />
  <span class="input-group-btn">
    <button type="button" class="btn btn-default btn-lg"><i class="fa fa-search"></i></button>
  </span>
</div>

here is common.js
$("#form-language").submit()}),$("#search input[name='search']").parent().find("button").on("click",function(){var a=$("base").attr("href")+"index.php?route=product/search",b=$("input[name='search']").val();b&&(a+="&search="+encodeURIComponent(b));var c=$("select[name='category_id']").val();c>0&&(a+="&category_id="+encodeURIComponent(c),a+="&sub_category=true"),location=a}),$("#search input[name='search']").on("keydown",function(a){13==a.keyCode&&$("input[name='search']").parent().find("button").trigger("click")}),


who can tell?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kollins, 2021-12-22
@klekovkinandrey

You have two search forms on your site with the same id and name. On the desktop version, when searching, the first one is sent (for mobile)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question