Commit 72eabfd36d0bb17cd1c2d51021bb29067e6fcd6e
1 parent
790a78e8
common
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
| ... | ... | @@ -1381,6 +1381,25 @@ |
| 1381 | 1381 | $total_items = $this->models->getItems()->getTotalItemsByTerm( $search ,$this->lang_id); |
| 1382 | 1382 | |
| 1383 | 1383 | $items = []; |
| 1384 | + | |
| 1385 | + //discount | |
| 1386 | + $discount = $this->models->getDiscount()->getActiveData(); | |
| 1387 | + if (!empty($discount)) { | |
| 1388 | + $discount = $discount[0]; | |
| 1389 | + $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | |
| 1390 | + $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | |
| 1391 | + $discount['group_ids'] = explode(',', $discount['group_ids']); | |
| 1392 | + if ($discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($item_id, $discount['group_ids'])) { | |
| 1393 | + $discount = $discount['discount']; | |
| 1394 | + } | |
| 1395 | + else { | |
| 1396 | + $discount = 0; | |
| 1397 | + } | |
| 1398 | + } else { | |
| 1399 | + $discount = 0; | |
| 1400 | + } | |
| 1401 | + //vip | |
| 1402 | + $users_group_id = $this->session->get('users_group_id'); | |
| 1384 | 1403 | |
| 1385 | 1404 | if( !empty( $items_ ) ) |
| 1386 | 1405 | { |
| ... | ... | @@ -1392,6 +1411,8 @@ |
| 1392 | 1411 | $i['cover'] = !empty( $i['group_cover'] ) ? $this->storage->getPhotoUrl( $i['group_cover'], 'avatar', '200x' ) : '/images/packet.jpg'; |
| 1393 | 1412 | $i['alias'] = $this->url->get([ 'for' => 'item', 'type' => $i['type_alias'], 'subtype' => $i['subtype_alias'], 'group_alias' => $i['group_alias'], 'item_id' => $i['id'] ]); |
| 1394 | 1413 | $i['price'] = $i['price2']; |
| 1414 | + if ($users_group_id == 38) | |
| 1415 | + $i['price'] = $i['price']*0.95; | |
| 1395 | 1416 | $i['type_id'] = $i['type']; |
| 1396 | 1417 | $i['id'] = $i['group_id']; |
| 1397 | 1418 | |
| ... | ... | @@ -1440,6 +1461,7 @@ |
| 1440 | 1461 | 'meta_link_next' => $meta_link_next[1], |
| 1441 | 1462 | 'meta_link_prev' => $meta_link_prev[1], |
| 1442 | 1463 | 'paginate' => !empty($paginate['output']) ? $paginate['output'] : '' , |
| 1464 | + 'discount' => $discount | |
| 1443 | 1465 | ]); |
| 1444 | 1466 | } |
| 1445 | 1467 | ... | ... |