Page 1 of 1
Search feature not working
Posted: Tue Jun 24, 2014 12:29 am
by knight_47
Hello, I'm having a certain issue with the search feature on my install. The top search bar on the site doesn't work, anytime you put anything in there it returns with no results. But if you enter your keyword on the results page and search again it works fine. Any idea how to remedy this?
Link removed
If you search at the top of the page, it returns no results, but if you search again on the results page using the advanced search it seems to work fine.
Any help would be greatly appreciated!
Re: Search feature not working
Posted: Tue Jun 24, 2014 12:59 am
by OSWorX
If you expect to get some help, you should provide details like:
1. which version of OpenCart
2. which template is in use
3. use modifications, if - which
As far as I can see, you have a lot of errors.
To test I would disable the Step-carousel script and see if works afterwards.
Re: Search feature not working
Posted: Tue Jun 24, 2014 1:04 am
by knight_47
OSWorX wrote:If you expect to get some help, you should provide details like:
1. which version of OpenCart
2. which template is in use
3. use modifications, if - which
As far as I can see, you have a lot of errors.
To test I would disable the Step-carousel script and see if works afterwards.
sorry for the lack of details.
i'm running OP 1.5.6, using
this template, I've reached out to them multiple times but haven't gotten any responses unfortunately.
No user modifications other than some css changes.
what makes you say there are lots of errors?
Thanks again.
edit: the carousel module is disabled already (installed but disabled), and I just disabled the Latest module to see if that would yield anything different but same results.
Re: Search feature not working
Posted: Tue Jun 24, 2014 1:30 am
by OSWorX
knight_47 wrote:the carousel module is disabled already (installed but disabled), and I just disabled the Latest module to see if that would yield anything different but same results.
But there are still errors coming from:
Step Carousel Viewer when using the global search.
(not displaying results must not belong to this script, but can .. )
I have used iSleep for example.
Re: Search feature not working
Posted: Tue Jun 24, 2014 1:42 am
by knight_47
OSWorX wrote:knight_47 wrote:the carousel module is disabled already (installed but disabled), and I just disabled the Latest module to see if that would yield anything different but same results.
But there are still errors coming from:
Step Carousel Viewer when using the global search.
(not displaying results must not belong to this script, but can .. )
I have used iSleep for example.
Is there anything I can do to test to see if the carousel is the issue?
Re: Search feature not working
Posted: Tue Jun 24, 2014 4:10 am
by OSWorX
This script is not part of the standard.
Seems to be embedded in the template you are using.
Guess you have to edit the template (header.tpl) manually and disable it - if it is not to configure as module (see backend menu Extensions > Module).
Re: Search feature not working
Posted: Tue Jun 24, 2014 7:57 am
by knight_47
OSWorX wrote:This script is not part of the standard.
Seems to be embedded in the template you are using.
Guess you have to edit the template (header.tpl) manually and disable it - if it is not to configure as module (see backend menu Extensions > Module).
Hm.. Thanks for the tip, but it still doesn't seem to be working, I removed this line from the header.tpl for the theme.
Code: Select all
<script type="text/javascript" src="catalog/view/javascript/jquery/stepcarousel.js"></script>
Search still seems to be off at the top.
Thanks. Any other ideas?
edit: it seems the url at the top changes from which search you use. the one at the top yields:
Code: Select all
http://www.abmedsupply.com/index.php?route=product/search&search=cpap
While the advanced search results in:
Code: Select all
http://www.abmedsupply.com/index.php?route=product/search&filter_name=cpap
with a difference in the very end of the URL @serch or @filter_name. Is there any way to change the code for the top search to render as @filter_name rather than @search?
Re: Search feature not working
Posted: Tue Jun 24, 2014 6:08 pm
by OSWorX
To change the URL you have to edit the controller
Code: Select all
../catalog/controller/product/search.php
around the lines from 350
and change
to
As far as I can remember the URL changed somewhere in the past.
Re: Search feature not working
Posted: Wed Jun 25, 2014 12:14 am
by knight_47
All I was able to find was was this in catalog/view/theme/OPC040095/template/product/search.php
Code: Select all
$('#button-search').bind('click', function() {
url = 'index.php?route=product/search';
var search = $('#content input[name=\'search\']').attr('value');
if (search) {
url += '&search=' + encodeURIComponent(search);
}
var category_id = $('#content select[name=\'category_id\']').attr('value');
if (category_id > 0) {
url += '&category_id=' + encodeURIComponent(category_id);
}
var sub_category = $('#content input[name=\'sub_category\']:checked').attr('value');
if (sub_category) {
url += '&sub_category=true';
}
var filter_description = $('#content input[name=\'description\']:checked').attr('value');
if (filter_description) {
url += '&description=true';
}
location = url;
});
I changed
Code: Select all
url += '&search=' + encodeURIComponent(search);
to
Code: Select all
url += '&filter_name=' + encodeURIComponent(search);
hoping it would work but same results. So close I thought that would have done it!

Re: Search feature not working
Posted: Wed Jun 25, 2014 7:04 am
by knight_47
I was able to fix it! Finally! In case anyone was wondering in the future.
I had to edit catalog\view\javascript\
common.js
Changed this:
Code: Select all
url += '&search=' + encodeURIComponent(search);
to
Code: Select all
url += '&filter_name=' + encodeURIComponent(search);
and it worked!
I would not have been able to do without your kind help OSWorx. Thanks for your help and time!