core/api/modules/lk-adresa-dostavki/index.php

45 lines
2.2 KiB
PHP

<?php
ini_set('display_errors', 0 );
if ( !$_SESSION['user_id'] && !ID ) header ( 'Location: /login/' );
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 );
/* ----------------------------------------------------------------------
15.10.2022
Получаем список регионов
---------------------------------------------------------------------- */
$strana_id = $db -> settings['strana'];
$region = DB::getAll('SELECT * FROM `region` WHERE `strana_id` = ' . $strana_id);
$smarty -> assign( 'region', $region );
/* ----------------------------------------------------------------------
15.10.2022
Получаем список городов
---------------------------------------------------------------------- */
$city = DB::getAll('SELECT * FROM `city` WHERE `strana_id` = ' . $strana_id);
$smarty -> assign( 'city', $city );
/* ----------------------------------------------------------------------
23.11.2022
Получаем список городов доставки
---------------------------------------------------------------------- */
$adresa = DB::getAll('SELECT * FROM `adres_dostavki` WHERE `user_id` = ' . $_SESSION['user_id']);
for ($i=0; $i<count($adresa); $i++){
$adresa[$i]['street']= DB::getValue("SELECT `txt` FROM `street` WHERE `id` = " . $adresa[$i]['street']);
$adresa[$i]['city']= DB::getValue("SELECT `txt` FROM `city` WHERE `id` = " . $adresa[$i]['city_id']);
}
$smarty -> assign( 'adresa', $adresa );
?>