core/api/modules/robo/index.php

23 lines
700 B
PHP
Raw Normal View History

2022-12-11 13:55:49 +05:00
<?php
//узнаем сумму оплаты
if ( $_SESSION['user_id'] ){
//узнаем email
unset( $a );
$a['id'] = $_SESSION['user_id'];
$email = $db -> get_val ('users', $a, 'email');
$smarty -> assign( 'email', $email );
unset( $a['id'] );
$a['user_id'] = $_SESSION['user_id'];
}else
$a['user_id'] = session_id();
$a['status'] = 0;
$massiv = $db -> get_massiv( 'cart', $a );
$num = count( $massiv );
$itog = 0;
for( $i = 0; $i < $num; $i++ ){
if ( $massiv[$i]['id'] ) $itog = $itog + $massiv[$i]['cena'];
}
//Делаем скидку
if ( $_SESSION['user_id'] && $itog>=400 ) $itog = $itog - 200;
$smarty -> assign( 'itog', $itog );
?>