First check your search.php and see if you have the categoryFilter code - it's included in the latest distribution and in numerous mods so I suspect you may already have the code in place - look around line 16 for the following code:
If that's in place, a drop-down can simply be added to the search form. To do this, edit html/searchform.php and add the following code on the line immediately before the submit / Search button:
<?php $sql = "SELECT DISTINCT(category) FROM `".$config_databaseTablePrefix."products` WHERE category <> '' ORDER BY category"; if (database_querySelect($sql,$rows)) { print "<select name='categoryFilter'>"; print "<option value=''>All Categories</option>"; foreach($rows as $row) { $selected = ($_GET["categoryFilter"]==$row["category"]?"selected='selected'":""); print "<option value='".htmlspecialchars($row["cateogory"])."' ".$selected.">".$row["category"]."</option>"; } print "</select>"; } ?>
If you don't have $categoryFilter handling code in your search.php, email me your current version and I'll merge that for you...
Hi Stuart,
First check your search.php and see if you have the categoryFilter code - it's included in the latest distribution and in numerous mods so I suspect you may already have the code in place - look around line 16 for the following code:
$categoryFilter = ($_GET["categoryFilter"]?$_GET["categoryFilter"]:"");
If that's in place, a drop-down can simply be added to the search form. To do this, edit html/searchform.php and add the following code on the line immediately before the submit / Search button:
<?php
$sql = "SELECT DISTINCT(category) FROM `".$config_databaseTablePrefix."products` WHERE category <> '' ORDER BY category";
if (database_querySelect($sql,$rows))
{
print "<select name='categoryFilter'>";
print "<option value=''>All Categories</option>";
foreach($rows as $row)
{
$selected = ($_GET["categoryFilter"]==$row["category"]?"selected='selected'":"");
print "<option value='".htmlspecialchars($row["cateogory"])."' ".$selected.">".$row["category"]."</option>";
}
print "</select>";
}
?>
If you don't have $categoryFilter handling code in your search.php, email me your current version and I'll merge that for you...
Cheers,
David.
--
PriceTapestry.com