Page 1 of 3
Search in descriptions by default
Posted: Sat Aug 22, 2009 4:47 am
by amplifywebdesign
Hi would it be possible to make opencart search in descriptions by default? Also, is there a way to include the category in where it searches?
Thanks

Re: Search in descriptions by default
Posted: Sat Aug 22, 2009 12:13 pm
by readyman
To search descriptions by default - You can place a hidden field in the top search box similar to
<input type="hidden" name="description" value="1">
Do you want to search the categories? The category descriptions? Or do you just want to list them if they contain products in them the meet the search criteria (a bit pointless) Or did you just want to sort them by category?

Re: Search in descriptions by default
Posted: Sun Aug 23, 2009 2:10 am
by amplifywebdesign
Ah yes ofcourse! Thank you!
I just want to search in category names (although category descriptions would also be useful)
Cheers

Re: Search in descriptions by default
Posted: Sun Aug 23, 2009 2:55 am
by Qphoria
it doesn't search in category names or descriptions. It searches "product" names and descriptions
Re: Search in descriptions by default
Posted: Mon Aug 24, 2009 3:59 am
by amplifywebdesign
Yes I was wondering if I could search in category names or descriptions as well?
Also I'm having problems with this search in descriptions checkbox. I tracked down the search module to (hopefully) the template/product/search.tpl and I added this:
Code: Select all
<div id="seach_tab"><?php echo $search; ?><input type="hidden" name="description" id="description" checked="checked" /></div>
And it doesn't appear to work! Any help appreciated thanks!
Re: Search in descriptions by default
Posted: Mon Aug 24, 2009 5:07 am
by Qphoria
why not do exactly as readyman says?
change checked="checked" to value="1"
Re: Search in descriptions by default
Posted: Mon Aug 24, 2009 5:14 am
by amplifywebdesign
Qphoria wrote:why not do exactly as readyman says?
change checked="checked" to value="1"
Didn't see the value field
Re: Search in descriptions by default
Posted: Mon Aug 24, 2009 10:05 pm
by amplifywebdesign
Well I couldn't get it to work so I tried adding &description=1 onto the url.. and presto it worked
Just typing this for anyones future reference
Locate catalog/view/theme/{your-theme}/template/common/search.tpl
and replace the moduleSearch function with this:
Code: Select all
function moduleSearch() {
location = 'index.php?route=product/search&keyword=' + encodeURIComponent($('#filter_keyword').attr('value')) + '&description=1';
}
Thanks for the help all

Re: Search in descriptions by default
Posted: Sat Jul 24, 2010 11:15 pm
by daniel2008
readyman wrote:To search descriptions by default - You can place a hidden field in the top search box similar to
<input type="hidden" name="description" value="1">
Do you want to search the categories? The category descriptions? Or do you just want to list them if they contain products in them the meet the search criteria (a bit pointless) Or did you just want to sort them by category?

Hi readyman & Qphoria,
Please specify where to find the file related to the 'Top search box'.
Do you mean the file of search.tpl in the fold cataloge\view\theme\default\template\prodcut,
or there is another for the 'Top search box'?
If using 'hidden' type in the 'Top search box', will it have some impact on the Advance Search?
Thanks.
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 12:06 am
by funrider
I also try to turn on quick searching and advanced searching within both product description and product model. So i want both to be standard checked when searching in the header or the advanced search. When I now search it doesn't use the description search and model search as a standard. I think that would be very helpful if this was adjustable.
I tried looking for it in:
catalog/view/theme/default/template/product/search.tpl
but I'm not that good within such scripts where I need to change it. And what. I can't find the previous text from a year ago that was suggested in this topic within that file to turn it to value '1'. I use version 1.4.8b.
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 12:21 am
by preciousfoods
Hello, I apologize in advance as I don't really know where to post this :
I am absolutely new to opencart, I have purchased a nice flower template and now I wanted to made the changes in the admin panel but whatever I modify, anywhere, does not affect the storefront... I have to admit I am really perplex!
Can someone please help me out?..
thanks!
Kevin
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 12:46 am
by Moggin
Hi Kevin,
First, to help you out with using the forum:
1. To ask a question which does not follow on from a previous discussion, try and find a sub-forum which looks relevant, and post a new topic there (look for 'New Topic' button at the top). For example, this post probably belongs in 'Template Support'. Give it a good title (Bad choice: 'Help!!!' Good choice: 'Where is the place to edit xyz' ) LOL
2. OK...you have a template, but nothing affects the storefront? Do you mean you have uploaded the template correctly, but you're still seeing the default? If so, the template needs to be selected in the admin panel: System > Settings> Store >Template.
But - if that's not the problem - please post again!
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 1:02 am
by preciousfoods
thank you so much, how can I move this post to template support please?
yes, the maker of the template said it was correctly installed after looking on my admin panel, but it doesn t appear in System > Settings> Store >Flower Template!
What did I do wrong?
thanks!
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 3:23 am
by funrider
Moggin or anyone else any idea how to solve the search issue that I and another person discussed in this topic?
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 3:57 am
by preciousfoods
is there some kind of a "move topic" function?
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 3:58 am
by Moggin
funrider wrote:Moggin or anyone else any idea how to solve the search issue that I and another person discussed in this topic?
Sure, funrider - luckily, this is very easy. See this post by Qphoria:
Re: Search Engine search descriptions by default- and see Q's post on the same page to search model as well. It's just a line of code or so.
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 4:08 am
by Moggin
preciousfoods wrote:is there some kind of a "move topic" function?
Only the mods can move postings. And if you post the same topic elsewhere you get eaten for double posting

let's keep going for the moment..
So, when you go to settings > store, the only thing that appears in the template dropdown is the default?
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 4:33 am
by funrider
Thank you for linking to that other post. I hadn't seen that one in the search. That solved the problem for the header (header.tpl changes) search and I also adjusted the advanced search (search.tpl) by adding also in the first line
checked="checked":
Code: Select all
<input type="checkbox" name="description" id="description" checked="checked" />
<?php } else { ?>
<input type="checkbox" name="description" id="description" checked="checked" />
Code: Select all
<input type="checkbox" name="model" id="model" checked="checked" />
<?php } else { ?>
<input type="checkbox" name="model" id="model" checked="checked" />
Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 6:23 am
by preciousfoods
thank you for replying again... yes, there is only default

Re: Search in descriptions by default
Posted: Mon Jul 26, 2010 11:21 pm
by preciousfoods
Could someone please give me some advice, I have to admit I'm not too sure about how to proceed

thanks!