Post by ggillotte » Thu Jul 05, 2012 8:41 am

kylehamilton wrote:In version 1.5.1 it's in the common.js file:

/catalog/view/javascript/common.js

in the first two functions (see comments):

/* Search */
$('.button-search').bind('click', function() {
url = 'index.php?route=product/search';
url += '&filter_description=true'; // add this to search descriptions
url += '&filter_sub_category=true'; // add this to search sub-categories


var filter_name = $('input[name=\'filter_name\']').attr('value')

if (filter_name) {
url += '&filter_name=' + encodeURIComponent(filter_name);
}

location = url;
});

$('#header input[name=\'filter_name\']').keydown(function(e) {
if (e.keyCode == 13) {
url = 'index.php?route=product/search';
url += '&filter_description=true'; // add this to search descriptions
url += '&filter_sub_category=true'; // add this to search sub-categories


var filter_name = $('input[name=\'filter_name\']').attr('value')

if (filter_name) {
url += '&filter_name=' + encodeURIComponent(filter_name);
}

location = url;
}
});
Thanks Kyle!
Worked great for me using 1.5.3.1

Zmodo DVRs, CCTV Cameras, and Video Surveillance Kits
http://www.zmodowarehouse.com


Newbie

Posts

Joined
Thu Jul 05, 2012 8:39 am

Post by sleeppro » Wed Aug 01, 2012 3:27 am

wont work for me in 1.5.1.3 either. Darn.

Newbie

Posts

Joined
Fri Jul 13, 2012 4:53 am

Post by Sebcart » Fri Feb 08, 2013 7:31 pm

@ sleeppro; just adding the pink code didn't work for me either (on 1.5.4), replacing the whole /* Search */ section did..

New member

Posts

Joined
Sat Sep 08, 2012 11:25 pm

Post by raiderek » Sat Feb 09, 2013 11:57 pm

I also tried modifying common.js as described before to add "&filter_description=true" to the url with no success, I'm using opencart 1.5.4.1, even replaced the whole "Search" section but nothing happens. Could anybody help me whit this please. I'm not using the default theme but I don't know if that matters.

Thanks in advance.

EDIT: My template uses i'ts own JS file for search, the method described works 100%

Newbie

Posts

Joined
Mon Jul 02, 2012 11:03 pm

Post by Gamesol » Fri Jul 19, 2013 9:30 pm

Qphoria wrote:1. EDIT: catalog/view/theme/YOURTHEME/template/common/header.tpl

2. FIND:

Code: Select all

location = url;
3. BEFORE ADD:

Code: Select all

url += '&description=1';

Er, am I missing something ? Cant find this code in 1.5.5.1

User avatar
New member

Posts

Joined
Fri May 31, 2013 5:34 pm

Post by bountico » Tue Dec 03, 2013 6:46 am

I also cannot get this the catalog/view/javascript/common.js edit to work in 1.5.5. I have tried replacing the entire /* Search */ section as well as simply adding the code in. Has OpenCart changed in this version? Does the code need to be changed anywhere else?

Thanks in advance!

Newbie

Posts

Joined
Thu Jun 20, 2013 5:32 am

Post by estidecalisse » Wed Dec 04, 2013 6:06 am

in version 1.5.5.x, the filters have changed names..

you can simply replace the two sames lines as with previous version (the one with "url =") with:

in /catalog/view/javascript/common.js:

Code: Select all

url = $('base').attr('href') + 'index.php?route=product/search&description=true&sub_category=true';
so the new filters are: description=true and sub_category=true

you can see this works on my site at http://www.inkclub.ca

Newbie

Posts

Joined
Wed Dec 04, 2013 6:02 am

Post by bountico » Sat Dec 07, 2013 1:57 am

Thank you estidecalisse. I really appreciate your time. Had to do the amendment on my own theme file js (for those of you reading this in the future). It's only one line of code there but the exact same as mentioned above.

Thanks again! - This is now working on http://eltawebstore.com

Newbie

Posts

Joined
Thu Jun 20, 2013 5:32 am

Post by Playoon » Sun Apr 06, 2014 7:44 pm

Can anyone help me with how to get this working on Version 1.5.6 please, I have changed the common.js file uploaded, cleared cache but search is still not checking product descriptions, yet if I add the code in manually into the URL it yields the results I want.

It seems making changes to the common.js file are not accepted. Cache is cleared too.

what else can I do?

Newbie

Posts

Joined
Sun Apr 06, 2014 7:41 pm

Post by Cue4cheap » Tue Apr 08, 2014 5:36 am

I followed the same instructions as above, and I use 1.5.6 and it works for me.

Mike

cue4cheap not cheap quality


Active Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by nettemor » Tue Apr 08, 2014 2:54 pm

Thank you estidecalisse,

I am using Joomla with mijoshop and your solution above works perfect at 1.5.5.1

Newbie

Posts

Joined
Fri Apr 04, 2014 9:13 pm

Post by andriuspp » Thu Nov 27, 2014 9:42 pm

Can anybody say how to do this on opencart version 2.0 ? Thank you..

Newbie

Posts

Joined
Thu Nov 27, 2014 9:41 pm

Post by andriuspp » Thu Nov 27, 2014 10:10 pm

can anyone help how to do this on opencart 2.0 version?

Newbie

Posts

Joined
Thu Nov 27, 2014 9:41 pm

Post by hebiki » Fri Jan 16, 2015 4:18 am

For version 2.0.1.1...
edit file: catalog/view/javascript/common.js

find this code: around line 71

Code: Select all

url += '&search=' + encodeURIComponent(value);
and replace with this:

Code: Select all

url += '&search=' + encodeURIComponent(value) + '&description=true';  //add a comment
i always add a comment after so i can do a search for it later on if i do an upgrade. hope this helps!

New member

Posts

Joined
Sun Oct 10, 2010 4:00 pm

Post by andriuspp » Mon Jan 19, 2015 2:13 pm

Thank you! working :)

Newbie

Posts

Joined
Thu Nov 27, 2014 9:41 pm

Post by mdziwuls » Sat Aug 15, 2015 5:03 am

For opencart 2.0 to have search work by category, can you use that same line but change 'description' to Category?

Thanks!

Newbie

Posts

Joined
Thu Jul 02, 2015 8:22 am
Who is online

Users browsing this forum: No registered users and 36 guests