Search Field Issue
11 posts by 3 authors in: Forums > CMS Builder
Last Post: July 14, 2011 (RSS)
By dccreatives - June 16, 2011
All my products are associated with a brand. I want the search results to go to my brandsList.php page and I want the keyword search to search the brand that they type in. This is my sample code which is not working.
<form method="POST" action="brandsList.php" class="searchForm">
<td height="49" valign="top"><input name="name_brand" type="text" value="" class="field" id="search" /></td>
<td height="49" valign="top"><input name="submit" type="image" value="SUBMIT FORM" src="images/button-go.jpg" border="0"></td>
</form>
Re: [dccreatives] Search Field Issue
By Jason - June 16, 2011
You can do this by adding _keyword to an input field that has the same name as the field you want to search.
So, assuming your brand field in your section is called "name_brand" you can use a field like this:
<td height="49" valign="top"><input name="name_brand_keyword" type="text" value="" class="field" id="search" /></td>
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Search Field Issue
By dccreatives - July 12, 2011
I have a product called Sushi Wall. Some resellers call it SUW. I added to the search_words field, SUW, sushi for this product. Now how do I add it to the current search code?
<input name="name_keyword" type="text" value="" class="field" id="search" />
I tried this: <input name="name_keyword, search_words_keyword" type="text" value="" class="field" id="search" /> but it did not work.
Any suggestions?
Re: [dccreatives] Search Field Issue
By Dave - July 12, 2011
Try replacing this:
<input name="name_keyword, search_words_keyword" type="text" value="" class="field" id="search" />
With this (spaces and first "_keyword" removed):
<input name="name,search_words_keyword" type="text" value="" class="field" id="search" />
Let me know if that works for you.
interactivetools.com
Re: [Dave] Search Field Issue
By dccreatives - July 12, 2011
I get all products when I replaced the input field.
Re: [dccreatives] Search Field Issue
By Jason - July 12, 2011
Can you use the
'debugSql' => true,
option so that we can see what the actual query is?
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [dccreatives] Search Field Issue
By Dave - July 12, 2011
interactivetools.com
Re: [Dave] Search Field Issue
By dccreatives - July 13, 2011
// remove white space
if (@$_REQUEST['name_keyword']) {
$_REQUEST['name_keyword'] = str_replace(" ", "", $_REQUEST['name_keyword']);
}
list($itemsRecords, $itemsMetaData) = getRecords(array(
'tableName' => 'items',
'where' => "REPLACE(name, ' ', '') LIKE '%".mysql_escape(@$_REQUEST['name_keyword'])."%'",
//'debugSql' => true,
'allowSearch' => false,
'limit' => '45',
));
I think I need to add the 'search_words' field as well to these statements in order for it to work not just the name_keyword.
How do I do this?
Re: [dccreatives] Search Field Issue
By Jason - July 13, 2011
If search_words has the name in a number of different formats (including without spaces), then you can remove the code that remove white spaces, and turn on automatic searching like this:
list($itemsRecords, $itemsMetaData) = getRecords(array(
'tableName' => 'items',
'limit' => '45',
));
That should do the search for you.
Hope this helps
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] Search Field Issue
By dccreatives - July 14, 2011
Thanks