diff --git a/classes/ShopItem.php b/classes/ShopItem.php index b49a981..c27c107 100644 --- a/classes/ShopItem.php +++ b/classes/ShopItem.php @@ -34,33 +34,44 @@ class ShopItem extends Item */ public function printControls($shopType = false) { - switch ($shopType) { - default: - $btnValue = "Купить за " . intval($this->cost) . " кр."; - $btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand(); - break; - case 'ashop': - $btnValue = "Купить за " . intval($this->ecost) . " eкр."; - $btnLink = "/ashop.php?buy={$this->id}&rnd=" . mt_rand(); - break; - case 'sell': - $btnValue = "Продать"; - $btnLink = "/shop.php?sell={$this->id}&rnd=" . mt_rand(); - break; - case 'marketgetback': - $btnValue = "Снять с продажи"; - $btnLink = "?back={$this->id}&rnd=" . mt_rand(); - break; - case 'marketshowmore': - $btnValue = "Развернуть"; - $btnLink = "?otdel={$this->otdel}&set={$this->id}&rnd=" . mt_rand(); - break; - } + if ($shopType === 'marketput') { + echo << + + +
+ +BTN; - echo <<cost) . " кр."; + $btnLink = "/shop.php?buy={$this->id}&rnd=" . mt_rand(); + break; + case 'ashop': + $btnValue = "Купить за " . intval($this->ecost) . " eкр."; + $btnLink = "/ashop.php?buy={$this->id}&rnd=" . mt_rand(); + break; + case 'sell': + $btnValue = "Продать"; + $btnLink = "/shop.php?sell={$this->id}&rnd=" . mt_rand(); + break; + case 'marketgetback': + $btnValue = "Снять с продажи"; + $btnLink = "?back={$this->id}&rnd=" . mt_rand(); + break; + case 'marketshowmore': + $btnValue = "Развернуть"; + $btnLink = "?otdel={$this->otdel}&set={$this->id}&rnd=" . mt_rand(); + break; + } + + echo << BTN; - if ($this->count > 0) echo "
В наличии: {$this->count} штук"; + if ($this->count > 0) echo "
В наличии: {$this->count} штук"; + } } } \ No newline at end of file diff --git a/comission.php b/comission.php index 38f1920..9233446 100644 --- a/comission.php +++ b/comission.php @@ -50,7 +50,11 @@ if ($returningItemId) { } else $status = "Предмет не найден на полках магазина!"; } -if (isset($_POST['puttomarket']) AND $puttingItemPrice) echo "

WHOA!

"; +if (isset($_POST['putToMarket'])) { + if ($puttingItemPrice > 0) { + $dress = db::c()->query()->fetch_assoc(); + } else $status = "Хорошая попытка…"; +} if ($_GET['set']) { @@ -199,14 +203,6 @@ switch ($shopCategoryTypeNumber) { -
@@ -253,7 +249,8 @@ switch ($shopCategoryTypeNumber) { foreach ($iteminfo as $ii) { echo ""; - $ii->printImage(); ?> + $ii->printImage(); + $ii->printControls('marketput');?>

diff --git a/test.php b/test.php index d08accb..9e72101 100644 --- a/test.php +++ b/test.php @@ -15,16 +15,16 @@ require_once 'config.php'; # $items = []; foreach(фетч того ебучего массива as $value) {$items[$value['id']] = $value} $iteminfo =[]; -$result = db::c()->query('SELECT `shop`.*, - `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` - -FROM `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE count > 0 LIMIT 25'); +//$result = db::c()->query('SELECT `shop`.*, +// `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` +// +//FROM `shop` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE count > 0 LIMIT 25'); $result2 = db::c()->query('SELECT `inventory`.*, `magic`.`name` AS `magic_name`, `magic`.`chanse` AS `magic_chanse`, @@ -33,9 +33,9 @@ $result2 = db::c()->query('SELECT `inventory`.*, `magic`.`targeted` AS `magic_targeted`, `magic`.`needcharge` AS `magic_needcharge`, `magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE owner = 11263'); -while ($row = $result->fetch_assoc()) { - $iteminfo[] = new ShopItem($row); -} +//while ($row = $result->fetch_assoc()) { +// $iteminfo[] = new ShopItem($row); +//} while ($row = $result2->fetch_assoc()) { $iteminfo[] = new InventoryItem($row);