Hi David
I have a furniture site and I have a static page for each room in the house which uses searchcode.php to get the products
i.e. bathroom.php is:
<h1>Bathroom</h1>
<?php
$_GET["q"] = "category:Bathroom:";
$_GET["sort"] = "priceDesc";
require("searchcode.php");
require("html/footer.php");
?>
In my imports I have used brands as a subcategory, so category would be bathroom and brands would be bathroom cabinets.
Is it possible to to bring up a list of links just under the header, using the brand field something along the lines of
$sql = "SELECT DISTINCT(brand) as brand FROM `".$config_databaseTablePrefix."products` WHERE category LIKE bathroom% ORDER BY brand";
Your a star - works a treat, just what I was looking for.
Many thanks
Kelly
Hi Kelly,
Try something like this which can go anywhere provided that $_GET["q"] is set...
<?php
$tempParts = explode(":",$_GET["q"]);
if ($tempParts[0]=="category")
{
$sql = "SELECT DISTINCT(brand) as brand FROM `".$config_databaseTablePrefix."products` WHERE category='".database_safe($tempParts[1])."' ORDER BY brand";
if (database_querySelect($sql,$rows))
{
print "<ul>";
foreach($rows as $row)
{
$href = $config_baseHREF."search.php?q=brand:".urlencode($row["brand"]);
print "<li><a href='".$href."'>".$row["brand"]."</a></li>";
}
print "</ul>";
}
}
?>
Cheers,
David.