virt2/api/code/my_orders.php_1595870255.old

28 lines
795 B
Plaintext
Executable File

<?php
//Новые заказы:
unset($tmp);
$tmp['user_id']=$_SESSION['user_id'];
$tmp['status']=0;
$new_orders = $db -> get_massiv('orders', $tmp);
unset($tmp);
$num0=$db->num;
$tmp['id']=$_SESSION['user_id'];
$tmp['status']='z';
$tovar = $db -> get_massiv('cart', $tmp);
$num=$db->num;
//echo $num;
for($j = 0; $j < $num0; $j++){
for($i = 0; $i < $num; $i++){
unset($a);
$a['id']=$tovar[$i]['tovar_id'];
$cena=$db->get_val('m_tovar', $a, 'cena') * $tovar[$i]['col'];
$akccena=$db->get_val('m_tovar', $a, 'akccena') * $tovar[$i]['col'];
if ($akccena>0)$cenar=$akccena;else $cenar=$cena;
$new_orders[$j]['itog'] = $new_orders[$j]['itog'] + $cenar;
unset($cena);
}
}
//print_r($tovar);
//print_r($new_orders);
$smarty -> assign( 'new_orders', $new_orders);
?>