Originally Posted by
Ajeh
Nope sure don't ...
You need to change table names and field names and method of select to produce the random product to be displayed from the 1 to many upcoming products ...
The whats_new sidebox is just a good pattern to follow ...
Hi Ajeh,
Would need a bit of help please. I have changed the table names but how do I change the method of select please?
Here is my sidebox code:
PHP Code:
<?php
//*****************************************************************
//*****************************************************************
// whats_new scroller for Zen-Cart v1.3
// originally by sn0ut
// Place this file in your sideboxes template overrides dir
// includes\templates\%your_template%\sideboxes\tpl_whats_new.php
//
//*****************************************************************
//*****************************************************************
// $Id: tpl_whats_new.php,v 1.0 23/08/2006 sn0ut $
// *****************************************************************|
// ******************** CONFIG OPTIONS **************************** |
// Change the values here to modify how the marquee looks and works |
// *****************************************************************|
$scroll_amount = "1"; // scroll amount
$scroll_delay = "5"; // scroll delay
$scroll_direction = "up"; // scroll direction (can be up, down, left or right)
$scroll_behaviour = "scroll"; // scroll behaviour (can be scroll, alternate or slide) ** Seems to make no diff **
$box_height = "160"; // height of whats new box
// *****************************************************************|
// *********************** END CONFIG ***************************** |
// *****************************************************************|
$display_limit = zen_get_products_products_date-available_timelimit(); // filters by admin settings
$content = ""; // clear sidebox previous content
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent centeredContent">';
$random_products_date_available _query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = 1 " . $display_limit . "
and p.products_id = pd.products_id
order by products_date_available asc
limit " . MAX_RANDOM_SELECT_NEW;
$random_products_date_available = $db->Execute($random_products_date_available _query);
$i = 0;
while (!$random_products_date_available ->EOF) {
$rn .= '<br /><center><a href="' . zen_href_link(zen_get_info_page($random_products_date_available ->fields['products_id']), 'products_id=' . $random_products_date_available ->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $random_products_date_available ->fields['products_image'], $random_products_date_available ->fields[ 'products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . ' </a><br /><a href="' . zen_href_link(zen_get_info_page($random_products_date_available ->fields ['products_id']), 'products_id=' . $random_products_date_available ->fields['products_id']) . '">' . $random_products_date_available ->fields['products_name'] . '</a><br />' . zen_get_products_display_price($random_products_date_available ->fields['products_id']) . '</center><br /><br />' . "\n";
$i++;
$random_products_date_available ->MoveNext();
}
$total = $i;
if ($total > 1) { //if more than one new product exists in the db then scrolling begins
$content .= '<MARQUEE behavior= "' . $scroll_behaviour . '" align= "center" direction= "' . $scroll_direction . '" height="' . $box_height . '" scrollamount= "' . $scroll_amount . '" scrolldelay= "' . $scroll_delay . '" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'>' . $rn .'</MARQUEE>';
}
elseif ($total == 1) { // If only one new product exists in the db then the box will remain static
$content .= $rn;
}
else { // If there are no new products then this text is displayed
$content .= "No new products this month!";
}
$content .= '</div>';
?>
Any help would be much appreciated.
Cheers
Claire
Bookmarks