include ("design/session.inc.php"); include ("design/config.inc.php"); include ("design/function.inc.php"); $label_user=0; if (isset($_SESSION['valid_user']) and (!empty($_SESSION['valid_user']))) { $label_user=1; } $commentary_type =3; // Проверка данны полученных методом GET $lots = $_GET["lot"]; $lots = cutty_html($lots); // Получение всех номеров лота $sql_query_lot = "SELECT lot_id FROM ".$tablename_lot." WHERE lot_view='ac'"; $result_query_lot = mysql_query($sql_query_lot) or die ("$h_error".mysql_error()."$f_error"); if ($result_query_lot) { while($row_lot = mysql_fetch_array($result_query_lot)) { $row_all[] = cutty_html($row_lot['lot_id']); } } // Запрос на получение минимального номера лота $sql_query_min_lot = "SELECT MIN(lot_id) FROM ".$tablename_lot.""; $result_query_min_lot = mysql_query($sql_query_min_lot) or die ("$h_error".mysql_error()."$f_error"); if ($result_query_min_lot) { while($row_min = mysql_fetch_array($result_query_min_lot)) { $row_min_lot = cutty_html($row_min['MIN(lot_id)']); } } if (!in_array($lots,$row_all)) { $lots = $row_min_lot; } // Запрос на получение максимального значения лота товара $sql_query_max_lot = "SELECT MAX(lot_id) FROM ".$tablename_lot." LIMIT 1"; $result_query_max_lot = mysql_query($sql_query_max_lot) or die ("$h_error".mysql_error()."$f_error"); if ($result_query_max_lot) { while($row_all = mysql_fetch_array($result_query_max_lot)) { $lot_all = cutty_html($row_all['MAX(lot_id)']); } } $_SESSION['lot_all'] = $lot_all; // Запрос на получение данных о товаре по лоту $sql_query_lots = "SELECT * FROM ".$tablename_lot." WHERE lot_view='ac' and lot_id=".$lots." LIMIT 1"; $result_query_lots = mysql_query($sql_query_lots) or die ("$h_error".mysql_error()."$f_error"); // Если запрос провален, и записи=0 if (!$result_query_lots || mysql_num_rows ($result_query_lots) == 0) { $sql_query_lots = "SELECT * FROM ".$tablename_lot." WHERE lot_view='ac' ORDER BY RAND() LIMIT 1"; $result_query_lots = mysql_query($sql_query_lots) or die ("$h_error".mysql_error()."$f_error"); } if ($result_query_lots) { while($row = mysql_fetch_array($result_query_lots)) { $lot_id_reading = cutty_html($row['lot_id']); $lot_name_reading = cutty_html($row['lot_name']); $lot_meta_reading = cutty_html($row['lot_meta']); $lot_categories_id_reading = cutty_html($row['lot_categories_id']); $lot_sub_id_reading = cutty_html($row['lot_sub_id']); $lot_content_reading = cutty_rtf($row['lot_content']); $lot_image_reading = cutty_rtf($row['lot_image']); $lot_archive_reading = cutty_html($row['lot_archive']); $lot_novelty_reading = cutty_html($row['lot_novelty']); $lot_price_reading = cutty_html($row['lot_price']); $lot_include_reading = cutty_html($row['lot_include']); $lot_link_reading = cutty_html($row['lot_link']); } } if(0<$lot_categories_id_reading) { if($lot_sub_id_reading <>0) {$lot_categories_id_reading = $lot_sub_id_reading;} // Получение наименования категории $query_sql_cat_name = "SELECT * FROM ".$tablename_lot_cat." WHERE lot_cat_id=".$lot_categories_id_reading.""; $result_cat_name = mysql_query($query_sql_cat_name) or die ("$h_error".mysql_error()."$f_error"); if ($result_cat_name) { while($row_cat_name = mysql_fetch_array($result_cat_name)) { $lot_cat_id = cutty_html($row_cat_name['lot_cat_id']); $lot_cat_name = cutty_html($row_cat_name['lot_cat_name']); } } /* Формирование переменных для корзины и установка комбобоксов количества товара + Количество товара + Имя товара в корзине + Лот товара в корзине + Цена товара в корзине + Общая сумма товаров + Общее количество товаров Поиск в базе товара по переменной $lot */ if (isset($_POST['sel_'.$lot_id_reading])) { $_SESSION['sel'][$lot_id_reading] = $_POST['sel_'.$lot_id_reading]; $_SESSION['basket_name'][$lot_id_reading] = cutty_html($lot_name_reading); $_SESSION['basket_lot'][$lot_id_reading] = cutty_html($lot_id_reading); $_SESSION['basket_prices'][$lot_id_reading] = cutty_html($lot_price_reading); for ($i=0;$i<=$lot_all;$i++) { @$sum[$i] = $_SESSION['basket_prices'][$i]*$_SESSION['sel'][$i]; @$counts[$i] = $_SESSION['sel'][$i]; } @$_SESSION['summa'] = array_sum($sum); @$_SESSION['count_basket'] = array_sum($counts); } } ?>
include("design/top.inc.php");?> | ||||||||||||||||||||||||||||||
include("design/top_menu.inc.php"); ?> | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
include("design/bottom.inc.php");?> |