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 | 143 | |
144 | 144 | //discount |
145 | 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 | 148 | //vip |
153 | 149 | $users_group_id = $this->session->get('users_group_id'); |
154 | 150 | |
... | ... | @@ -445,12 +441,8 @@ |
445 | 441 | |
446 | 442 | //discount |
447 | 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 | 446 | //vip |
455 | 447 | $users_group_id = $this->session->get('users_group_id'); |
456 | 448 | |
... | ... | @@ -719,12 +711,8 @@ |
719 | 711 | |
720 | 712 | //discount |
721 | 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 | 716 | //vip |
729 | 717 | $users_group_id = $this->session->get('users_group_id'); |
730 | 718 | |
... | ... | @@ -939,12 +927,8 @@ |
939 | 927 | |
940 | 928 | //discount |
941 | 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 | 932 | //vip |
949 | 933 | $users_group_id = $this->session->get('users_group_id'); |
950 | 934 | |
... | ... | @@ -1130,10 +1114,8 @@ |
1130 | 1114 | //discount |
1131 | 1115 | $discount = $this->models->getDiscount()->getActiveData(); |
1132 | 1116 | if (!empty($discount)) { |
1117 | + $discount = $this->models->getDiscount()->explodeGroupIds($discount); | |
1133 | 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 | 1119 | if ($discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($item_id, $discount['group_ids'])) { |
1138 | 1120 | $discount = $discount['discount']; |
1139 | 1121 | } |
... | ... | @@ -1443,12 +1425,6 @@ |
1443 | 1425 | $discount = $this->models->getDiscount()->getActiveData(); |
1444 | 1426 | $discount = $this->models->getDiscount()->explodeGroupIds($discount); |
1445 | 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 | 1429 | $this->view->setVars([ |
1454 | 1430 | 'groups' => $items, | ... | ... |
src/app/frontend/views/page/search.php
... | ... | @@ -58,7 +58,7 @@ |
58 | 58 | <?php if( !empty( $groups ) ): ?> |
59 | 59 | <div class="items clearfix"> |
60 | 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 | 62 | endforeach; ?> |
63 | 63 | </div> |
64 | 64 | <?php endif; ?> | ... | ... |
src/app/frontend/views/partial/item_group.php
1 | 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 | 24 | <div class="one_item_image"> |
20 | 25 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="<?= $i['title'] ?>" style="position:relative;"> |
21 | 26 | <?php if($i['count_available'] == 0){ |
... | ... | @@ -25,41 +30,48 @@ |
25 | 30 | <img src="<?= $i['cover'] ?>" alt="<?= $i['title'] ?>" width="126" height="200" /> |
26 | 31 | </a> |
27 | 32 | </div> |
33 | + | |
28 | 34 | <div class="one_item_title"> |
29 | 35 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="<?= $i['title'] ?>"> |
30 | 36 | <h3><?= \plugins::getShortText($i['title']) ?></h3> |
31 | 37 | </a> |
32 | 38 | </div> |
39 | + | |
33 | 40 | <div class="align_bottom"> |
41 | + | |
34 | 42 | <div class="one_item_price"> |
35 | 43 | <?= $t->_("price_from") ?> |
36 | 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 | 59 | else { |
48 | 60 | echo '<span>'.$i['price'].'</span> грн'; |
49 | 61 | } |
50 | - } | |
51 | - else { | |
52 | - echo '<span>'.$i['price'].'</span> грн'; | |
53 | - } | |
54 | 62 | ?> |
55 | 63 | </div> |
64 | + | |
56 | 65 | <div class="one_item_buttons"> |
57 | 66 | <a href="<?= $this->seoUrl->setUrl($i['alias']) ?>" title="" class="btn grey"><?= $t->_("details") ?></a> |
58 | 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 | 68 | </div> |
69 | + | |
60 | 70 | <div class="one_item_compare"> |
61 | 71 | <input type="checkbox" id="items_compare_item_<?= $i['id'] ?>" value="<?= $i['type_id'].'-'.$i['catalog'].'-'.$i['id'] ?>" <?= ( !empty($i['checked']) ? 'checked' : '' ) ?> /> |
62 | 72 | <label for="items_compare_item_<?= $i['id'] ?>"><span></span><?= $t->_("compared_to") ?></label> |
63 | 73 | </div> |
74 | + | |
64 | 75 | </div> |
76 | + | |
65 | 77 | </div> |
66 | 78 | \ No newline at end of file | ... | ... |