added search, removed categories
This commit is contained in:
parent
d6444a8e96
commit
920c524f40
@ -101,13 +101,9 @@ if ($get === 'sale') {
|
||||
0 AS `maxdur`
|
||||
|
||||
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `setsale` = 0 AND `dressed` = 0 AND `present` = "?s" AND `owner` = ?i ORDER BY `update` DESC ', '', $_SESSION['uid']);
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
}
|
||||
}
|
||||
|
||||
if ($get === 'unsale') {
|
||||
elseif ($get === 'unsale') {
|
||||
$data = db::c()->query('SELECT `inventory`.*,
|
||||
`magic`.`name` AS `magic_name`,
|
||||
`magic`.`chanse` AS `magic_chanse`,
|
||||
@ -119,13 +115,9 @@ if ($get === 'unsale') {
|
||||
0 AS `maxdur`
|
||||
|
||||
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `setsale` > 0 AND `dressed` = 0 AND `owner` = ?i ORDER BY `update` DESC', $_SESSION['uid']);
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['max'])) {
|
||||
else if (!empty($_POST['search'])) {
|
||||
$data = db::c()->query('SELECT `inventory`.*,
|
||||
`magic`.`name` AS `magic_name`,
|
||||
`magic`.`chanse` AS `magic_chanse`,
|
||||
@ -136,11 +128,26 @@ if (isset($_GET['max'])) {
|
||||
`magic`.`img` AS `magic_img`,
|
||||
0 AS `maxdur`
|
||||
|
||||
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `dressed` = 0 AND `inventory`.`name` LIKE "?S%" AND `setsale` > 0 ORDER BY `setsale` ASC', $_GET['max']);
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
}
|
||||
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `dressed` = 0 AND `inventory`.`name` LIKE "%?S%" AND `setsale` > 0 ORDER BY `setsale` ASC', $_POST['search']);
|
||||
}
|
||||
|
||||
else {
|
||||
$data = db::c()->query('SELECT `inventory`.*,
|
||||
`magic`.`name` AS `magic_name`,
|
||||
`magic`.`chanse` AS `magic_chanse`,
|
||||
`magic`.`time` AS `magic_time`,
|
||||
`magic`.`file` AS `magic_file`,
|
||||
`magic`.`targeted` AS `magic_targeted`,
|
||||
`magic`.`needcharge` AS `magic_needcharge`,
|
||||
`magic`.`img` AS `magic_img`,
|
||||
0 AS `maxdur`
|
||||
|
||||
FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `dressed` = 0 AND `setsale` > 0 ORDER BY `setsale` ASC');
|
||||
}
|
||||
|
||||
$iteminfo = [];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$iteminfo[] = new ShopItem($row);
|
||||
}
|
||||
|
||||
?>
|
||||
@ -169,7 +176,9 @@ FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `dressed` = 0
|
||||
else {
|
||||
echo <<<MARKET
|
||||
Список товаров.<br>
|
||||
<input name="search" disabled> <input type="submit" value="Искать товар" disabled>
|
||||
<form method="post">
|
||||
<input name="search"> <input type="submit" value="Искать товар">
|
||||
</form>
|
||||
MARKET;
|
||||
} ?>
|
||||
</TH>
|
||||
@ -178,17 +187,7 @@ MARKET;
|
||||
<TD><!--Рюкзак-->
|
||||
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
|
||||
<?php
|
||||
if (isset($_GET['max'])) {
|
||||
foreach ($iteminfo as $ii) {
|
||||
echo "<tr><td style='width: 150px; text-align: center;'>";
|
||||
$ii->printImage();
|
||||
$ii->printControls('marketbuy');
|
||||
echo "</td>";
|
||||
echo "<td style='vertical-align: top;'>";
|
||||
$ii->printInfo();
|
||||
echo "</td></tr>";
|
||||
}
|
||||
} elseif ($get === 'sale') {
|
||||
if ($get === 'sale') {
|
||||
foreach ($iteminfo as $ii) {
|
||||
echo "<tr><td style='width: 150px; text-align: center;'>";
|
||||
$ii->printImage();
|
||||
@ -209,26 +208,14 @@ MARKET;
|
||||
echo "</td></tr>";
|
||||
}
|
||||
} else {
|
||||
$data = db::c()->query('SELECT DISTINCT `img`, `name`, `nalign`, `massa` FROM `inventory` WHERE `dressed` = 0 AND `setsale` > 0 AND `present` = "?s" GROUP BY `img` ORDER BY `cost` ASC', '');
|
||||
$replacements = ['+1', '+2', '+3', '+4', '+5', ' (мф)'];
|
||||
while ($row = $data->fetch_assoc()) {
|
||||
$item_name = str_replace($replacements, '', $row['name']);
|
||||
$item = db::c()->query('SELECT COUNT(`id`), MIN(`duration`), MIN(`maxdur`), MAX(`duration`), MAX(`maxdur`), MIN(`setsale`), MAX(`setsale`) FROM `inventory` WHERE `dressed` = 0 AND `setsale` > 0 AND `present` = "?s" AND `name` LIKE "?S%"', '', $item_name)->fetch_row();
|
||||
?>
|
||||
<TR>
|
||||
<TD align=center>
|
||||
<IMG SRC="i/sh/<?= $row['img'] ?>" ALT="">
|
||||
<BR><A HREF="?max=<?= $item_name ?>">подробнее</A>
|
||||
</TD>
|
||||
<TD valign=top>
|
||||
<?= $item_name ?>
|
||||
<?php if ($row['nalign']): ?><img src="i/align_<?= $row['nalign'] ?>.gif"> <?php endif; ?>
|
||||
(Масса: <?= $row['massa'] ?>) <BR> <small>(количество: <?= $item[0] ?>)</small><br>
|
||||
<b>Цена: <?= round($item[5], 2) ?> - <?= round($item[6], 2) ?> кр.</b>
|
||||
<BR>Долговечность: <?= $item[1] ?>-<?= $item[2] ?>/<?= $item[3] ?>-<?= $item[4] ?><BR>
|
||||
</TD>
|
||||
</TR>
|
||||
<?
|
||||
foreach ($iteminfo as $ii) {
|
||||
echo "<tr><td style='width: 150px; text-align: center;'>";
|
||||
$ii->printImage();
|
||||
$ii->printControls('marketbuy');
|
||||
echo "</td>";
|
||||
echo "<td style='vertical-align: top;'>";
|
||||
$ii->printInfo();
|
||||
echo "</td></tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user