catalog.php
8.74 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<section style="overflow: visible" class="content">
<div class="main_block">
<div class="cat_left">
<p class="title"><?= $t->_("products_found_for_the_filter")?> <?= $total ?></p>
<?php
if( !empty( $filters ) )
{
$data_filters = '<ul id="subcategory_menu">';
foreach( $filters as $key => $val )
{
$data_filters .=
'<li style="background: #ffffff">'.
'<div class="main clearfix">'.
'<p class="float">'.$key.'</p>'.
'<p class="float dropdown"></p>'.
'</div>'.
'<ul>';
foreach( $val as $v )
{
$data_filters .=
'<li>'.
((count($val)>1)?'<a href="'.$this->seoUrl->setUrl($v['alias']).'" title="" onClick="document.location=\''.$this->seoUrl->setUrl($v['alias']).'\';">':'').
'<input type="checkbox" '.((count($val)==1)?'disabled="disabled" checked':'').' id="'.$v['filter_value_id'].'" value="'.$v['filter_value_id'].'" '.(!empty( $v['checked'] ) ? 'checked="checked"' : '').' />'.
'<label for="'.$v['id'].'"><span></span>'.$v['filter_value_value'].'</label>'.
((count($val)>1)?'</a>':'').
'</li>';
}
$data_filters .=
'</ul>'.
'</li>';
}
$data_filters .=
'<li class="subcategory_menu_last_child">
<div class="main subcategory_menu_price clearfix">
<p class="float">'.$t->_("price").'</p>
</div>
<div style="background: #ffffff" class="price_slider_container">
<div class="border_for_slider">
<div id="slider"></div>
</div>
<div>
<label for="price_from" class="float">'.$t->_("from").'</label>
<input type="text" class="float" name="price_from" value="'.( isset($price_array) && !empty($price_array) ? $price_array['0'] : $max_min_price['min_price'] ).'" id="price_from" />
<label for="price_from" class="float">до</label>
<input type="text" class="float" name="price_to" value="'.( isset($price_array) && !empty($price_array) ? $price_array['1'] : $max_min_price['max_price'] ).'" id="price_to" />
<a href="'.$this->seoUrl->setUrl($current_url).'" class="price_ok"><img src="/images/price_ok.png" width="7" height="7" alt="Ok" /></a>
<input type="hidden" value="'.$current_url_without_price.'" class="current_url">
<input type="hidden" value="'.$max_min_price['min_price'].'" class="min_price">
<input type="hidden" value="'.($max_min_price['max_price']+1).'" class="max_price">
<input type="hidden" value="'.( !empty($sort) ? join('-', $sort) : '' ).'" class="sort_params">
</div>
</div>
</li>'.
'</ul>';
echo( $data_filters );
}
?>
</div>
<div class="cat_center">
<?php
$sortName[3] = $t->_("from_cheap_to_expensive");
$sortName[4] = $t->_("from_expensive_to_cheap");
$sortName[5] = $t->_("sort_alphabetically");
?>
<?php if(isset($catalog['sub']['title'])) : ?>
<h2 style="display: inline-block" class="catalog_header"><?= $catalog['sub']['title'] ?></h2>
<?php endif; ?>
<div class="block_content" style="width:100%;">
<div class="catalog_captions">
<div class="cat_caption left"><?= $t->_('name') ?></div>
<div class="cat_caption b100"><?= $t->_('stock_availability') ?></div>
<div class="cat_caption b140"></div>
<div class="cat_caption b100"><?= $t->_('packing') ?></div>
<div class="cat_caption b100"><?= $t->_('number_of') ?></div>
</div>
<div class="catalog_products">
<?= $this->partial('partial/products', ['groups' => $groups]); ?>
</div>
</div>
</div>
<div class="clear"></div>
<?php
if( $total > \config::get( 'limits/dealer_catalog') )
{
echo('<div class="inner"><div class="paginate">');
echo $paginate;
echo('</div></div>');
}
?>
</div>
</section>
<script>
$(function() {
$('.group_sizes').on('click', function (e) {
e.preventDefault();
var size = $(this).find('.group_sizes_content').html();
var $currentSize = $(this).parents('.table_cell4').find('.active');
$currentSize.find('.group_sizes_content').html(size);
var $product = $(this).parents('.product');
var item_id = $(this).data('item_id');
var catalog_id = $(this).data('catalog_id');
var group_alias = $(this).data('group_alias');
$currentSize.data('item_id', item_id);
$currentSize.data('catalog_id', catalog_id);
$currentSize.data('group_alias', group_alias);
$.ajax({
url: '/change_with_size',
data :
{
'item_id' : item_id,
'catalog_id' : catalog_id,
'group_alias' : group_alias
},
type : "POST",
dataType: 'json',
success: function(data) {
var $rec_prices = $product.find('.rec_prices');
var $stock_image = $product.find('#stock_availability');
var $firm_product = $product.find('.firm_product');
var $price = $product.find('.price span');
$price.text(data['price']);
$stock_image.attr('src', '/images/dost0.png');
if($rec_prices.children().size() > 2) {
console.log($rec_prices.children().size());
$rec_prices.children().slice(0, 2).remove();
}
$firm_product.empty();
if(data['recommended_prices']) {
var recommended_prices = '<div class="rec_prices_block left first">' + data['recommended_prices']['name'] + '</div>'
+ '<div style="display: inline-block; width: 276px">';
data['recommended_prices']['dealer'].forEach(function(element) {
recommended_prices += '<div class="rec_prices_block lr_padding">'
+ '<div class="small_price"><span>'+ element.dealer_price +'</span> грн.</div>'
+ '<p class="subtitle">' + element.dealer_name + '</p></div>';
});
recommended_prices += '</div>';
$rec_prices.prepend(recommended_prices);
if(data['recommended_prices']['firm']) {
var firm = '<div class="table_cell4 w35">'
+ '<a href="#"><img src="/images/minilogo.png"></a>'
+ '</div>'
+ '<div class="table_cell4 font13 left">'
+ data['recommended_prices']['firm_product']
+ '</div>';
$firm_product.html(firm);
}
if(data['recommended_prices']['stock_availability']) {
$stock_image.attr('src', '/images/dost' + data['recommended_prices']['stock_availability'] + '.png');
}
}
},
error: function(err) {
console.error(err);
}
});
});
/*
$('#dealer_search_item').on('input', function (e) {
e.preventDefault();
var href = location.href.split('/');
var subtype = href[6];
var type = href[5];
var search = $(this).val();
if(search.length > 3) {
$.ajax({
url : '/dealer/search',
data :
{
'search' : search ,
'subtype' : subtype,
'type' : type
},
type : "GET",
dataType : 'html',
success : function(data) {
$('.catalog_products').html(data);
}
});
}
});
*/
});
</script>