Does anyone know the code or if it's possible to generate a merchant list for use on the side of a site. Right now I'm manually copying name and URLs from the merchant page into a vertical side box. I would also like to be able to tell it to only show X number in case the list gets too big.
Thanks,
Tommy
Hey David,
Thanks! It gave a blank screen at first but after removing
merchant:"
from $href = $config_baseHREF."search.php?q="merchant:".urlencode($row["merchant"]).":";
it works fine.
Thanks,
Tommy
Hi Tommy,
That's straight forward as it will be a quick query; try something like this:
<?php
$sql = "SELECT DISTINCT(merchant) as merchant FROM `".$config_databaseTablePrefix."products` ORDER BY merchant";
if (database_querySelect($sql,$rows))
{
print "<ul>";
foreach($rows as $row)
{
if ($config_useRewrite)
{
$href = $config_baseHREF."merchant/".tapestry_hyphenate($row["merchant"])."/";
}
else
{
$href = $config_baseHREF."search.php?q="merchant:".urlencode($row["merchant"]).":";
}
print "<li><a href='".$href."'>".$row["merchant"]."</a></li>";
}
print "</ul>";
}
?>
If you want to limit it to, say, 20 merchants, just add "LIMIT 20" to the end of the SQL, for example:
$sql = "SELECT DISTINCT(merchant) as merchant FROM `".$config_databaseTablePrefix."products` ORDER BY merchant LIMIT 20";
Cheers,
David.