Commit 1b674abf3e22cb193326e92d8687147fce744915
1 parent
2313d4ab
search discount
Showing
1 changed file
with
29 additions
and
9 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
... | ... | @@ -1408,7 +1408,25 @@ |
1408 | 1408 | unset($i['options']); |
1409 | 1409 | } |
1410 | 1410 | } |
1411 | - | |
1411 | + | |
1412 | + //discount | |
1413 | + $discount = $this->models->getDiscount()->getActiveData(); | |
1414 | + if (!empty($discount)) { | |
1415 | + $discount = $discount[0]; | |
1416 | + $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | |
1417 | + $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | |
1418 | + $discount['group_ids'] = explode(',', $discount['group_ids']); | |
1419 | + if ($discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($item_id, $discount['group_ids'])) { | |
1420 | + $discount = $discount['discount']; | |
1421 | + } | |
1422 | + else { | |
1423 | + $discount = 0; | |
1424 | + } | |
1425 | + } else { | |
1426 | + $discount = 0; | |
1427 | + } | |
1428 | + //vip | |
1429 | + $users_group_id = $this->session->get('users_group_id'); | |
1412 | 1430 | |
1413 | 1431 | if( $total_items['0']['total'] > \config::get( 'limits/items') ) |
1414 | 1432 | { |
... | ... | @@ -1436,14 +1454,16 @@ |
1436 | 1454 | ]; |
1437 | 1455 | |
1438 | 1456 | $this->view->setVars([ |
1439 | - 'groups' => $items, | |
1440 | - 'page' => $page, | |
1441 | - 'search' => $search, | |
1442 | - 'total' => $total_items['0']['total'], | |
1443 | - 'no_robots' => 1, | |
1444 | - 'meta_link_next' => $meta_link_next[1], | |
1445 | - 'meta_link_prev' => $meta_link_prev[1], | |
1446 | - 'paginate' => !empty($paginate['output']) ? $paginate['output'] : '' , | |
1457 | + 'groups' => $items, | |
1458 | + 'page' => $page, | |
1459 | + 'search' => $search, | |
1460 | + 'total' => $total_items['0']['total'], | |
1461 | + 'no_robots' => 1, | |
1462 | + 'meta_link_next' => $meta_link_next[1], | |
1463 | + 'meta_link_prev' => $meta_link_prev[1], | |
1464 | + 'paginate' => !empty($paginate['output']) ? $paginate['output'] : '' , | |
1465 | + 'discount' => $discount, | |
1466 | + 'users_group_id' => $users_group_id | |
1447 | 1467 | ]); |
1448 | 1468 | } |
1449 | 1469 | ... | ... |