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 $shshop;
public $otdel;
public $setsale;
/**

View File

@ -61,8 +61,8 @@ BTN;
$btnValue = "Снять с продажи";
$btnLink = "?back={$this->id}&rnd=" . mt_rand();
break;
case 'marketshowmore':
$btnValue = "Развернуть";
case 'marketbuy':
$btnValue = "Купить " . intval($this->setsale) . " кр.";
$btnLink = "?otdel={$this->otdel}&set={$this->id}&rnd=" . mt_rand();
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'];
switch ($shopCategoryTypeNumber) {
default:
@ -222,23 +240,17 @@ switch ($shopCategoryTypeNumber) {
<TABLE BORDER=0 WIDTH=100% CELLSPACING="1" CELLPADDING="2" BGCOLOR="#A5A5A5">
<?php
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()) {
$row['cost'] = $row['setsale'];
?>
<TR>
<TD align=center style="width:150px"><IMG SRC="i/sh/<?= $row['img'] ?>">
<BR> <A HREF="?otdel=<?= $_GET['otdel'] ?>&set=<?= $row['id'] ?>&sid=">купить</A>
</TD>
<TD valign=top>
<?php showitem($row); ?>
</TD>
</TR>
<?php
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') {
foreach ($iteminfo as $ii) {