From 59aef83c9ad56b1b7c998e6ac64af1aed5a45baa Mon Sep 17 00:00:00 2001 From: "Igor Barkov [iwork]" Date: Fri, 15 Feb 2019 18:39:47 +0200 Subject: [PATCH] bying without function --- classes/Item.php | 1 + classes/ShopItem.php | 4 ++-- comission.php | 42 +++++++++++++++++++++++++++--------------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/classes/Item.php b/classes/Item.php index 38c8da9..751900c 100644 --- a/classes/Item.php +++ b/classes/Item.php @@ -85,6 +85,7 @@ abstract class Item public $onlyone; public $shshop; public $otdel; + public $setsale; /** diff --git a/classes/ShopItem.php b/classes/ShopItem.php index 90c6985..aa87a08 100644 --- a/classes/ShopItem.php +++ b/classes/ShopItem.php @@ -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; } diff --git a/comission.php b/comission.php index 27e2c37..e155e28 100644 --- a/comission.php +++ b/comission.php @@ -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) { 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']; - ?> - - - - - - "; + echo ""; } + } elseif ($get === 'sale') { foreach ($iteminfo as $ii) {
-
купить -
- -
"; + $ii->printImage(); + $ii->printControls('marketbuy'); + echo ""; + $ii->printInfo(); + echo "