2022-12-11 13:55:49 +05:00
|
|
|
|
<?php
|
|
|
|
|
ini_set( 'display_errors', 0 );
|
|
|
|
|
//проверяем авторизацию
|
|
|
|
|
if ( $_SESSION['dostup'] !== 'a' && $_SESSION['dostup'] !== 'e' ) header( 'Location: /403/' );
|
|
|
|
|
|
2023-01-07 18:55:55 +05:00
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
14.12.2022
|
|
|
|
|
Получаем инфу о пользователе
|
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
|
$smarty -> assign( 'userInfo', \core::getUserInfo( $_SESSION['user_id'] ) );
|
|
|
|
|
|
2022-12-11 13:55:49 +05:00
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
06.09.2022
|
|
|
|
|
Сессия для загрузки картинок
|
|
|
|
|
---------------------------------------------------------------------- */
|
2022-12-17 18:15:09 +05:00
|
|
|
|
$_SESSION['page_id'] = $_GET['id'];
|
2022-12-11 13:55:49 +05:00
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
21.08.2022
|
|
|
|
|
Получаем список категорий
|
|
|
|
|
---------------------------------------------------------------------- */
|
2022-12-17 18:15:09 +05:00
|
|
|
|
$cats=\DB::getAll("SELECT * FROM `tovar_category`");
|
2022-12-11 13:55:49 +05:00
|
|
|
|
$smarty -> assign( 'cats', $cats );
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
23.08.2022
|
|
|
|
|
Получаем данные о товаре
|
|
|
|
|
05.09.2022
|
|
|
|
|
Получаем картинки
|
|
|
|
|
08.09.2022
|
|
|
|
|
Получаем характеристики
|
|
|
|
|
---------------------------------------------------------------------- */
|
2022-12-17 18:15:09 +05:00
|
|
|
|
if ( $_GET['id'] ) {
|
|
|
|
|
$tovar=\DB::getAll("SELECT * FROM `tovar` WHERE `id`=? LIMIT 1", $_GET['id']);
|
|
|
|
|
$smarty -> assign ( 'tovar', $tovar );
|
|
|
|
|
$imgs=\DB::getAll("SELECT * FROM `tovar_img` WHERE `tovar_id`=?", $_GET['id']);
|
|
|
|
|
$smarty -> assign ( 'imgs', $imgs );
|
|
|
|
|
//$har=\DB::getAll("SELECT * FROM `tovar_img` WHERE `tovar_id`=?", $_GET['id']);
|
|
|
|
|
//$smarty -> assign ( 'har', $mod -> getHar( ID ) );
|
2022-12-11 13:55:49 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
05.09.2022
|
|
|
|
|
Сохраняем товар и открываем его сохраненную карточку
|
|
|
|
|
!!! Сохранение описания в json
|
|
|
|
|
---------------------------------------------------------------------- */
|
2022-12-17 18:15:09 +05:00
|
|
|
|
//if ( $_POST['act'] == 'addTovar' ) header ( 'Location: /a_new_tovar/' . $mod -> addTovar( $_POST ) );
|
2022-12-11 13:55:49 +05:00
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
06.09.2022
|
|
|
|
|
Редактируем товар
|
|
|
|
|
!!! Сохранение описания в json
|
|
|
|
|
---------------------------------------------------------------------- */
|
2022-12-17 18:15:09 +05:00
|
|
|
|
//if ( $_POST['act'] == 'editTovar' && ID ) $mod -> editTovar( $_POST, ID );
|
2022-12-11 13:55:49 +05:00
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|