Guest MrBigBargin Posted June 15, 2005 Share Posted June 15, 2005 Hey all, I been trying to to figure this one out for a while now and it just hit me tonight. All my products are listed with a mark down price and the regular retail price. So the sale items box always remained the same. I wanted the sale items box to show random items though. So I got playing with the code and figured it out. If you want your sale items box to populate with random products with each page load simply open includes/boxes/saleItems.inc.php Now find this line: $saleItems = $db->select("SELECT name, productId, price, sale_price, price - sale_price as saving FROM ".$config['dbprefix']."CubeCart_inventory where sale_price > 0 ORDER BY saving ASC",$config['noSaleBoxItems']); It's the very first line of code. Now select that line and replace it with this: mt_srand ((double) microtime() * 1000000); $seed = mt_rand(1,10000); if(isset($_GET['catId'])){ $whereClause = "WHERE cat_id=".$db->mySQLSafe($_GET['catId']); } $saleItems = $db->select("SELECT name, productId, price, sale_price, price - sale_price as saving FROM ".$config['dbprefix']."CubeCart_inventory where sale_price > 0 ORDER BY RAND(".$seed.") LIMIT 10"); NOTE: Where it says "LIMIT 10" above, change the number 10 to however many products you want listed in the sale items box. You can see a live example of this working here: http://www.bigbarginbuys.com Quote Link to comment Share on other sites More sharing options...
Guest vrakas Posted June 15, 2005 Share Posted June 15, 2005 This is a nice feature i will give it a try. :D Quote Link to comment Share on other sites More sharing options...
Guest Posted June 15, 2005 Share Posted June 15, 2005 well done hmmm could this be the first mod for version 3 fellas??? Quote Link to comment Share on other sites More sharing options...
Guest paulrainer Posted March 13, 2006 Share Posted March 13, 2006 if I want to display only 2 items in the sale item box? its difficult? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.