javascript - OpenCart: Search no longer works after repositioning -


i designing own template making changes default template code of opencart 2.0.2.0. after repositioning search field, no longer works: not submit on pressing enter, , search value not submitted in url when clicking search button in form (the form submits though).

in order try , find goes wrong when relocating input field, have made fresh installation of opencart on wampsever, , without changing else, moved input field main nav, right after categories ul -- copying php tag prints search template:

<?php echo $search; ?> 

nothing else. form submits on pressing enter on keyboard, , submits on clicking search button, search parameter no longer appended url, e.g.

http://localhost/opencart/index.php?route=product/search&search=macbook 

i need find out why happens , how can move search field without losing functionality. suppose javascript related not sure how.

to answer own question: yes, javascript related. since search input field not wrapped in , in order submit it, , search query, 2 jquery functions have been written (in catalog/view/javascript/common.js, lines 64-81). these functions search input value first referencing within input located:

[line 68]

var value = $('header input[name=\'search\']').val(); 

[line 79]

$('header input[name=\'search\']').parent().find('button').trigger('click'); 

to make work, had replace 2 instances of "header" id of menu:

var value = $('#menu input[name=\'search\']').val(); 

sorted then! hope helps other opencart beginner myself :)


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -