0) { $rows_per_page = 10; $scroll = 5; $query = "SELECT product_id, name_lang1, name_lang2, name_lang3, name_lang4, name_lang5, name_lang6, small_description_lang1, small_description_lang2, small_description_lang3, small_description_lang4, small_description_lang5, small_description_lang6, small_picture, your_price, avail_in_stock, avail_day, avail_month, avail_year, inventory_number FROM diffshop_products WHERE ("; $query .= " product_id IN (". implode( ', ', $products_rows_sp)." )"; $query .= ") AND available='1' ORDER BY product_id ASC"; $result = mysql_query($query) or die("error in query - $query - ".mysql_error()); $total_records = mysql_num_rows($result); $pages = ceil($total_records / $rows_per_page); mysql_free_result($result); $k = $pages; $l = $rows_per_page; if (!isset($page)) $page = 1; if ($page) { $r = ($page - 1); } $j = ($r * $rows_per_page) +1 ; $j_start = $r * $rows_per_page; $j_end = $j_start + $rows_per_page; if ($j_end <= $total_records) { $j_sub = $j_end; } else { $j_sub = ($total_records - (($page - 1) * $rows_per_page)) + ($j - 1); } $start = (($page * $rows_per_page) - $rows_per_page); $query = "SELECT product_id, name_lang1, name_lang2, name_lang3, name_lang4, name_lang5, name_lang6, small_description_lang1, small_description_lang2, small_description_lang3, small_description_lang4, small_description_lang5, small_description_lang6, small_picture, your_price, avail_in_stock, avail_day, avail_month, avail_year, inventory_number FROM diffshop_products WHERE ("; $query .= " product_id IN (". implode( ', ', $products_rows_sp)." )"; $query .= ") AND available='1' ORDER BY product_id ASC LIMIT $start, $rows_per_page"; $result = mysql_query($query) or die("error in query - $query - ".mysql_error()); $rows2 = mysql_num_rows($result); if ($total_records > 0) { while($row_products = mysql_fetch_array($result)) { $prod_rows[] = $row_products; } $i = 0; foreach($prod_rows as $prod_row) { $prod_ids[] = $i++; $categ_product_id[] = $prod_row[0]; $name_lang1 = stripslashes($prod_row[1]); $name_lang2 = stripslashes($prod_row[2]); $name_lang3 = stripslashes($prod_row[3]); $name_lang4 = stripslashes($prod_row[4]); $name_lang5 = stripslashes($prod_row[5]); $name_lang6 = stripslashes($prod_row[6]); $small_description_lang1 = stripslashes($prod_row[7]); $small_description_lang2 = stripslashes($prod_row[8]); $small_description_lang3 = stripslashes($prod_row[9]); $small_description_lang4 = stripslashes($prod_row[10]); $small_description_lang5 = stripslashes($prod_row[11]); $small_description_lang6 = stripslashes($prod_row[12]); $small_picture[] = $prod_row[13]; $your_price[] = $prod_row[14]; $avail_in_stock[] = $prod_row[15]; $avail_day[] = $prod_row[16]; $avail_month[] = $prod_row[17]; $avail_year[] = $prod_row[18]; $inventory_number[] = $prod_row[19]; $product_name_tmp1 = select_language($name_lang1, $name_lang2, $name_lang3, $name_lang4, $name_lang5, $name_lang6); $product_name[] = select_language($name_lang1, $name_lang2, $name_lang3, $name_lang4, $name_lang5, $name_lang6); $product_name_rewrite[] = strtolower(str_replace(" ", "-", $product_name_tmp1)); $small_description[] = select_language($small_description_lang1, $small_description_lang2, $small_description_lang3, $small_description_lang4, $small_description_lang5, $small_description_lang6); } ///////////////////////////// currency 1 /////////// if (isset($_SESSION['default_rate'])) { $with_vat_price = array(); foreach($your_price as $price) { $with_vat_price[] = number_format(($price*$default_rate), 2, '.', ','); } $your_prices = array(); foreach($your_price as $price) { $your_prices[] = number_format(($price*$default_rate), 2, '.', ','); } } else { $with_vat_price = array(); foreach($your_price as $price) { $with_vat_price[] = number_format($price, 2, '.', ','); } $your_prices = array(); foreach($your_price as $price) { $your_prices[] = number_format($price, 2, '.', ','); } } //////////////////////////////////////////////////// $prod_stock_strings = array(); foreach($avail_in_stock as $stock) { $prod_stock_strings[] = stock_to_string($stock, $lang['2'], $lang['3'], $lang['4'], $lang['5'], $lang['6']); } $prod_month_strings = array(); foreach($avail_month as $month) { $prod_month_strings[] = month_to_string($month, $lang['7'], $lang['8'], $lang['9'], $lang['10'], $lang['11'], $lang['12'], $lang['13'], $lang['14'], $lang['15'], $lang['16'], $lang['17'], $lang['18']); } $smarty->assign('no_sp', N); $smarty->assign('default_currency', $default_currency); $smarty->assign('products_dir', $products_dir); $smarty->assign('product_small_picture_weight', $product_small_picture_weight); $smarty->assign('product_small_picture_height', $product_small_picture_height); $smarty->assign('total_records', $total_records); $smarty->assign('prod_ids', $prod_ids); $smarty->assign('categ_product_id', $categ_product_id); $smarty->assign('small_picture', $small_picture); $smarty->assign('product_name', $product_name); $smarty->assign('small_description', $small_description); $smarty->assign('your_price', $your_prices); $smarty->assign('with_vat_price', $with_vat_price); $smarty->assign('prod_stock_strings', $prod_stock_strings); $smarty->assign('avail_day', $avail_day); $smarty->assign('prod_month_strings', $prod_month_strings); $smarty->assign('avail_year', $avail_year); $smarty->assign('inventory_number', $inventory_number); $smarty->assign('product_name_rewrite', $product_name_rewrite); if ($pages > 1) { $page_link = "".$lang['178']." $page ".$lang['179']." $pages"; $smarty->assign('page_link', $page_link); } if ($page > 1) { $previous = $page - 1; $previous_link = "".$lang['19'].""; $smarty->assign('previous_link', $previous_link); } if ($total_records != $rows_per_page) { if ($pages > $scroll) { // REMOVE THIS TO GET RID OF THE SCROLL FEATURE $first = $page; // REMOVE THIS TO GET RID OF THE SCROLL FEATURE $last = ($scroll - 1) + $page; // REMOVE THIS TO GET RID OF THE SCROLL FEATURE } else { // REMOVE THIS TO GET RID OF THE SCROLL FEATURE $first = 1; $last = $pages; } // REMOVE THIS TO GET RID OF THE SCROLL FEATURE if ($last > $pages ) { $first = $pages - ($scroll - 1); $last = $pages; } if ($pages > 1) { for ($i = $first;$i <= $last;$i++){ if ($page == $i) { $curent_page .="[ $i ]"; } else { $curent_page .= "[ $i ]"; } } $smarty->assign('curent_page', $curent_page); } } if ($page < $pages) { $next = $page + 1; $next_link = "| $lang[20]"; $smarty->assign('next_link', $next_link); } } //////////////////////////////////////////////////////////////////////////////////////////////////*\ } else { $smarty->assign('no_sp', Y); } //////////////////////////////////////////////////////////////////////////////////////////////////*\ $smarty->display('promotii.tpl'); include ("close_mysql.php"); ?>