Hey Community!
I am trying do expand the advanced search feature so that it is capable of searching custom fields and tables i added to the database. I created some extra database tables that hold extra information about products by using this how to:
http://www.zen-cart.com/forum/showthread.php?t=120523
now i have - let`s say - one field called "class_of_absorbtion" in a table called "products_extra_stuff" and of course a products_id field in that same table so the extra information can be allocated easily to the product.
I figured out how to insert the field in the search tpl by editing:
/includes/templates/my_template/templates/tpl_advanced_search_default.php
i added this code to /tpl_advanced_search_default.php to generate a dropdown with the options from the database:
and this where the form and the dropdown is created<?php
$absorbtion_array = array(array('id' => '', 'text' => TEXT_NONE));
$abso = $db->Execute("select id, absorbtionclass from " . TABLE_ABSO . " order by id");
while (!$abso->EOF) {
$absorbtion_array[] = array('id' => $abso->fields['absorbtionclass'],
'text' => $abso->fields['absorbtionclass']);
$abso->MoveNext();
}
?>
now i modified the<fieldset>
<legend>Class of absorbtion</legend>
<?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_pull_down_menu('class_of_absorbtion', $absorbtion_array, $pInfo->class_of_absorbtion); ?>
<br class="clearBoth" />
</fieldset>
/include/modules/pages/advanced_search/header_php.php and added this code so the value of the input is processed in the search:
next step would be to modify the$sData['class_of_absorbtion'] = (isset($_GET['class_of_absorbtion']) ? zen_output_string($_GET['class_of_absorbtion']) : '');
/include/modules/pages/advanced_search_results/header_php.php
this is where the actual search is done, right?
Now i`m stuckon how to edit the search query because i don`t know where to tell zen cart that it should also pick results where the "class_of_absorbtion" value from the products_extra_stuff table concurs in the value of the search query.
Any suggestion and hints would be highly appreciated!
Thank you very much!
Bookmarks