From 37fbf05862af498c782cdd6ea41a7a617bb06743 Mon Sep 17 00:00:00 2001 From: grandeljay Date: Wed, 18 Oct 2023 01:14:01 +0200 Subject: [PATCH] fix(wish): #107 price not setting --- src/classes/wishthis/Wish.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/classes/wishthis/Wish.php b/src/classes/wishthis/Wish.php index 41203dd2..60929946 100644 --- a/src/classes/wishthis/Wish.php +++ b/src/classes/wishthis/Wish.php @@ -50,9 +50,10 @@ class Wish global $database; $wishQuery = $database->query( - 'SELECT * - FROM `wishes` - WHERE `wishes`.`id` = :wish_id', + ' SELECT `wishes`.*, `products`.`price` + FROM `wishes` + LEFT JOIN `products` ON `wishes`.`id` = `products`.`wish` + WHERE `wishes`.`id` = :wish_id', array( 'wish_id' => $wishId, ) @@ -186,6 +187,7 @@ class Wish $this->status = $wishData['status']; $this->is_purchasable = $wishData['is_purchasable']; $this->edited = $wishData['edited'] ? \strtotime($wishData['edited']) : null; + $this->price = $wishData['price'] ?? null; } public function getCard(int $ofUser): string @@ -422,6 +424,7 @@ class Wish 'status' => $this->status, 'is_purchasable' => $this->is_purchasable, 'edited' => $this->edited, + 'price' => $this->price, ); return $wishArray;