2

I seem to be having some issue regarding moving the search bar anywhere else than its original .twig file. I have moved the code needed to load it in but whenever you search you for one cannot press enter on search and it will not allow me to search any of the existing items.

Code added to menu.php

$data['search'] = $this->load->controller('common/search');
freedomn-m
  • 27,664
  • 8
  • 35
  • 57
Jermain
  • 41
  • 4

1 Answers1

3

This is JavaScript (jQuery) issue.

Open /catalog/view/javascript/common.js

Find

$('#search input[name=\'search\']').on('keydown', function(e) {
  if (e.keyCode == 13) {
    $('header #search input[name=\'search\']').parent().find('button').trigger('click');
  }
});

Replace with

$('#search input[name=\'search\']').on('keydown', function(e) {
  if (e.keyCode == 13) {
    $('#search input[name=\'search\']').parent().find('button').trigger('click');
  }
});

I just removed header from jQuery selector. In your browser press Crtl + F5 (Chrome or FF) to reload the page with cache cleaning. Should work.

focus.style
  • 6,612
  • 4
  • 26
  • 38
  • Awesome that seemed to have worked. At first we still had the issue with searches not returning anything but we figured out we had to do the same with the code presented above your recommended fix for this issue. Thanks allot! – Jermain Sep 01 '20 at 08:35