changeWithSize.php
2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
<?php
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'];
}
$old_price = $data['price'];
$data['price'] = $data['price']*(1-$discount/100);
$data['price'] = number_format($data['price'], 2, '.', ' ');
if ($discount == 0) {
$data['html'] =
'<div class="clearfix buy_compare">
<div class="one_item_price float">'. $t->_("price") .
'<span>' . $data['price'] . '</span> грн
';
}
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> грн
';
}
$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'];
}
}
echo json_encode($data);