Commit 49bb9727f0ebfabe2a1b55cb618ce1ecf7f4cd9a
1 parent
f72e1ce5
fix
Showing
3 changed files
with
52 additions
and
64 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
@@ -143,12 +143,8 @@ | @@ -143,12 +143,8 @@ | ||
143 | 143 | ||
144 | //discount | 144 | //discount |
145 | $discount = $this->models->getDiscount()->getActiveData(); | 145 | $discount = $this->models->getDiscount()->getActiveData(); |
146 | - if (!empty($discount)) { | ||
147 | - $discount = $discount[0]; | ||
148 | - $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | ||
149 | - $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | ||
150 | - $discount['group_ids'] = explode(',', $discount['group_ids']); | ||
151 | - } | 146 | + $discount = $this->models->getDiscount()->explodeGroupIds($discount); |
147 | + $discount = $discount[0]; | ||
152 | //vip | 148 | //vip |
153 | $users_group_id = $this->session->get('users_group_id'); | 149 | $users_group_id = $this->session->get('users_group_id'); |
154 | 150 | ||
@@ -445,12 +441,8 @@ | @@ -445,12 +441,8 @@ | ||
445 | 441 | ||
446 | //discount | 442 | //discount |
447 | $discount = $this->models->getDiscount()->getActiveData(); | 443 | $discount = $this->models->getDiscount()->getActiveData(); |
448 | - if (!empty($discount)) { | ||
449 | - $discount = $discount[0]; | ||
450 | - $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | ||
451 | - $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | ||
452 | - $discount['group_ids'] = explode(',', $discount['group_ids']); | ||
453 | - } | 444 | + $discount = $this->models->getDiscount()->explodeGroupIds($discount); |
445 | + $discount = $discount[0]; | ||
454 | //vip | 446 | //vip |
455 | $users_group_id = $this->session->get('users_group_id'); | 447 | $users_group_id = $this->session->get('users_group_id'); |
456 | 448 | ||
@@ -719,12 +711,8 @@ | @@ -719,12 +711,8 @@ | ||
719 | 711 | ||
720 | //discount | 712 | //discount |
721 | $discount = $this->models->getDiscount()->getActiveData(); | 713 | $discount = $this->models->getDiscount()->getActiveData(); |
722 | - if (!empty($discount)) { | ||
723 | - $discount = $discount[0]; | ||
724 | - $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | ||
725 | - $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | ||
726 | - $discount['group_ids'] = explode(',', $discount['group_ids']); | ||
727 | - } | 714 | + $discount = $this->models->getDiscount()->explodeGroupIds($discount); |
715 | + $discount = $discount[0]; | ||
728 | //vip | 716 | //vip |
729 | $users_group_id = $this->session->get('users_group_id'); | 717 | $users_group_id = $this->session->get('users_group_id'); |
730 | 718 | ||
@@ -939,12 +927,8 @@ | @@ -939,12 +927,8 @@ | ||
939 | 927 | ||
940 | //discount | 928 | //discount |
941 | $discount = $this->models->getDiscount()->getActiveData(); | 929 | $discount = $this->models->getDiscount()->getActiveData(); |
942 | - if (!empty($discount)) { | ||
943 | - $discount = $discount[0]; | ||
944 | - $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | ||
945 | - $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | ||
946 | - $discount['group_ids'] = explode(',', $discount['group_ids']); | ||
947 | - } | 930 | + $discount = $this->models->getDiscount()->explodeGroupIds($discount); |
931 | + $discount = $discount[0]; | ||
948 | //vip | 932 | //vip |
949 | $users_group_id = $this->session->get('users_group_id'); | 933 | $users_group_id = $this->session->get('users_group_id'); |
950 | 934 | ||
@@ -1130,10 +1114,8 @@ | @@ -1130,10 +1114,8 @@ | ||
1130 | //discount | 1114 | //discount |
1131 | $discount = $this->models->getDiscount()->getActiveData(); | 1115 | $discount = $this->models->getDiscount()->getActiveData(); |
1132 | if (!empty($discount)) { | 1116 | if (!empty($discount)) { |
1117 | + $discount = $this->models->getDiscount()->explodeGroupIds($discount); | ||
1133 | $discount = $discount[0]; | 1118 | $discount = $discount[0]; |
1134 | - $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | ||
1135 | - $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | ||
1136 | - $discount['group_ids'] = explode(',', $discount['group_ids']); | ||
1137 | if ($discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($item_id, $discount['group_ids'])) { | 1119 | if ($discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($item_id, $discount['group_ids'])) { |
1138 | $discount = $discount['discount']; | 1120 | $discount = $discount['discount']; |
1139 | } | 1121 | } |
@@ -1443,12 +1425,6 @@ | @@ -1443,12 +1425,6 @@ | ||
1443 | $discount = $this->models->getDiscount()->getActiveData(); | 1425 | $discount = $this->models->getDiscount()->getActiveData(); |
1444 | $discount = $this->models->getDiscount()->explodeGroupIds($discount); | 1426 | $discount = $this->models->getDiscount()->explodeGroupIds($discount); |
1445 | $discount = $discount[0]; | 1427 | $discount = $discount[0]; |
1446 | -// if (!empty($discount)) { | ||
1447 | -// $discount = $discount[0]; | ||
1448 | -// $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | ||
1449 | -// $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | ||
1450 | -// $discount['group_ids'] = explode(',', $discount['group_ids']); | ||
1451 | -// } | ||
1452 | 1428 | ||
1453 | $this->view->setVars([ | 1429 | $this->view->setVars([ |
1454 | 'groups' => $items, | 1430 | 'groups' => $items, |
src/app/frontend/views/page/search.php
@@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
58 | <?php if( !empty( $groups ) ): ?> | 58 | <?php if( !empty( $groups ) ): ?> |
59 | <div class="items clearfix"> | 59 | <div class="items clearfix"> |
60 | <?php foreach( $groups as $k => $i ): | 60 | <?php foreach( $groups as $k => $i ): |
61 | - $this->partial('partial/item_group', ['k' => $k, 'i' => $i, 'limit' => 3, 'discount' => $discount]); | 61 | + $this->partial('partial/item_group', ['k' => $k, 'i' => $i, 'limit' => 3]); |
62 | endforeach; ?> | 62 | endforeach; ?> |
63 | </div> | 63 | </div> |
64 | <?php endif; ?> | 64 | <?php endif; ?> |
src/app/frontend/views/partial/item_group.php
1 | <div class="one_item float <?= ( ($k+1) % $limit == 0 ? 'last' : '' ) ?>"> | 1 | <div class="one_item float <?= ( ($k+1) % $limit == 0 ? 'last' : '' ) ?>"> |
2 | - <?php /* | ||
3 | - <div class="new_top"> | ||
4 | - <?= ( isset( $i['is_new'] ) && !empty( $i['is_new'] ) | ||
5 | - ? | ||
6 | - '<div class="float"> | ||
7 | - <img src="/images/new.png" alt="Новинки" width="47" height="14" /> | ||
8 | - </div>' | ||
9 | - : | ||
10 | - ''). | ||
11 | - ( isset( $i['is_top'] ) && !empty( $i['is_top'] ) | ||
12 | - ? | ||
13 | - '<div class="float"> | ||
14 | - <img src="/images/top.png" alt="Топ продаж" width="63" height="14" /> | ||
15 | - </div>' | ||
16 | - : | ||
17 | - '') ?> | ||
18 | - </div>*/?> | 2 | + |
3 | + <?php | ||
4 | + /* | ||
5 | + <div class="new_top"> | ||
6 | + <?= ( isset( $i['is_new'] ) && !empty( $i['is_new'] ) | ||
7 | + ? | ||
8 | + '<div class="float"> | ||
9 | + <img src="/images/new.png" alt="Новинки" width="47" height="14" /> | ||
10 | + </div>' | ||
11 | + : | ||
12 | + ''). | ||
13 | + ( isset( $i['is_top'] ) && !empty( $i['is_top'] ) | ||
14 | + ? | ||
15 | + '<div class="float"> | ||
16 | + <img src="/images/top.png" alt="Топ продаж" width="63" height="14" /> | ||
17 | + </div>' | ||
18 | + : | ||
19 | + '') ?> | ||
20 | + </div> | ||
21 | + */ | ||
22 | + ?> | ||
23 | + | ||
19 | <div class="one_item_image"> | 24 | <div class="one_item_image"> |
20 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="<?= $i['title'] ?>" style="position:relative;"> | 25 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="<?= $i['title'] ?>" style="position:relative;"> |
21 | <?php if($i['count_available'] == 0){ | 26 | <?php if($i['count_available'] == 0){ |
@@ -25,41 +30,48 @@ | @@ -25,41 +30,48 @@ | ||
25 | <img src="<?= $i['cover'] ?>" alt="<?= $i['title'] ?>" width="126" height="200" /> | 30 | <img src="<?= $i['cover'] ?>" alt="<?= $i['title'] ?>" width="126" height="200" /> |
26 | </a> | 31 | </a> |
27 | </div> | 32 | </div> |
33 | + | ||
28 | <div class="one_item_title"> | 34 | <div class="one_item_title"> |
29 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="<?= $i['title'] ?>"> | 35 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="<?= $i['title'] ?>"> |
30 | <h3><?= \plugins::getShortText($i['title']) ?></h3> | 36 | <h3><?= \plugins::getShortText($i['title']) ?></h3> |
31 | </a> | 37 | </a> |
32 | </div> | 38 | </div> |
39 | + | ||
33 | <div class="align_bottom"> | 40 | <div class="align_bottom"> |
41 | + | ||
34 | <div class="one_item_price"> | 42 | <div class="one_item_price"> |
35 | <?= $t->_("price_from") ?> | 43 | <?= $t->_("price_from") ?> |
36 | <?php | 44 | <?php |
37 | - //vip | ||
38 | - if(isset($users_group_id) && $users_group_id == '37') { | ||
39 | - $i['price'] = round($i['price']*0.95, 1); | ||
40 | - } | ||
41 | - //discount | ||
42 | - if (!empty($discount)) { | ||
43 | - if ($discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($i['id'], $discount['group_ids'])) { | ||
44 | - echo '<span style="text-decoration: line-through;"><span>'.$i['price'].'</span></span> грн<br/>'; | ||
45 | - echo '<span>'.round($i['price']*(1-$discount['discount']/100), 1).'</span> грн'; | 45 | + //vip |
46 | + if(isset($users_group_id) && $users_group_id == '37') { | ||
47 | + $i['price'] = round($i['price']*0.95, 1); | ||
48 | + } | ||
49 | + //discount | ||
50 | + if (!empty($discount)) { | ||
51 | + if ($discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($i['id'], $discount['group_ids'])) { | ||
52 | + echo '<span style="text-decoration: line-through;"><span>'.$i['price'].'</span></span> грн<br/>'; | ||
53 | + echo '<span>'.round($i['price']*(1-$discount['discount']/100), 1).'</span> грн'; | ||
54 | + } | ||
55 | + else { | ||
56 | + echo '<span>'.$i['price'].'</span> грн'; | ||
57 | + } | ||
46 | } | 58 | } |
47 | else { | 59 | else { |
48 | echo '<span>'.$i['price'].'</span> грн'; | 60 | echo '<span>'.$i['price'].'</span> грн'; |
49 | } | 61 | } |
50 | - } | ||
51 | - else { | ||
52 | - echo '<span>'.$i['price'].'</span> грн'; | ||
53 | - } | ||
54 | ?> | 62 | ?> |
55 | </div> | 63 | </div> |
64 | + | ||
56 | <div class="one_item_buttons"> | 65 | <div class="one_item_buttons"> |
57 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="" class="btn grey"><?= $t->_("details") ?></a> | 66 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="" class="btn grey"><?= $t->_("details") ?></a> |
58 | <a data-group_id="<?= $i['group_id'] ?>" href="javascript:;" title="" class="<?= $i['count_available'] != 0 ? 'btn green buy' : 'not_available grey'?>"><?= $t->_("buy") ?></a> | 67 | <a data-group_id="<?= $i['group_id'] ?>" href="javascript:;" title="" class="<?= $i['count_available'] != 0 ? 'btn green buy' : 'not_available grey'?>"><?= $t->_("buy") ?></a> |
59 | </div> | 68 | </div> |
69 | + | ||
60 | <div class="one_item_compare"> | 70 | <div class="one_item_compare"> |
61 | <input type="checkbox" id="items_compare_item_<?= $i['id'] ?>" value="<?= $i['type_id'].'-'.$i['catalog'].'-'.$i['id'] ?>" <?= ( !empty($i['checked']) ? 'checked' : '' ) ?> /> | 71 | <input type="checkbox" id="items_compare_item_<?= $i['id'] ?>" value="<?= $i['type_id'].'-'.$i['catalog'].'-'.$i['id'] ?>" <?= ( !empty($i['checked']) ? 'checked' : '' ) ?> /> |
62 | <label for="items_compare_item_<?= $i['id'] ?>"><span></span><?= $t->_("compared_to") ?></label> | 72 | <label for="items_compare_item_<?= $i['id'] ?>"><span></span><?= $t->_("compared_to") ?></label> |
63 | </div> | 73 | </div> |
74 | + | ||
64 | </div> | 75 | </div> |
76 | + | ||
65 | </div> | 77 | </div> |
66 | \ No newline at end of file | 78 | \ No newline at end of file |