Commit b6502ca282be5ed716211582c5451d1e4c92e279
1 parent
72eabfd3
common
Showing
1 changed file
with
24 additions
and
1 deletions
Show diff stats
src/app/frontend/controllers/PageController.php
@@ -1549,9 +1549,31 @@ | @@ -1549,9 +1549,31 @@ | ||
1549 | } | 1549 | } |
1550 | } | 1550 | } |
1551 | } | 1551 | } |
1552 | + | ||
1553 | + //discount | ||
1554 | + $discount = $this->models->getDiscount()->getActiveData(); | ||
1555 | + if (!empty($discount)) { | ||
1556 | + $discount = $discount[0]; | ||
1557 | + $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | ||
1558 | + $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | ||
1559 | + $discount['group_ids'] = explode(',', $discount['group_ids']); | ||
1560 | + if ($discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($item_id, $discount['group_ids'])) { | ||
1561 | + $discount = $discount['discount']; | ||
1562 | + } | ||
1563 | + else { | ||
1564 | + $discount = 0; | ||
1565 | + } | ||
1566 | + } else { | ||
1567 | + $discount = 0; | ||
1568 | + } | ||
1569 | + //vip | ||
1570 | + $users_group_id = $this->session->get('users_group_id'); | ||
1571 | + | ||
1552 | $num = count($items); | 1572 | $num = count($items); |
1553 | for($i=0; $i<$num; $i++){ | 1573 | for($i=0; $i<$num; $i++){ |
1554 | $items[$i]['full_alias'] = $this->models->getCatalog()->getFullAlias($this->lang_id, $items[$i]['catalog'])[0]['full_alias']; | 1574 | $items[$i]['full_alias'] = $this->models->getCatalog()->getFullAlias($this->lang_id, $items[$i]['catalog'])[0]['full_alias']; |
1575 | + if ($users_group_id == 38) | ||
1576 | + $items[$i]['price'] = $items[$i]['price']*0.95; | ||
1555 | } | 1577 | } |
1556 | 1578 | ||
1557 | foreach( $properties as $p ) | 1579 | foreach( $properties as $p ) |
@@ -1594,7 +1616,8 @@ | @@ -1594,7 +1616,8 @@ | ||
1594 | 'items' => $items, | 1616 | 'items' => $items, |
1595 | 'count' => max($count), | 1617 | 'count' => max($count), |
1596 | 'no_robots' => 1, | 1618 | 'no_robots' => 1, |
1597 | - 'prod_text' => $prod_text | 1619 | + 'prod_text' => $prod_text, |
1620 | + 'discount' => $discount | ||
1598 | ]); | 1621 | ]); |
1599 | } | 1622 | } |
1600 | 1623 |