Hi,
I try to list the merchants' name (for my homepage sidebar). Does anyone find the function ?
Thanks in advance !
Terrific ! Thanks a lot !
Just a strange error with the rewrited urls.
homepage : http://www.domain.com/ + merchant name
product : http://www.domain.com/product/ + merchant name
etc...
Oops - I missed out the "merchant/" in front of the merchant name in the rewrite case of the above code. I've fixed it now (in the code above)...
Cheers,
David.
argh ! not yet ! ;-)
Product page :
http://www.domain.tld/product/merchant/ + merchant name...
Thank you.
Ah, sorry - I thought this menu was going on your home page.
In that case, all you need to do is prefix the URL with $config_baseHREF, like this:
<?php
print "<p>Merchant List</p>";
print "<ul>";
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER BY merchant";
if (database_querySelect($sql,$rows))
{
foreach($rows as $feed)
{
if ($config_useRewrite)
{
$href = $config_baseHREF."merchant/".tapestry_hyphenate($feed["merchant"])."/";
}
else
{
$href = $config_baseHREF."search.php?q=merchant:".urlencode($feed["merchant"]).":";
}
print "<li><a href='".$href."'>".$feed["merchant"]."</a></li>";
}
}
print "</ul>";
?>
Should work fine then!
Cheers,
David.
How can you list only say 5 of the top retailers?
Hi,
The trouble with that is that there is no metric within the system by which you can determine "top". You could of course limit the list to a random selection of 5 retailers...
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER BY RAND() LIMIT 5";
Cheers,
David.
Hi,
There isn't a function to do this but it should be straight forward. The PHP code would be something like this:
<?php
print "<p>Merchant List</p>";
print "<ul>";
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER BY merchant";
if (database_querySelect($sql,$rows))
{
foreach($rows as $feed)
{
if ($config_useRewrite)
{
$href = "merchant/".tapestry_hyphenate($feed["merchant"])."/";
}
else
{
$href = "search.php?q=merchant:".urlencode($feed["merchant"]).":";
}
print "<li><a href='".$href."'>".$feed["merchant"]."</a></li>";
}
}
print "</ul>";
?>
Hope this helps!
Cheers,
David.