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 ); } ?>