I have a zencart website,currently i need customer to search tile first because it will get lots of result if search product description also.SO i change 'search_in_description', to "0",what should i do if i need it search in product description automatically if no result get from title search?
$content = "";
$content .= zen_draw_form('quick_find_header', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get');
$content .= "<span>Search: </span>";
$content .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
$content .= zen_draw_hidden_field('search_in_description', '0') . zen_hide_session_id();
if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {
$content .= zen_draw_input_field('keyword', '', 'size="6" maxlength="120" class="search-header-box" value="' . HEADER_SEARCH_DEFAULT_TEXT . '" onfocus="if (this.value == \'' . HEADER_SEARCH_DEFAULT_TEXT . '\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'' . HEADER_SEARCH_DEFAULT_TEXT . '\';"') . '' . zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
} else {
$content .= zen_draw_input_field('keyword', '', 'size="6" class="search-header-box" maxlength="120" value="' . HEADER_SEARCH_DEFAULT_TEXT . '" onfocus="if (this.value == \'' . HEADER_SEARCH_DEFAULT_TEXT . '\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'' . HEADER_SEARCH_DEFAULT_TEXT . '\';"');
}
$content .= zen_draw_pull_down_menu('categories_id', $categories_array,'','class="select" id="light_select"');
$content .= "</form>";
?>
It's not in the template file (what you're showing). The change should be in includes/modules/pages/advanced_search/header_php.php.
Using version 1.5.5e line numbers:
Below line 463
You want to rerun the query, but with search in product description enabled.
Here's how I would do that. After the if block from line 330 ends at line 335, I'd put in an extra clause that would never trigger, like:
Then down on line 463, when the original search fails, replace "1=0" with the product description search logic
Then use
str_replaceto change1=0to$new_strand rerun the queryby callingsplitPageResultsagain.