From 3c0a3477639791c5a042dcac24f39c5d162a5eb3 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 20 Dec 2016 18:45:16 +0200 Subject: [PATCH] add/edit --- src/app/frontend/controllers/PageController.php | 6 +++++- src/app/frontend/views/page/index.php | 2 +- src/app/frontend/views/partial/item_group.php | 12 +++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/app/frontend/controllers/PageController.php b/src/app/frontend/controllers/PageController.php index 2e4c1c9..a370f75 100644 --- a/src/app/frontend/controllers/PageController.php +++ b/src/app/frontend/controllers/PageController.php @@ -135,6 +135,9 @@ $timestamp_left = $left_date->getTimestamp(); $active_sales[$k]['seconds_left'] = $timestamp_left - $now; } + + $discount = $this->models->getDiscount()->getOneData(4); + $discount = $discount['discount']; $css = [ '/landing_sales/style.css', @@ -168,7 +171,8 @@ 'meta_title' => $meta_title[$this->lang_id], 'meta_description' => $meta_description[$this->lang_id], 'slider' => $slider, - 'active_sales' => $active_sales + 'active_sales' => $active_sales, + 'discount' => $discount ]); } diff --git a/src/app/frontend/views/page/index.php b/src/app/frontend/views/page/index.php index 7776af7..0d96fcd 100644 --- a/src/app/frontend/views/page/index.php +++ b/src/app/frontend/views/page/index.php @@ -158,7 +158,7 @@
$i ): ?> - partial('partial/item_group', ['k' => $k, 'i' => $i, 'limit' => 5]) ?> + partial('partial/item_group', ['k' => $k, 'i' => $i, 'limit' => 5, 'discount' => $this->discount]) ?>
diff --git a/src/app/frontend/views/partial/item_group.php b/src/app/frontend/views/partial/item_group.php index c114ebb..e838010 100644 --- a/src/app/frontend/views/partial/item_group.php +++ b/src/app/frontend/views/partial/item_group.php @@ -31,7 +31,17 @@
-
_("price_from") ?> грн
+
+ _("price_from") ?> + 0) { + echo ''.$i['price'].' грн'; + echo ''.($i['price']*(1-$discount/100)).' грн'; + } + else { + echo ''.$i['price'].' грн'; + } + ?> +
_("details") ?> _("buy") ?> -- libgit2 0.21.4