View Single Post
  #19  
Old 05-30-2004, 12:37 AM
  enge919's Avatar 
enge919 enge919 is offline
 

Senior Member
  
Join Date: May 2003
Posts: 141
 

Default

just change the following code in specials.php

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 AND discount > 0 ORDER BY RAND() LIMIT 6 "; // give the product array to smarty to make it available sitewide. $specials = func_query($query); $smarty->assign("specials",$specials); ?>

to

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. $specials = func_query($query); $smarty->assign("specials",$specials); ?>

This will just randomly pull products from the database regardless of any discounts.

And if you only want to show products you have discounted from the list price use this:

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 AND price < list_price ORDER BY RAND() LIMIT 4 "; // give the product array to smarty to make it available sitewide. $specials = func_query($query); $smarty->assign("specials",$specials); ?>

Change LIMIT 6 to any number of products you want to show in the specials.tpl

Also be sure to name the specials template specials.tpl. I noticed in the original code it was named special.tpl.

I have tested this in 3.5.4 and works like a charm

hth
__________________
Web site design - Custom Programming - Upgrades - Marketing
www.netvisionwebdesign.com

Follow on twitter: http://twitter.com/netvisionweb
Become a fan on Facebook: http://www.facebook.com/pages/NetVision-Web-Design/89463493419
Reply With Quote