include ("design/session.inc.php");
include ("design/config.inc.php");
include ("design/function.inc.php");
include ("design/design.inc.php");
$label_user=0;
if (isset($_SESSION['valid_user']) and (!empty($_SESSION['valid_user'])))
{
$label_user=1;
}
// Проверка данны полученных методом GET
@$id = $_GET["id"];
$id = cutty_html($id);
$id = check_variable($id);
@$page = $_GET["page"];
$page = cutty_html($page);
$page = check_variable($page);
// Получение наименования категории
$query_lot_cat_name = "SELECT lot_cat_id, lot_cat_name FROM ".$tablename_lot_cat." WHERE lot_cat_id=".$id."";
$result_lot_cat_name = mysql_query($query_lot_cat_name) or die ("$h_error".mysql_error()."$f_error");
if ($result_lot_cat_name)
{
while($row_lot_cat_name = mysql_fetch_array($result_lot_cat_name))
{
$lot_cat_id = cutty_html($row_lot_cat_name['lot_cat_id']);
$lot_cat_name = cutty_html($row_lot_cat_name['lot_cat_name']);
}
}
// Сравнение номеров категории с переменной $id
$query_lot_id = "SELECT lot_cat_id FROM ".$tablename_lot_cat."";
$result_lot_id = mysql_query($query_lot_id);
if ($result_lot_id)
{
while($row_id = mysql_fetch_array($result_lot_id))
{
$id_all[] = cutty_html($row_id['lot_cat_id']);
}
}
if (!array_search($id,$id_all)) {$id=1;}
// Запрос на получение максимального значения лота товара
$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;
/* Запрос на получение строк из таблици товаров
$id = номер категории товара
*/
$sql_query_lots = "SELECT * FROM ".$tablename_lot." WHERE (lot_categories_id=".$id." or lot_sub_id=".$id.") and lot_view='ac' ORDER BY lot_displacement+0 DESC";
$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_categories_id_reading[] = cutty_html($row['lot_categories_id']);
$lot_content_sm_reading[] = cutty_html($row['lot_content_sm']);
$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_displacement_reading[] = cutty_html($row['lot_displacement']);
$lot_link_reading[] = cutty_html($row['lot_link']);
}
}
/* Формирование переменных для корзины и установка комбобоксов количества товара
+ Количество товара
+ Имя товара в корзине
+ Лот товара в корзине
+ Цена товара в корзине
+ Общая сумма товаров
+ Общее количество товаров
Поиск в базе товара по переменной $lot_id
*/
if (isset($lot_id_reading))
{
for ($i=0;$i<=$lot_all;$i++)
{
if (isset($_POST['sel_'.$i]))
{
$_POST['sel_'.$i] = cutty_html($_POST['sel_'.$i]);
$query = "SELECT * FROM ".$tablename_lot." WHERE lot_id=".$i."";
$result = mysql_query($query);
if ($result)
{
while($row = mysql_fetch_array($result))
{
$_SESSION['sel'][$row['lot_id']] = $_POST['sel_'.$i];
$_SESSION['basket_lot'][$row['lot_id']] = cutty_html($row['lot_id']);
$_SESSION['basket_name'][$row['lot_id']] = cutty_html($row['lot_name']);
$_SESSION['basket_prices'][$row['lot_id']] = cutty_html($row['lot_price']);
}
}
}
@$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);
}
$maxmess = 10;
$lines = (count($lot_id_reading));
if ($page > ((int)(($lines / $maxmess) + 1))) { $page = 1; }
$print_pages = getPages($lines, $page, "gps.php?id=$id&", $maxmess);
$from = $lines - ($page * $maxmess - 1);
$to = $lines - (($page - 1) * $maxmess);
if($from < 0) { $from = 1; }
?>
Интернет-магазин www.gps.kg - Каталог товаров - echo $lot_cat_name; ?>
include("design/top.inc.php");?>
|
include("design/top_menu.inc.php"); ?> |
include("design/top_catalog.inc.php");
include("design/basket.inc.php");
include("design/login.inc.php");
?> |
|
// include("design/lot_in_categories.inc.php"); ?>
if($id==27)
{
echo('
');
}
if($id==30)
{
echo('
');
}
if ($lines > $maxmess)
{
echo ('
');
echo "Количество товаров в этой категории : ".$lines."
";
echo "Страницы : ".$print_pages." ";
echo ('
|
');
}
for($i = $to - 1; $i >= $from - 1; $i--)
{
if ($i < 0) { break; }
echo ("
");
}
if($id==25 or $id==26)
{
echo(' ');
}
if ($lines > $maxmess)
{
echo ('
');
echo "Количество товаров в этой категории : ".$lines."
";
echo "Страницы : ".$print_pages." ";
echo ('
|
');
}
?>
|
|
include("design/right_lot_in_categories.inc.php");
include("design/reclama.inc.php");
?> |
|
|
include("design/bottom.inc.php"); ?>
|