Blame view

src/app/frontend/views/page/changeWithSize.php 2.8 KB
dce46e80   Alex Savenko   first push project
1
  <?php
5f87ae9f   Alex Savenko   vip prices tests
2
  
dce46e80   Alex Savenko   first push project
3
4
5
6
7
8
9
  if(isset($special_user)) {
      $data['price'] = number_format(isset($item['prices'][$special_user['status']])
          ? $item['prices'][$special_user['status']]
          : $item['price2'], 2, '.', '');
  } else {
      $data['price'] = $item['price2'];
  }
5f87ae9f   Alex Savenko   vip prices tests
10
11
12
13
14
15
16
  
  //vip
  if (isset($users_group_id) && $users_group_id == 37) {
      $data['price'] = round($data['price']*0.95, 1);
  }
  
  //discount
3f8fb5b8   Alex Savenko   price display
17
  $old_price = $data['price'];
c784a5c9   Alex Savenko   price display
18
  $data['price'] = $data['price']*(1-$discount/100);
9a8fc30a   Alex Savenko   price display
19
  $data['price'] = number_format($data['price'], 2, '.', ' ');
137fb94f   Alex Savenko   price display item
20
21
22
23
  if ($discount == 0) {
      $data['html'] =
          '<div class="clearfix buy_compare">
              <div class="one_item_price float">'. $t->_("price") .
a29e68cc   Alex Savenko   price display item
24
          ' <span>' . $data['price'] . '</span> грн
137fb94f   Alex Savenko   price display item
25
26
27
28
29
30
31
32
33
34
35
      ';
  }
  else {
      $data['html'] = '
          <div class="clearfix buy_compare">
              <div class="one_item_price float">'. $t->_("price") .
              ' <span style="text-decoration: line-through;"><span>' . $old_price . '</span> грн</span>
              <br/>
              <span>' . $data['price'] . '</span> грн
      ';
  }
dce46e80   Alex Savenko   first push project
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
  
  $data['html'] .= '</ul></div><div data-group_id="' . $item['group_id'] .'" class="one_item_buttons float">';
  
  $data['html'] .= '<a data-group_id="' . $item['group_id'] .'" href="javascript:;" title="" class="';
  
  if($item['status_real'] == 1) {
      $data['html'] .= 'btn green buy';
  } else {
      $data['html'] .= 'not_available grey';
  }
  $data['html'] .= '">' . $t->_("buy") . '</a>';
  
  $data['html'] .= '</div><div class="one_item_compare float">' .
  '<input type="checkbox" id="compare_item_' . $item['id'] . '" value="' . $item['type'] . '-'. $item['catalog'] . '-' . $item['id'] . '" />' .
  '<label for="compare_item_'. $item['id'] .'"><span></span>' . $t->_("compared_to") . '</label>' .
  '<input type="hidden" class="item_id_for_basket" value="'. $item['id'] .'">' .
  '<input type="hidden" class="current_item_size" value="'. $item['size'] .'">' .
  '</div>' .
  '</div>' .
  '<div class="clearfix features">';
  
  
  foreach($item['filters'] as $v) {
      $data['html'] .= '<a href="#" class="float">' . $v['value_value'] . '</a>';
  }
  
  $data['image'] = $item['image'];
  $data['status'] = $item['status'];
  $data['product_id'] = $item['product_id'];
  $data['color'] = $item['color'];
  $data['group_id'] = $item['group_id'];
  
  if(!empty($item['prices'][0])) {
      $data['recommended_prices']['name'] = $t->_('recommended_prices');
      $data['recommended_prices']['stock_availability'] = $item['stock_availability'];
      $data['recommended_prices']['firm'] = $item['firm'];
      $data['recommended_prices']['firm_product'] = $t->_('firm_product');
      for($i = 0; $i < $special_user['status']; $i++) {
          $data['recommended_prices']['dealer'][$i]['dealer_price'] = $item['prices'][$i];
          $data['recommended_prices']['dealer'][$i]['dealer_name'] = $special_users[$i]['title'];
      }
  }
  
dce46e80   Alex Savenko   first push project
79
  echo json_encode($data);