-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-services.php
373 lines (364 loc) · 12 KB
/
page-services.php
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
<?
/*
Template Name: Услуги
Template Post Type: page
*/
get_header();
//id страницы Услуги, откуда берутся настройки для иерархии
$id_services = 21;
$website_addr = get_site_url();
// echo '<pre>';
// print_r($file_array);
// echo '</pre>';
$id_current = get_the_ID();
$title_page = single_post_title('',false);
$services_pages = get_field('services-pages',$id_services);
if (!$services_pages) {
echo '<main><section class="services"><section class="bread-crumb __container"></section><div class="services__container"><h1>Сообщение администратору сайта*</h1>'.$title_page.'<p class="services__descr">* Произошла ошибка! Пожалуйста, заполните таблицу "Карта страниц Услуг" на странице '.get_the_title($id_services).' (page_id='.$id_services.') в административной панели WordPress.</p></div></section></main>';
get_footer();
return false;
}
$pages_array = array();
foreach($services_pages as $index_page => $pages) {
$page = $pages['services-page'];
$sub_pages = $pages['services-sub-page'];
$sub_page = null;
if ($sub_pages == null) {
$sub_page .= $page;
}else {
foreach($sub_pages as $sub) {
$sub_page[] .= $sub;
}
}
$pages_array += array($page => $sub_page);
}
// echo '<pre>';
// print_r($pages_array);
// echo '</pre>';
if (array_key_exists($id_current, $pages_array)) {
$id_need = $id_current;
}
else {
foreach ($pages_array as $index_arrays => $arrays) {
if (is_array($arrays)) {
foreach ($arrays as $array) {
if ($array == $id_current) {
$id_need = $index_arrays;
}
}
}
}
}
switch ($id_current) {
case 33:
echo '<main class="laser-cutting">';
break;
case 35:
case 39:
case 46:
case 48:
case 73:
case 75:
case 77:
echo '<main class="inside-page">';
break;
case 54:
echo '<main class="services-metal-bending">';
break;
case 50:
echo '<main class="services-metal-punching">';
break;
case 89:
echo '<main class="cutting">';
break;
case 52:
echo '<main class="powder-painting">';
break;
default:
echo '<main>';
break;
}
?>
<section class="services" style="background-image: url(<?=get_field('backg-img',$id_need);?>);">
<section class="bread-crumb __container">
<?breadcrumb_home_url();?>
<a class="bread-crumb__item" href="<?=get_permalink(21);?>">Услуги</a>
<span class="bread-crumb__item"><?=$title_page;?></span>
</section>
<div class="services__container">
<h1><?=$title_page;?></h1>
<p class="services__descr"><?=get_field('descr');?></p>
<?
$class_item = 'services';
services_item($id_current, $id_need, $class_item);
?>
</div>
</section>
<section class="price-list">
<h2 class="__container"><?=get_field('price-h2');?></h2>
<div class="price-list__container">
<div class="price-list__body">
<p class="price-list__body_descr"><?=get_field('price-descr');?></p>
<?
$table_price = get_field('table_price', $id_current);
$table_price_have = $table_price['body'];
if (!empty($table_price) && !empty($table_price_have)) {
if (empty($table_price['caption'])) {
if ($id_current == 52) {
echo '<div class="price-list__body_table linear-header-left">';
}else {
echo '<div class="price-list__body_table linear-header">';
}
}else {
echo '<div class="price-list__body_table">';
}
echo '<div class="table-scrollbar"><div class="swiper-scrollbar-drag"></div></div><div class="table-grid">';
foreach($table_price['header'] as $index => $th) {
if ($index === 0) {
echo '<div class="table-rowspan">'.$th['c'].'</div>';
}else if ($index !== 0) {
$head_text[] = $th['c'];
}
}
if (!empty($table_price['caption'])) {
echo '<div class="table-row">'.$table_price['caption'].'</div>';
}
echo '<div class="table-col">';
foreach($table_price['body'] as $index_tr => $tr) {
//$row = $index_tr;
echo '<div>';
foreach($tr as $index_td => $td) {
$col = $index_td;
if ($index_td === 0) {
$content = $td['c'];
if (empty($content)) {
echo '-';
} else {
echo $content;
}
}
}
echo '</div>';
}
echo '</div>';
echo '<div class="table-body"><div class="swiper swiper-table" data-mobile="false"><div class="swiper-wrapper">';
$count_row = 0;
$count_col = 1;
$count = 0;
$first = true;
for ($i=0; $i < $col; $i++) {
echo '<div class="swiper-slide">';
foreach($table_price['body'] as $index_tr => $tr) {
if ($index_tr == $count_row) {
foreach($tr as $index_td => $td) {
if (($index_td == $count_col) && ($index_td !== 0)) {
if ($first) {
echo '<div>'.$head_text[$count].'</div>';
$count++;
$first = false;
}
echo '<div>';
$content = $td['c'];
if (empty($content)) {
echo '-';
} else {
echo $content;
}
echo '</div>';
}
}
$count_row++;
}
}
$count_col++;
$count_row = 0;
$first = true;
echo '</div>';
}
echo '</div></div></div>';
echo '</div></div>';
$note_on = get_field('note-on');
$note_text = get_field('note-text');
if ($note_on && $note_text) {
echo '<p class="price-list__body_alert">* '.$note_text.'</p>';
}
}
if ($id_current === 89) {
echo '<div class="technical-specifications"><h2 class="technical-specifications__title">Технические характеристики</h2><div class="technical-specifications__img"></div></div>';
}
?>
</div>
<div class="price-list__info sticky">
<div class="price-list__info_descr">
<h3>Для оптовых и постоянных заказчиков у нас предусмотрены <span>скидки до 10%</span></h3>
<p> Цены обновлены <b></b> и могут менятся в зависимости от объёма и сроков исполнения
заказа </p>
</div>
<div class="price-list__info_btn">
<?$price_file = get_field('price-file',$id_need);
if ($price_file) {
echo '<a download="Прайс-лист '.get_the_title($id_need).'" href="'.$price_file.'" class="btn-reverse" title="Скачать прайс '.get_the_title($id_need).'">Скачать прайс-лист</a>';
}
?>
<button data-btn="price" class="open-popup-js btn">Запросить расчет</button>
</div>
</div>
</div>
</section>
<?
$type_on = get_field('types-on');
$type_block = get_field('types-block');
if ($type_on && $type_block) {
$type_redirect = get_field('types-redirect-on');
$type_h2 = get_field('types-h2');
$type_block = get_field('types-block');
$count_type = 1;
if ($type_redirect) {?>
<section class="types-cutting">
<h2><?=$type_h2;?></h2>
<?echo '<div class="types-cutting__container">';
foreach($type_block as $block) {
$h3 = $block['types-h3'];
$url = $block['types-link'];
$link_svg = $block['types-svg'];
echo '<a class="types-cutting__item" href="'.$url.'"> <img src="'.$link_svg.'" alt="types-cutting-'.$count_type.'"><div><span>'.$h3.'</span></div></a>';
$count_type++;
}
echo '</div>';?>
</section>
<?}else {?>
<section class="types-work">
<div class="types-work__container">
<h2><?=$type_h2;?></h2>
<?echo '<div class="types-work__items">';
foreach($type_block as $block) {
$h3 = $block['types-h3'];
$url = $block['types-link'];
$link_svg = $block['types-svg'];
echo '<div class="types-work__item"><img src="'.$link_svg.'" alt="types-work-'.$count_type.'"><span>'.$h3.'</span></div>';
$count_type++;
}
echo '</div>';?>
</div>
</section>
<?}?>
<?}?>
<?
$table_tech_on = get_field('equipment-on');
$table_tech = get_field('table_equipment');
$table_tech_have = $table_tech['body'];
unset($head_text);
if (!empty($table_tech) && $table_tech_on && !empty($table_tech_have)) {
echo '<section class="equipment"><h2>'.get_field('equipment-h2').'</h2><div class="equipment__table"><div class="equipment__container"><div class="table-scrollbar"> <div class="swiper-scrollbar-drag"></div></div><div class="table-grid">';
foreach($table_tech['header'] as $index => $th) {
if ($index === 0) {
echo '<div class="table-rowspan">'.$th['c'].'</div>';
}else if ($index !== 0) {
$head_text[] = $th['c'];
}
}
echo '<div class="table-col">';
foreach($table_tech['body'] as $index_tr => $tr) {
//$row = $index_tr;
echo '<div>';
foreach($tr as $index_td => $td) {
$col = $index_td;
if ($index_td === 0) {
$content = $td['c'];
if (empty($content)) {
echo '-';
} else {
echo $content;
}
}
}
echo '</div>';
}
echo '</div>';
echo '<div class="table-body"><div class="swiper swiper-table" data-mobile="false"><div class="swiper-wrapper">';
$count_row = 0;
$count_col = 1;
$count = 0;
$first = true;
for ($i=0; $i<$col; $i++) {
echo '<div class="swiper-slide">';
foreach($table_tech['body'] as $index_tr => $tr) {
if ($index_tr == $count_row) {
foreach($tr as $index_td => $td) {
if (($index_td == $count_col) && ($index_td !== 0)) {
if ($first) {
echo '<div>'.$head_text[$count].'</div>';
$count++;
$first = false;
}
echo '<div>';
$content = $td['c'];
if (empty($content)) {
echo '-';
} else {
echo $content;
}
echo '</div>';
}
}
$count_row++;
}
}
$count_col++;
$count_row = 0;
$first = true;
echo '</div>';
}
echo '</div></div></div>';
echo '</div></div></div></section>';
}
?>
<section class="example-order">
<div class="example-order__container">
<h2>Оформление заказа в компании “СтальЦентр”</h2>
<div class="example-order__col">
<div class="example-order__item item-one">
<h3>Входящая заявка</h3>
<p>Расскажите менеджерам вашу задачу связавшись любым удобным способом
<button data-btn="calculation" class="open-popup-js example-order__item_btn">Оставьте
заявку</button> или звоните по тел. <?contacts('example-order','');?>
</p>
</div>
<div class="example-order__item">
<h3>Техническое задание</h3>
<p>Обсуждение чертежа или эскиза для точного расчёта стоимости изделия</p>
</div>
<div class="example-order__item">
<h3>Согласование</h3>
<p>Озвучиваем коммерческие условия, сроки изготовления, подпишем спецификацию и договор</p>
</div>
<div class="example-order__item">
<h3>Выполнение работ</h3>
<p>Запуск в производство, межоперационный и конечный контроль качества</p>
</div>
</div>
<button data-btn="offer" class="open-popup-js btn">Заказать услугу</button>
</div>
</section>
<div class="bg-service">
<?section_works('');?>
<section class="full-services">
<div class="full-services__container">
<h2>Оказываем комплексные услуги металлообработки</h2>
<?wp_nav_menu(array(
'theme_location' => 'services',
'menu_id' => false,
'container' => 'div',
'container_class' => 'full-services__col',
'menu_class' => false,
'items_wrap' => '%3$s',
'order' => 'ASC',
'before' => $id_need,
'walker' => new services()
));?>
</div>
</section>
<?contacts_form($id_services, null);?>
</div>
</main>
<?get_footer();?>