core/api/modules/a_new_tovar/index.php

56 lines
2.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
ini_set( 'display_errors', 0 );
//проверяем авторизацию
if ( $_SESSION['dostup'] !== 'a' && $_SESSION['dostup'] !== 'e' ) header( 'Location: /403/' );
/* ----------------------------------------------------------------------
06.09.2022
Сессия для загрузки картинок
---------------------------------------------------------------------- */
$_SESSION['page_id'] = $_GET['id'];
/* ----------------------------------------------------------------------
21.08.2022
Получаем список категорий
---------------------------------------------------------------------- */
$cats=\DB::getAll("SELECT * FROM `tovar_category`");
$smarty -> assign( 'cats', $cats );
/* ----------------------------------------------------------------------
23.08.2022
Получаем данные о товаре
05.09.2022
Получаем картинки
08.09.2022
Получаем характеристики
---------------------------------------------------------------------- */
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 ) );
}
/* ----------------------------------------------------------------------
05.09.2022
Сохраняем товар и открываем его сохраненную карточку
!!! Сохранение описания в json
---------------------------------------------------------------------- */
//if ( $_POST['act'] == 'addTovar' ) header ( 'Location: /a_new_tovar/' . $mod -> addTovar( $_POST ) );
/* ----------------------------------------------------------------------
06.09.2022
Редактируем товар
!!! Сохранение описания в json
---------------------------------------------------------------------- */
//if ( $_POST['act'] == 'editTovar' && ID ) $mod -> editTovar( $_POST, ID );
/* ----------------------------------------------------------------------
---------------------------------------------------------------------- */
?>