47 lines
2.4 KiB
PHP
Executable File
47 lines
2.4 KiB
PHP
Executable File
<?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');
|
||
$smarty -> assign ( 'mymarkets', MYDIR . '/api/modules/lk-new-tovar/mymarkets.html');
|
||
|
||
|
||
/* ----------------------------------------------------------------------
|
||
02.06.2022
|
||
Получаем опции пользователя
|
||
---------------------------------------------------------------------- */
|
||
$userOption = DB::getAll('SELECT * FROM `userOption` WHERE `user_id` = ' . $_SESSION['user_id'] . ' LIMIT 1');
|
||
$smarty -> assign( 'userOption', $userOption );
|
||
|
||
/* ----------------------------------------------------------------------
|
||
03.12.2022
|
||
Получаем категории товаров
|
||
---------------------------------------------------------------------- */
|
||
$tovarCat = DB::getAll('SELECT * FROM `tovarCat` WHERE `user_id` = ' . $_SESSION['user_id'] . ' ORDER BY `title`');
|
||
$smarty -> assign( 'tovarCat', $tovarCat );
|
||
|
||
/* ----------------------------------------------------------------------
|
||
03.12.2022
|
||
Получаем мои организации
|
||
---------------------------------------------------------------------- */
|
||
$org = DB::getAll('SELECT * FROM `org` WHERE `id` IN (SELECT `org_id` FROM `multiOrg` WHERE `user_id` = ' . $_SESSION['user_id'] . ')');
|
||
$smarty -> assign( 'org', $org );
|
||
|
||
/* ----------------------------------------------------------------------
|
||
03.12.2022
|
||
Сохраняем товар и переадресуем на его редактор
|
||
---------------------------------------------------------------------- */
|
||
if ($_POST['ok']){
|
||
$insert_id = DB::add("INSERT INTO `tovar` SET `txt` = ?, `tovarCat`= ?, `opisanie`=?, `artikul`=?", array($_POST['txt'], $_POST['parent'], $_POST['opisanie'], $_POST['artikul']));
|
||
$id = DB::add("INSERT INTO `multyTovar` SET `tovar_id` = ?, `org_id`= ?, `cena`=?", array($insert_id, $_POST['org_id'], $_POST['cena']));
|
||
header ( 'Location: /lk-edit-tovar/' . $insert_id );
|
||
}
|
||
|
||
?>
|