<?php
$title->SetTitle('Маркет - Моя корзина');
///Подключаем шапку
$title->GetHeader();
echo '<div class="container-fluid page_header"><div class="container"><div class="row"><div class="col-xs-12 col-sm-8 col-md-9 col-lg-9"><h1>Маркет - Моя корзина </h1><ol class="breadcrumb" xmlns:v="http://'.homeurl.'/#"><li typeof="v:Breadcrumb"><a href="/" rel="v:url" property="v:title">'.homeurl.'</a></li><li typeof="v:Breadcrumb"><a href="/market" rel="v:url" property="v:title">Маркет</a></li><li typeof="v:Breadcrumb"><a href="/market/uskab" rel="v:url" property="v:title">Кабинет</a></li><li class="active" typeof="v:Breadcrumb"><span property="v:title">Моя корзина </span></li></ol></div></div></div></div>';
echo'<div class="container page_body"><div class="row"><div class="col-xs-12 page_content col-lg-9"><div class="navbar page_content_navbar collapse hidden-lg"><div class="container-fluid"><div class="navbar-collapse"></div></div></div><div class="text_box hidden-lg pr_block_small hidden"></div><div class="container-fluid cols_table">';

echo '<div class="catSides"><a href="/market"><i class="md-format-list-bulleted"></i> Маркет</a> - <a href="uskab"> Кабинет </a> - Моя корзина</div>';
if (isset($_GET['del'])) {
$del = DB::$dbs->queryFetch("SELECT * FROM magazin_korz WHERE id = ? LIMIT 1", [abs((int)$_GET['del'])]);
if ($del['user_id'] == $b['id']) {
DB::$dbs->query("DELETE FROM magazin_korz WHERE id = ? LIMIT 1", [abs((int)$_GET['del'])]);
header('location: ?');
}
}
$count = DB::$dbs->querySingle("SELECT count(id) FROM magazin_korz WHERE user_id = ?", [$b['id']]);
$array = DB::$dbs->query("SELECT * FROM magazin_korz WHERE user_id = ? ORDER BY time DESC", [$b['id']]);
if ($count==0) {
echo '<div class="error">Корзина пуста</div>';
}
while($arr = $array->fetch()) {
$file = DB::$dbs->queryFetch("SELECT name,price,id FROM magazin_file WHERE id = ? LIMIT 1", [$arr['file']]);

$screen = DB::$dbs->queryFetch("SELECT * FROM `magazin_screen` WHERE `file` = ? ORDER BY `id` DESC LIMIT 1",[$file['id']]);
echo '<div class="row"><div class="col-xs-3 col-sm-1"><div class="user_brief"><div class="userpic" style="height: 50px;padding: 4px;width: 50px;"><a href="/files/mag_screen/'.$screen['screen'].'"><img class="img-responsive" src="/files/mag_screen/'.$screen['screen'].'" alt="" ></a></div></div></div><div class="col-xs-9 col-sm-8"><a class="title" href="/market/file/'.$file['id'].'"> '.$file['name'].' </a><div class="text-muted"> Стоимость: <b><font color="green">'.$file['price'].'</font></b> р.</div></div><div class="col-sm-3 text-muted text-right hidden-xs"><span data-toggle="tooltip" title="Удалить">[<a href="?del='.$arr['id'].'">Удл</a>]</span></div></div>';
}
?>