bying without function

This commit is contained in:
Igor Barkov [iwork] 2019-02-15 18:39:47 +02:00
parent 59e79ae66a
commit 59aef83c9a
3 changed files with 30 additions and 17 deletions

View File

@ -85,6 +85,7 @@ abstract class Item
public $onlyone; public $onlyone;
public $shshop; public $shshop;
public $otdel; public $otdel;
public $setsale;
/** /**

View File

@ -61,8 +61,8 @@ BTN;
$btnValue = "Снять с продажи"; $btnValue = "Снять с продажи";
$btnLink = "?back={$this->id}&rnd=" . mt_rand(); $btnLink = "?back={$this->id}&rnd=" . mt_rand();
break; break;
case 'marketshowmore': case 'marketbuy':
$btnValue = "Развернуть"; $btnValue = "Купить " . intval($this->setsale) . " кр.";
$btnLink = "?otdel={$this->otdel}&set={$this->id}&rnd=" . mt_rand(); $btnLink = "?otdel={$this->otdel}&set={$this->id}&rnd=" . mt_rand();
break; break;
} }

View File

@ -134,6 +134,24 @@ FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `setsale` > 0
} }
} }
if (isset($_GET['max'])) {
$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 `name` LIKE "?S" AND `setsale` > 0 ORDER BY `setsale` ASC', $_GET['max'].'%');
$iteminfo = [];
while ($row = $data->fetch_assoc()) {
$iteminfo[] = new ShopItem($row);
}
}
$shopCategoryTypeNumber = empty($_GET['otdel']) ?: $_GET['otdel']; $shopCategoryTypeNumber = empty($_GET['otdel']) ?: $_GET['otdel'];
switch ($shopCategoryTypeNumber) { switch ($shopCategoryTypeNumber) {
default: default:
@ -222,23 +240,17 @@ switch ($shopCategoryTypeNumber) {
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5"> <TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
<?php <?php
if (isset($_GET['max'])) { if (isset($_GET['max'])) {
$name = $_GET['max'].'%';
$data = db::c()->query('SELECT * FROM `inventory` WHERE `dressed` = 0 AND `name` LIKE "?S" AND `setsale` > 0 ORDER BY `setsale` ASC', $name);
while ($row = $data->fetch_assoc()) { foreach ($iteminfo as $ii) {
$row['cost'] = $row['setsale']; echo "<tr><td style='width: 150px; text-align: center;'>";
?> $ii->printImage();
$ii->printControls('marketbuy');
<TR> echo "</td>";
<TD align=center style="width:150px"><IMG SRC="i/sh/<?= $row['img'] ?>"> echo "<td style='vertical-align: top;'>";
<BR> <A HREF="?otdel=<?= $_GET['otdel'] ?>&set=<?= $row['id'] ?>&sid=">купить</A> $ii->printInfo();
</TD> echo "</td></tr>";
<TD valign=top>
<?php showitem($row); ?>
</TD>
</TR>
<?php
} }
} elseif ($get === 'sale') { } elseif ($get === 'sale') {
foreach ($iteminfo as $ii) { foreach ($iteminfo as $ii) {