Commit 3c0a3477639791c5a042dcac24f39c5d162a5eb3
1 parent
0fd83787
add/edit
Showing
3 changed files
with
17 additions
and
3 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
... | ... | @@ -135,6 +135,9 @@ |
135 | 135 | $timestamp_left = $left_date->getTimestamp(); |
136 | 136 | $active_sales[$k]['seconds_left'] = $timestamp_left - $now; |
137 | 137 | } |
138 | + | |
139 | + $discount = $this->models->getDiscount()->getOneData(4); | |
140 | + $discount = $discount['discount']; | |
138 | 141 | |
139 | 142 | $css = [ |
140 | 143 | '/landing_sales/style.css', |
... | ... | @@ -168,7 +171,8 @@ |
168 | 171 | 'meta_title' => $meta_title[$this->lang_id], |
169 | 172 | 'meta_description' => $meta_description[$this->lang_id], |
170 | 173 | 'slider' => $slider, |
171 | - 'active_sales' => $active_sales | |
174 | + 'active_sales' => $active_sales, | |
175 | + 'discount' => $discount | |
172 | 176 | ]); |
173 | 177 | } |
174 | 178 | ... | ... |
src/app/frontend/views/page/index.php
... | ... | @@ -158,7 +158,7 @@ |
158 | 158 | <div class="items clearfix"> |
159 | 159 | |
160 | 160 | <?php foreach( $top_items as $k => $i ): ?> |
161 | - <?php $this->partial('partial/item_group', ['k' => $k, 'i' => $i, 'limit' => 5]) ?> | |
161 | + <?php $this->partial('partial/item_group', ['k' => $k, 'i' => $i, 'limit' => 5, 'discount' => $this->discount]) ?> | |
162 | 162 | <?php endforeach; ?> |
163 | 163 | </div> |
164 | 164 | </div> | ... | ... |
src/app/frontend/views/partial/item_group.php
... | ... | @@ -31,7 +31,17 @@ |
31 | 31 | </a> |
32 | 32 | </div> |
33 | 33 | <div class="align_bottom"> |
34 | - <div class="one_item_price"><?= $t->_("price_from") ?> <span><?= $i['price'] ?></span> грн</div> | |
34 | + <div class="one_item_price"> | |
35 | + <?= $t->_("price_from") ?> | |
36 | + <?php if (isset($discount) && $discount > 0) { | |
37 | + echo '<span style="text-decoration: line-through;"><span>'.$i['price'].'</span> грн</span>'; | |
38 | + echo '<span>'.($i['price']*(1-$discount/100)).'</span> грн'; | |
39 | + } | |
40 | + else { | |
41 | + echo '<span>'.$i['price'].'</span> грн'; | |
42 | + } | |
43 | + ?> | |
44 | + </div> | |
35 | 45 | <div class="one_item_buttons"> |
36 | 46 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="" class="btn grey"><?= $t->_("details") ?></a> |
37 | 47 | <a data-group_id="<?= $i['group_id'] ?>" href="javascript:;" title="" class="<?= $i['count_available'] != 0 ? 'btn green buy' : 'not_available grey'?>"><?= $t->_("buy") ?></a> | ... | ... |