core/api/modules/lk-tovar/index.php

49 lines
2.0 KiB
PHP

<?php
ini_set('display_errors', 0 );
if ( !$_SESSION['user_id'] ) header ( 'Location: /login/' );
if ( ID==0 ) header ( 'Location: /lk-tovar/' );
require_once MYDIR . '/api/php/db.php';
require_once MYDIR . '/api/php/clean.php';
/* ----------------------------------------------------------------------
14.10.2022
Меню личного кабинета
---------------------------------------------------------------------- */
$smarty -> assign ( 'mnulk', MYDIR . '/skin/inc/mnulk.html');
/* ----------------------------------------------------------------------
02.06.2022
Получаем опции пользователя
---------------------------------------------------------------------- */
$userOption = DB::getAll('SELECT * FROM `userOption` WHERE `user_id` = ' . $_SESSION['user_id'] . ' LIMIT 1');
$smarty -> assign( 'userOption', $userOption );
/* ----------------------------------------------------------------------
30.11.2022
Получаем список категорий
---------------------------------------------------------------------- */
$id = (ID ? ID : 0);
$tovarCat = DB::getAll('SELECT * FROM `tovarCat` WHERE `parent` = ' . Clean::int($id));
$smarty -> assign( 'tovarCat', $tovarCat );
/* ----------------------------------------------------------------------
30.11.2022
Получаем список товаров
---------------------------------------------------------------------- */
$tovars = DB::getAll('SELECT * FROM `tovar` WHERE `tovarCat` = ' . Clean::int($id));
$smarty -> assign( 'tovars', $tovars );
/* ----------------------------------------------------------------------
30.11.2022
Получаем предыдущую категорию
---------------------------------------------------------------------- */
if (ID){
$linkUp = DB::getAll('SELECT `parent` FROM `tovarCat` WHERE `id` = ' . Clean::int(ID));
$smarty -> assign( 'linkUp', $linkUp[0]['parent'] );
}
?>