Hi David,
I'm looking to display a few different random lists of products on the home page. Have a few different categories, wii, xbox, ps3 and would like to have a number of random products displayed separately from each category. Don't have a massive amount of products in the database and would like not to have to take products from the admin section.
Any ideas ?
Many thanks
Adrian
Hi Adrian,
Sure - it's just an extra WHERE clause in the SQL to select random products, using the featured products HTML module as described in this thread:
http://www.pricetapestry.com/node/2276
So you might use as the replacement SQL:
$sql = "SELECT name,1 AS sequence FROM `".$config_databaseTablePrefix."products` WHERE category='ps3' ORDER BY RAND() LIMIT 3";
(of course you can change the value of LIMIT for more or less products as required)
You can then show multiple lists simply by repeating the featured products code with the modified $sql = ... line as above, from that line, all the way down to
if (isset($featured)) require("html/featured.php");
...as in the distribution version of index.php...
Cheers,
David.