From 964d0fa1a113b2eb13576f88e713a13c5ca08d5d Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Thu, 14 Apr 2022 10:38:13 +0200 Subject: [PATCH] Add default wish order --- src/classes/wishlist.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/classes/wishlist.php b/src/classes/wishlist.php index d362c6e9..74a8a1c4 100644 --- a/src/classes/wishlist.php +++ b/src/classes/wishlist.php @@ -56,14 +56,16 @@ class Wishlist { global $database; - $SELECT = isset($sql['SELECT']) ? $sql['SELECT'] : '*'; - $FROM = isset($sql['FROM']) ? $sql['FROM'] : '`wishes`'; - $WHERE = isset($sql['WHERE']) ? $sql['WHERE'] : '`wishlist` = ' . $this->id; + $SELECT = isset($sql['SELECT']) ? $sql['SELECT'] : '*'; + $FROM = isset($sql['FROM']) ? $sql['FROM'] : '`wishes`'; + $WHERE = isset($sql['WHERE']) ? $sql['WHERE'] : '`wishlist` = ' . $this->id; + $ORDER_BY = isset($sql['ORDER_BY']) ? $sql['ORDER_BY'] : '`priority` DESC, `title` ASC, `url` ASC'; $this->wishes = $database ->query('SELECT ' . $SELECT . ' FROM ' . $FROM . ' - WHERE ' . $WHERE . ';') + WHERE ' . $WHERE . ' + ORDER BY ' . $ORDER_BY . ';') ->fetchAll(); foreach ($this->wishes as &$wish) {