Simple! I just spent the last hour figuring out how to do something that I was surprised not to have found on the forums.
I made a button that when clicked, sends the customer to a random product page. Thats it. Dead simple.
All you have to do is make a new file, randomProduct.php in your xcart root dir containing the following:
Code:
<?php
require "./auth.php";
$rnd = rand();
$random_product = func_query("SELECT $sql_tbl[products].productid FROM $sql_tbl[products] WHERE $sql_tbl[products].forsale='Y' ORDER BY RAND(NOW()+$rnd) LIMIT 1");
header("Location: product.php?productid=".$random_product[0]['productid']);
?>
And then wherever you would like the button on your site, use the following in any .tpl:
Code:
<a href="{$xcart_web_dir}/randomProduct.php">Random Product!</a>
This works on my 4.0.18 install. Enjoy.