my version for 4.1.0rc4
create a file called random.php and put it in your stores root
Code:
<?
// the database query
$query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[products].productid=$sql_tbl[pricing].productid ORDER BY RAND() LIMIT 6 ";
// give the product array to smarty to make it available sitewide.
$randoms = func_query($query);
$smarty->assign("randoms",$randoms);
?>
The query will only pick up live items that are in stock.
Place:
Code:
include "./random.php";
under
Code:
if($active_modules["Bestsellers"])
include $xcart_dir."/modules/Bestsellers/bestsellers.php";
in root/home.php
create skin1/customer/main/randoms.tpl
Code:
{* $Id: randoms.tpl,v 1.13 2002/05/20 06:55:20 lucky Exp $ *} <font class=big>From the Brew</font></font>
{include file="customer/main/products.tpl" products=$randoms}
edit skin1/customer/home.tpl or wherever you want to place the random products and use this code to call it:
Code:
{include file="customer/main/randoms.tpl"}