sql_query);
$no_of_specials = tep_db_num_rows($specials_query);
// get all product prices from the table products_groups in one query
// traverse specials_query for products_id's, store the query result in a numbered array
while ($_specials = tep_db_fetch_array($specials_query)) {
$specials[] = $_specials;
$list_of_prdct_ids[] = $_specials['products_id'];
} // end while ($_specials = tep_db_fetch_array($specials_query))
// a line needed for the selection of the products_id's
$pg_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
if ($no_of_specials > 1) {
for ($n = 1 ; $n < count($list_of_prdct_ids) ; $n++) {
$pg_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";
}
}
// now get all the customers_group_price's
$pg_query = tep_db_query("select products_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where (".$pg_list_of_prdct_ids.") and customers_group_id = '" . $customer_group_id . "'");
// put all the info in an array called new_prices
while ($pg_array = tep_db_fetch_array($pg_query)) {
$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price']);
}
// we already got the results from the query and put them into an array, can't use while now
// while ($specials = tep_db_fetch_array($specials_query)) {
for ($x = 0; $x < $no_of_specials; $x++) {
$row++;
// replace products prices with those from customers_group table
if(!empty($new_prices)) {
for ($i = 0; $i < count($new_prices); $i++) {
if( $specials[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
$specials[$x]['products_price'] = $new_prices[$i]['products_price'];
}
}
} // end if(!empty($new_prices)
$listing[$x] = $specials[$x];
$the_tooltip = '
' . tep_image(DIR_WS_IMAGES . $specials[$x]['products_image'], $specials[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'imageorig="' . DIR_WS_IMAGES . $specials[$x]['products_image'] .' " style="position:relative;" id="' . $specials[$x]['products_id'] .'"') . '
';
$short_query = tep_db_query("select * from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $specials[$x]['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
$short_info = tep_db_fetch_array($short_query);
if (SHOW_HOVER_BOX_SP == 'true')
{
?>
';
$lc_text .= '