prokat/api/modules/cart/index.php
2025-06-16 18:28:08 +05:00

32 lines
1.3 KiB
PHP
Executable File

<?php
ini_set('display_errors', 0);
class modClass
{
static function setStat($id){
}
}
$user=($_SESSION['user_id'])?$_SESSION['user_id']:session_id();
$array = DBmysql::getAll("SELECT tovar.title, cart.kolvo, tovar.json, cart.id as id, cart.tarif,cart.tovar_id FROM cart JOIN tovar ON tovar.id=cart.tovar_id WHERE cart.order IS NULL AND cart.user_id=?", $user);
//SELECT tovar.id as tovar_id, tovar.title, tovar.cena, , cart.kolvo, cart.id as id, cart.tarif FROM tovar, cart WHERE cart.user_id=? AND cart.order IS NULL AND tovar.id=cart.tovar_id
$c = count($array);
for ($i = 0; $i < $c; $i++) {
$m = core::j($array[$i]['json']);
$array[$i]['img'] = $m['images'][0];
$array[$i]['artikul'] = ($m['artikul']) ? $m['artikul'] : $m['code'];
$row=DBmysql::getRow("SELECT * FROM `cenaarendy` WHERE `tovar_id`=? LIMIT 1", $array[$i]['tovar_id']);
$array[$i]['mincena']=$row['ch4'];
$array[$i]['arenda']=core::j($row);
$tarif_cena=DBmysql::getValue("SELECT `" . $array[$i]['tarif'] . "` FROM `cenaarendy` WHERE `tovar_id`=? LIMIT 1", $array[$i]['tovar_id']);
$array[$i]['itog']=$tarif_cena*$array[$i]['kolvo'];
$itog=$itog+$array[$i]['itog'];
}
$smarty -> assign( 'list', $array );
$smarty -> assign( 'itog', $itog );
//print_r($array);
?>