Commit 02c45234962fbe4b8eb8d1129e8ea2fc72b1cdec

Authored by Alex Savenko
1 parent ff60c4df

price display

src/app/frontend/controllers/PageController.php
@@ -1091,10 +1091,25 @@ @@ -1091,10 +1091,25 @@
1091 'special_user' => $special_user 1091 'special_user' => $special_user
1092 ]); 1092 ]);
1093 } 1093 }
  1094 +
  1095 + $discount = $this->models->getDiscount()->getActiveData();
  1096 + if (!empty($discount)) {
  1097 + $discount = $discount[0];
  1098 + $discount['group_ids'] = str_replace('{', '', $discount['group_ids']);
  1099 + $discount['group_ids'] = str_replace('}', '', $discount['group_ids']);
  1100 + $discount['group_ids'] = explode(',', $discount['group_ids']);
  1101 + if ($discount['discount'] > 0 && $discount['discount'] <= 100 && in_array($item_id, $discount['group_ids'])) {
  1102 + $discount = $discount['discount'];
  1103 + }
  1104 + else {
  1105 + $discount = 0;
  1106 + }
  1107 + }
1094 1108
1095 $this->view->pick('page/changeWithSize'); 1109 $this->view->pick('page/changeWithSize');
1096 $this->view->setVars([ 1110 $this->view->setVars([
1097 - 'item' => $item['0'] 1111 + 'item' => $item['0'],
  1112 + 'discount' => $discount
1098 ]); 1113 ]);
1099 $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW); 1114 $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
1100 } 1115 }
src/app/frontend/views/page/changeWithSize.php
@@ -8,7 +8,7 @@ if(isset($special_user)) { @@ -8,7 +8,7 @@ if(isset($special_user)) {
8 } 8 }
9 $data['html'] = '<div class="clearfix buy_compare"> 9 $data['html'] = '<div class="clearfix buy_compare">
10 <div class="one_item_price float">'. $t->_("price") . 10 <div class="one_item_price float">'. $t->_("price") .
11 - ' <span>' . $data['price'] . '</span> грн'; 11 + ' <span>' . number_format($data['price']*(1-$discount['discount']/100), 2, '.', ' ') . '</span> грн';
12 12
13 $data['html'] .= '</ul></div><div data-group_id="' . $item['group_id'] .'" class="one_item_buttons float">'; 13 $data['html'] .= '</ul></div><div data-group_id="' . $item['group_id'] .'" class="one_item_buttons float">';
14 14
src/app/frontend/views/page/item.php
@@ -453,6 +453,7 @@ @@ -453,6 +453,7 @@
453 $customer_id = $this->session->get('id'); 453 $customer_id = $this->session->get('id');
454 ?> 454 ?>
455 $( document ).ready(function() { 455 $( document ).ready(function() {
  456 +
456 $('body').on('click','.one_item_buttons a', function(){ 457 $('body').on('click','.one_item_buttons a', function(){
457 458
458 <?php if( !empty( $customer_id ) ) : ?> 459 <?php if( !empty( $customer_id ) ) : ?>
@@ -490,7 +491,6 @@ @@ -490,7 +491,6 @@
490 491
491 }); 492 });
492 493
493 -  
494 }); 494 });
495 495
496 496