1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| (...)
$randomdisplay = $randomcol * $randomrow;
$widthcol = (int)(100/$randomcol);
$bbhl = $boxboxheadleft ? 'corner_left.gif' : 'corner_right_left.gif';
$bbhr = $boxboxheadright ? 'corner_right.gif' : 'corner_right_left.gif';
$ok_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id not IN " . NOT_CATEGORI . " and p.products_status = '1'");
$ok_products_row = tep_db_num_rows($ok_products_query);
if ($ok_products_row > 0) {
if ($randomboxhead) {
$info_box_contents = array();
$info_box_contents[] = array('text' => RND_HEAD_TEXT);
new infoBoxHeading($info_box_contents, $randomboxheadleft, $randomboxheadright);
}
if ($ok_products_row < $randomdisplay) $randomdisplay = $ok_products_row;
$maxrandomtable = $randomdisplay;
$randomtable = array();
for ($c=0; $c<$maxrandomtable; $c++) {
$random=tep_rand($c,$ok_products_row-1);
$ok = (isset($randomtable[$random])) ? $randomtable[$random] : $random;
$randomtable[$random] = (isset($randomtable[$c])) ? $randomtable[$c] : $c;
$randomtable[$c] = $ok;
};
$row = 0;
$col = 0;
$info_box_contents = array();
for ($c=0; $c<$randomdisplay; $c++) {
tep_db_data_seek($ok_products_query, $randomtable[$c]);
$products = tep_db_fetch_array($ok_products_query);
$products['products_name'] = tep_get_products_name($products['products_id']);
switch ($templates_display) {
case 2:
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="' . $widthcol . '%" valign="top"',
'text' => '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td height="14" class="infoBoxHeading" valign="top"><img src="images/infobox/' . $bbhl . '" border="0" alt="" width="11" height="14"></td><td height="14" class="infoBoxHeading" width="100%"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a></td><td height="14" class="infoBoxHeading" valign="top"><img src="images/infobox/' . $bbhr . '" border="0" alt="" width="11" height="14"></td></tr></table>' .
'<table border="0" width="100%" cellspacing="1" cellpadding="3" class="infoBox"><tr class="infoBoxContents"><td align="center">' .
'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br>' . $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '<br><br>' .
'<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ' .
'</td></tr></table>');
break;
default:
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="' . $widthcol . '%" valign="top"',
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a><br>' . $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])));
break;
}
$col ++;
if ($col > ($randomcol-1)) {
$col = 0;
$row ++;
}
}
new contentBox($info_box_contents);
}
?> |
Partager