Commit e0dcb7a3c42dc132ff22d16e0377866ab3c6d0a8
1 parent
b8583ddf
prices
Showing
2 changed files
with
28 additions
and
0 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
@@ -137,6 +137,7 @@ | @@ -137,6 +137,7 @@ | ||
137 | } | 137 | } |
138 | 138 | ||
139 | $discount = $this->models->getDiscount()->getOneData(4); | 139 | $discount = $this->models->getDiscount()->getOneData(4); |
140 | + | ||
140 | $discount = $discount[0]['discount']; | 141 | $discount = $discount[0]['discount']; |
141 | 142 | ||
142 | $css = [ | 143 | $css = [ |
src/lib/models/discount.php
@@ -55,6 +55,33 @@ class discount extends \db | @@ -55,6 +55,33 @@ class discount extends \db | ||
55 | 55 | ||
56 | 56 | ||
57 | /** | 57 | /** |
58 | + * Get actual discount | ||
59 | + * @param $id | ||
60 | + * @return array | ||
61 | + */ | ||
62 | + public function getActiveData($id) | ||
63 | + { | ||
64 | + return $this->get( | ||
65 | + ' | ||
66 | + SELECT * | ||
67 | + FROM public.discount | ||
68 | + WHERE | ||
69 | + id = :id | ||
70 | + AND | ||
71 | + current_timestamp > start_date | ||
72 | + AND | ||
73 | + current_timestamp < end_date | ||
74 | + | ||
75 | + ', | ||
76 | + [ | ||
77 | + 'id' => $id | ||
78 | + ], | ||
79 | + -1 | ||
80 | + ); | ||
81 | + } | ||
82 | + | ||
83 | + | ||
84 | + /** | ||
58 | * Delete discount with `id`=$id | 85 | * Delete discount with `id`=$id |
59 | * @param $id | 86 | * @param $id |
60 | * @return bool | 87 | * @return bool |