Файл: page/shop/bestsellers.php
Строк: 42
<?php
$title = 'Хиты продаж';
require_once($_SERVER["DOCUMENT_ROOT"]."/inc/head.php");
if ($sys['modules']['shop'] == 1) {
if ($all_sell > 0) {
echo '<div class="title">Последние продажи</div>';
$sql = $connect->query("select * from `purchase` order by `id` desc limit 3")->fetchAll();
foreach ($sql as $row) {
echo '<div class="forlink">
<a href="/shop/product/'.$row['pid'].'" class="links">
<div class="wa-shop">
<div class="wa-screen">'.iconShop($row['pid']).'</div>
</div>
<div class="wa-shop wa-shop-info">
<div class="wa-shop-title">'.$row['name'].'</div>
<div class="wa-shop-text">
Сумма: <span class="wa-shop-price">'.rub($row['sum']).'</span><br/>
Дата продажи: '.daytime($row['time']).'
</div></div>
</a></div>';
}
}
echo '<div class="title">Хиты продаж ('.$count_shop_hits.')</div>';
if ($count_shop_hits == 0) {
echo '<div class="menu">Продаж нет.</div>';
} else {
$page = new Pagination($count_shop_hits, 10);
$data = $connect->prepare("select *, count(*) as `count`, sum(`sum`) as `summa` from `purchase` group by `pid` order by `count` desc, `summa` desc limit :start, 10");
$data->bindValue(':start', $page->start, PDO::PARAM_INT);
$data->execute();
$sql = $data->fetchAll();
foreach ($sql as $row) {
echo '<div class="forlink">
<a href="/shop/product/'.$row['pid'].'" class="links">
<div class="wa-shop">
<div class="wa-screen">'.iconShop($row['pid']).'</div>
</div>
<div class="wa-shop wa-shop-info">
<div class="wa-shop-title">'.$row['name'].'</div>
<div class="wa-shop-text">
Продаж: '.$row['count'].'<br/>
На сумму: <span class="wa-shop-price">'.rub($row['summa']).'</span>
</div></div>
</a></div>';
}
$page->navigation();
}
echo '<div class="forlink"><a href="/shop" class="links"><img src="/img/shop.png" alt="">Магазин скриптов</a></div>';
} else {
header('Location: /');
}
require($_SERVER["DOCUMENT_ROOT"]."/inc/foot.php");
?>