core/api/modules/my_orders/index.php

86 lines
2.8 KiB
PHP
Executable File
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 );
/* ----------------------------------------------------------------------
14.10.2022
Меню личного кабинета
---------------------------------------------------------------------- */
$smarty -> assign ( 'mnulk', MYDIR . '/skin/inc/mnulk.html');
/* ----------------------------------------------------------------------
01.05.2021
Личный кабинет
---------------------------------------------------------------------- */
if ( !$_SESSION['user_id'] && !ID ) header ( 'Location: /login/' );
$mod = new main ( BD_NAME, BD_TYPE, BD_HOST, BD_USER, BD_PWD, MOD );
/* ----------------------------------------------------------------------
03.06.2022
Чтобы html отображал ковычки в названии организации
---------------------------------------------------------------------- */
function qutes( $txt ){
$old = array( '"' );
$new = array( '&#34;' );
$txt = str_replace( $old, $new, $txt );
return $txt;
}
/* ----------------------------------------------------------------------
02.06.2022
Получаем информацию о пользователе
---------------------------------------------------------------------- */
//$user_info = $mod -> get_user_info();
//$smarty -> assign( 'user_info', $user_info );
/* ----------------------------------------------------------------------
03.06.2022
Ищем организацию по ИНН
---------------------------------------------------------------------- */
unset( $a );
$a['inn'] = $user_info['inn'];
$smarty -> assign ( 'org_naim', qutes ( $db -> get_val ( 'org', $a, 'txt' ) ) );
/* ----------------------------------------------------------------------
03.06.2022
Получаем список последних 20-и заказов
---------------------------------------------------------------------- */
$smarty -> assign ( 'orders', $mod -> get_orders() );
/* ----------------------------------------------------------------------
05.06.2022
Получаем адреса доставки
---------------------------------------------------------------------- */
unset ( $a );
$a['user_id']= $_SESSION['user_id'];
$smarty -> assign ( 'adresa', $db -> get_massiv( 'adres_dostavki', $a ) );
/* ----------------------------------------------------------------------
05.06.2022
Получаем историю заказов
---------------------------------------------------------------------- */
$orders = $mod->get_orders(); //wtf??
/*$db->or_by_desc = 1;
$orders=$db->get_massiv('order', $a, 'id', 20);
$db->or_by_desc = '';
/*
SELECT
Pieces, Price,
Pieces * Price as 'Total'
FROM myTable */
?>