Commit b88962e2a5292bd7e8cce60a712f3741d164a6b8
Merge branch 'discount' of gitlab.artweb.com.ua:Alex/semena
Conflicts: src/app/frontend/controllers/PageController.php
Showing
3 changed files
with
19 additions
and
5 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
| ... | ... | @@ -135,7 +135,10 @@ |
| 135 | 135 | $timestamp_left = $left_date->getTimestamp(); |
| 136 | 136 | $active_sales[$k]['seconds_left'] = $timestamp_left - $now; |
| 137 | 137 | } |
| 138 | - /* | |
| 138 | + | |
| 139 | + $discount = $this->models->getDiscount()->getOneData(4); | |
| 140 | + $discount = $discount['discount']; | |
| 141 | + | |
| 139 | 142 | $css = [ |
| 140 | 143 | '/landing_sales/style.css', |
| 141 | 144 | |
| ... | ... | @@ -171,7 +174,8 @@ |
| 171 | 174 | 'meta_title' => $meta_title[$this->lang_id], |
| 172 | 175 | 'meta_description' => $meta_description[$this->lang_id], |
| 173 | 176 | 'slider' => $slider, |
| 174 | - 'active_sales' => $active_sales | |
| 177 | + 'active_sales' => $active_sales, | |
| 178 | + 'discount' => $discount | |
| 175 | 179 | ]); |
| 176 | 180 | } |
| 177 | 181 | |
| ... | ... | @@ -1544,4 +1548,4 @@ |
| 1544 | 1548 | header(!empty($language) ? "Location:".$language : 'Location:/'); |
| 1545 | 1549 | } |
| 1546 | 1550 | |
| 1547 | - } | |
| 1548 | 1551 | \ No newline at end of file |
| 1552 | + } | ... | ... |
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> | ... | ... |