Blame view

src/app/frontend/views/page/changeWithSize.php 2.79 KB
dce46e80   Alex Savenko   first push project
1
  <?php
5f87ae9f   Alex Savenko   vip prices tests
2
  
dce46e80   Alex Savenko   first push project
3
  if(isset($special_user)) {
6f51c675   Alex Savenko   common
4
      $data['price'] = round(isset($item['prices'][$special_user['status']])
dce46e80   Alex Savenko   first push project
5
          ? $item['prices'][$special_user['status']]
37d2b3bf   Alex Savenko   common
6
          : $item['price2'], 1);
dce46e80   Alex Savenko   first push project
7
8
9
  } else {
      $data['price'] = $item['price2'];
  }
5f87ae9f   Alex Savenko   vip prices tests
10
11
  
  //vip
8f7c30bf   Alex Savenko   add discount to v...
12
  if (isset($users_group_id) && isset($users_group_discount)) {
2060495f   Alex Savenko   price fix (1-%)
13
      $data['price'] = round($data['price']*(1-$users_group_discount/100), 1);
5f87ae9f   Alex Savenko   vip prices tests
14
15
16
  }
  
  //discount
3f8fb5b8   Alex Savenko   price display
17
  $old_price = $data['price'];
c784a5c9   Alex Savenko   price display
18
  $data['price'] = $data['price']*(1-$discount/100);
37d2b3bf   Alex Savenko   common
19
  $data['price'] = round($data['price'], 1);
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);