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 ); ?>