Commit 9ef661986484b82a0634b0d553ff703bd0e91d1d
1 parent
9ebe6e90
price display
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
src/app/frontend/controllers/MenuController.php
| ... | ... | @@ -407,8 +407,21 @@ class MenuController extends \controllers\ControllerBase |
| 407 | 407 | $special_user = $this->models->getSpecialUsers()->getOneData($special_users_id)[0]; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | + $discount = $this->models->getDiscount()->getActiveData(); | |
| 411 | + if (!empty($discount)) { | |
| 412 | + $discount = $discount[0]; | |
| 413 | + $discount['group_ids'] = str_replace('{', '', $discount['group_ids']); | |
| 414 | + $discount['group_ids'] = str_replace('}', '', $discount['group_ids']); | |
| 415 | + $discount['group_ids'] = explode(',', $discount['group_ids']); | |
| 416 | + } | |
| 417 | + else { | |
| 418 | + $discount['discount'] = 0; | |
| 419 | + } | |
| 420 | + | |
| 410 | 421 | foreach($cart_items['items'] as $k => $item) { |
| 411 | 422 | |
| 423 | + $cart_items['items'][$k]['price'] = round($cart_items['items'][$k]['price']*(1-$discount['discount']/100), 1); | |
| 424 | + | |
| 412 | 425 | $cart_items['items'][$k]['group_sizes'] = $this->models->getItems()->getSizesByGroupId( $this->lang_id, $item['group_id'] ); |
| 413 | 426 | $cart_items['items'][$k]['prices'] = $this->common->getPricesArray($item); |
| 414 | 427 | ... | ... |