Post by knight_47 » Tue Jun 24, 2014 12:29 am

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!
Last edited by knight_47 on Wed Jun 25, 2014 7:37 am, edited 3 times in total.

New member

Posts

Joined
Fri Mar 11, 2011 2:45 pm

Post by OSWorX » Tue Jun 24, 2014 12:59 am

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.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by knight_47 » Tue Jun 24, 2014 1:04 am

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.

New member

Posts

Joined
Fri Mar 11, 2011 2:45 pm

Post by OSWorX » Tue Jun 24, 2014 1:30 am

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.

Code: Select all

TypeError: what is undefined
(not displaying results must not belong to this script, but can .. )
I have used iSleep for example.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by knight_47 » Tue Jun 24, 2014 1:42 am

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.

Code: Select all

TypeError: what is undefined
(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?
Last edited by knight_47 on Wed Jun 25, 2014 7:39 am, edited 1 time in total.

New member

Posts

Joined
Fri Mar 11, 2011 2:45 pm

Post by OSWorX » Tue Jun 24, 2014 4:10 am

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).

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by knight_47 » Tue Jun 24, 2014 7:57 am

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?

New member

Posts

Joined
Fri Mar 11, 2011 2:45 pm

Post by OSWorX » Tue Jun 24, 2014 6:08 pm

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

Code: Select all

$url .= '&search=
to

Code: Select all

$url .= '&filter_name=
As far as I can remember the URL changed somewhere in the past.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by knight_47 » Wed Jun 25, 2014 12:14 am

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! :(

New member

Posts

Joined
Fri Mar 11, 2011 2:45 pm

Post by knight_47 » Wed Jun 25, 2014 7:04 am

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!

New member

Posts

Joined
Fri Mar 11, 2011 2:45 pm
Who is online

Users browsing this forum: No registered users and 29 guests