Commit 746d54c8715d6c53862bd80ac87d174101a24abd

Authored by Alex Savenko
1 parent bfab52c2

price display basket

Showing 1 changed file with 5 additions and 25 deletions   Show diff stats
src/app/frontend/controllers/MenuController.php
... ... @@ -405,22 +405,8 @@ class MenuController extends \controllers\ControllerBase
405 405 $special_user = $this->models->getSpecialUsers()->getOneData($special_users_id)[0];
406 406 }
407 407  
408   - // скидка
409   -// $discount = $this->models->getDiscount()->getActiveData();
410   -// if (!empty($discount)) {
411   -// $discount = $discount[0];
412   -// $discount['group_ids'] = str_replace('{', '', $discount['group_ids']);
413   -// $discount['group_ids'] = str_replace('}', '', $discount['group_ids']);
414   -// $discount['group_ids'] = explode(',', $discount['group_ids']);
415   -// }
416   -// else {
417   -// $discount['discount'] = 0;
418   -// }
419   -//
420   -// $cart_items['total_price'] = round($cart_items['total_price']*(1-$discount['discount']/100), 1);
421   -
422   -
423 408 //discount
  409 +
424 410 $discount = $this->models->getDiscount()->getActiveData();
425 411 if (!empty($discount)) {
426 412 $discount = $discount[0];
... ... @@ -429,11 +415,10 @@ class MenuController extends \controllers\ControllerBase
429 415 $this->common->countOrderSum($cart_items);
430 416 $cart_items['total_price'] = $cart_items['total_sum'];
431 417 }
432   - //
433   -
434   - foreach($cart_items['items'] as $k => $item) {
435 418  
  419 + /************************/
436 420  
  421 + foreach($cart_items['items'] as $k => $item) {
437 422  
438 423 $cart_items['items'][$k]['group_sizes'] = $this->models->getItems()->getSizesByGroupId( $this->lang_id, $item['group_id'] );
439 424 $cart_items['items'][$k]['prices'] = $this->common->getPricesArray($item);
... ... @@ -446,9 +431,6 @@ class MenuController extends \controllers\ControllerBase
446 431 ? $cart_items['items'][$k]['prices'][$special_user['status']]
447 432 : $item['price2'], 2, '.', ''
448 433 );
449   - //discount
450   - //$cart_items['items'][$k]['price'] = round($cart_items['items'][$k]['price']*(1-$discount['discount']/100), 1);
451   -
452 434 $cart_items['items'][$k]['total_price'] = $cart_items['items'][$k]['price'] * $item['count'];
453 435  
454 436 $cart_items['new_total_price'] += $cart_items['items'][$k]['total_price'];
... ... @@ -457,10 +439,8 @@ class MenuController extends \controllers\ControllerBase
457 439  
458 440 } else {
459 441 $cart_items['items'][$k]['price'] = $item['price2'];
460   - //discount
461   - //$cart_items['items'][$k]['price'] = round($cart_items['items'][$k]['price']*(1-$discount['discount']/100), 1);
462   - //$cart_items['items'][$k]['total_price'] = round($cart_items['items'][$k]['total_price']*(1-$discount['discount']/100), 1);
463   - }
  442 + }
  443 +
464 444 }
465 445  
466 446 echo json_encode($cart_items);
... ...