Commit df3960f0ab5a003c8f7e7ea561e9913a12922715
Merge branch 'discount' of gitlab.artweb.com.ua:Alex/semena
Showing
2 changed files
with
15 additions
and
3 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
| @@ -704,6 +704,14 @@ | @@ -704,6 +704,14 @@ | ||
| 704 | $catalog_sales[] = $active_sales[$k]; | 704 | $catalog_sales[] = $active_sales[$k]; |
| 705 | } | 705 | } |
| 706 | } | 706 | } |
| 707 | + | ||
| 708 | + $discount = $this->models->getDiscount()->getActiveData(); | ||
| 709 | + if (!empty($discount)) { | ||
| 710 | + $discount = $discount[0]; | ||
| 711 | + $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | ||
| 712 | + $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | ||
| 713 | + $discount['group_ids'] = explode(',', $discount['group_ids']); | ||
| 714 | + } | ||
| 707 | 715 | ||
| 708 | $cssSale = [ | 716 | $cssSale = [ |
| 709 | 'https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic', | 717 | 'https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic', |
| @@ -745,8 +753,9 @@ | @@ -745,8 +753,9 @@ | ||
| 745 | 'meta_link_next' => $meta_link_next[1], | 753 | 'meta_link_next' => $meta_link_next[1], |
| 746 | 'meta_link_prev' => $meta_link_prev[1], | 754 | 'meta_link_prev' => $meta_link_prev[1], |
| 747 | 'catalog_sales' => $catalog_sales, | 755 | 'catalog_sales' => $catalog_sales, |
| 748 | - 'css' => $cssSale, | ||
| 749 | - 'js' => $jsSale | 756 | + 'css' => $cssSale, |
| 757 | + 'js' => $jsSale, | ||
| 758 | + 'discount' => $discount | ||
| 750 | ]); | 759 | ]); |
| 751 | } | 760 | } |
| 752 | 761 |
src/app/frontend/views/page/subtype.php
| @@ -197,7 +197,10 @@ | @@ -197,7 +197,10 @@ | ||
| 197 | $minPrice = 0; | 197 | $minPrice = 0; |
| 198 | ?> | 198 | ?> |
| 199 | <?php foreach ($groups as $k => $i): ?> | 199 | <?php foreach ($groups as $k => $i): ?> |
| 200 | - <?php $this->partial('partial/item_group', ['k' => $k, 'i' => $i, 'limit' => 3, 'discount' => $discount]) ?> | 200 | + <?php |
| 201 | + if (empty($discount)) $discount = 0; | ||
| 202 | + $this->partial('partial/item_group', ['k' => $k, 'i' => $i, 'limit' => 3, 'discount' => $discount]) | ||
| 203 | + ?> | ||
| 201 | <?php | 204 | <?php |
| 202 | if ($i['price'] > $maxPrice) { | 205 | if ($i['price'] > $maxPrice) { |
| 203 | $maxPrice = $i['price']; | 206 | $maxPrice = $i['price']; |