Let me explain...
I have purchase Pinnacle Shopping Cart, and they use the Smarty Template Engine for the cart. My problem is that I want to be able to display a featured product table on my homepage, but I need to create a plugin that will create a database query on the products table in my database, and select a random product record. Then the plugin would need to assign the random record to a smarty array. Can you help here?
For a good example of what I want is at the site below (note the feature box right on the homepage) Not too sure if they use the smarty engine, but this is the general idea of what I want.
I have found a working script to query my database for the random product, but I am unfamiliar with the Smarty Template Engine.
Here's the code for the random product:
Code:
// PHP script
<?
// Connect to the database
mysql_connect ('localhost', 'user', 'pass') ;
mysql_select_db ('db');
// Edit this number to however many links you want displaying
$num_displayed = 1 ;
// Select random rows from the database
$result = mysql_query ("SELECT * FROM products ORDER BY RAND() LIMIT $num_displayed");
// For all the rows that you selected
while ($row = mysql_fetch_array($result))
{
// Display them to the screen...
echo "<a href=\"" . $row["link"] . "\">
<img src=\"" . $row["image"] . "\" border=0 alt=\"" . $row["text"] . "\">
</a>" ;
}
?>
If you have the time to do a script like that, I would appreciate it alot! I am one to return favors, my homepage is: Also, I am looking for another script, javascript or php for this one...I need the script to rotate banners based on a specific date, (Seasonal Related) and also would run as a cron job...I have searched & searched, and one that I *think* would've worked, but can't find a working link to download it is: Holiday.pl (a perl script). I am planning on using this type of script for advertising merchandise for MY WEBSITE ONLY...It Would even be nice to have an admin section to the script that allows me to select the banners that I want the script to load, and also be able to choose the date I want the banner to display, and the date I want the next banner to show...Needs to support 468x60px banners...Smaller ones will be ok as well.
I hope I have been clear with all this...
Thank you in advance!
-Brian
__________________
Brian
TMS BBS: 201-471-2205
Open Friday thru Sunday Eastern Time (US & Canada)
Last edited by Brian07002 : 05-03-2005 at 12:09 PM.
|