PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 4.6.5
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v4.6.5
4.9.2 4.9.1 4.9.0 2.0.0 2.1.0 2.2.0 2.2.1 2.2.2 2.3.0 2.4.0 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 4.0.0 4.0.1 4.1.0 4.1.1 4.2.0 4.2.1 4.3.0 4.3.1 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.6.5 4.6.6 4.6.7 4.6.8 4.6.9 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.7.6 4.7.7 4.7.8 4.7.9 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.8.9 trunk 0.1.2-beta 0.1.3-beta 0.1.4-beta 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.8.0 1.8.1 1.9.0
shopengine / widgets / advanced-search / advanced-search.php
shopengine / widgets / advanced-search Last commit date
screens 3 years ago advanced-search-config.php 4 years ago advanced-search.php 3 years ago
advanced-search.php
1312 lines
1 <?php
2
3 namespace Elementor;
4
5 defined('ABSPATH') || exit;
6
7 use ShopEngine\Widgets\Products;
8
9 class ShopEngine_Advanced_Search extends \ShopEngine\Base\Widget
10 {
11
12 public function config() {
13 return new ShopEngine_Advanced_Search_Config();
14 }
15
16 protected function register_controls() {
17
18 /*
19 ------------------------------
20 General settings
21 ------------------------------
22 */
23
24 $this->start_controls_section(
25 'shopengine_advanced_search_general',
26 [
27 'label' => esc_html__('General', 'shopengine'),
28 'tab' => Controls_Manager::TAB_CONTENT,
29 ]
30 );
31
32 $this->add_control(
33 'shopengine_advanced_search_product_column',
34 [
35 'label' => esc_html__('Products Column', 'shopengine'),
36 'type' => Controls_Manager::SELECT,
37 'default' => '1',
38 'tablet_default' => '2',
39 'mobile_default' => '1',
40 'options' => [
41 '1' => 'Column 1',
42 '2' => 'Column 2',
43 '3' => 'Column 3',
44 '4' => 'Column 4',
45 '5' => 'Column 5',
46 ],
47 'selectors' => [
48 '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product' => 'grid-template-columns: repeat({{VALUE}}, 1fr);',
49 ],
50 ]
51 );
52
53
54
55 $this->add_control(
56 'shopengine_advanced_search_show_category_on_search_result',
57 [
58 'label' => esc_html__('Show Category on search result?', 'shopengine'),
59 'type' => Controls_Manager::SELECT,
60 'default' => 'block',
61 'options' => [
62 'block' => 'Show',
63 'none' => 'Hide',
64 ],
65 'selectors' => [
66 '{{WRAPPER}} .shopengine-advanced-search .shopengine-category-name' => 'display: {{VALUE}};',
67 ],
68 ]
69 );
70
71
72 $this->add_responsive_control( // responsive control support bajaar theme.
73 'shopengine_advanced_search_disable_category_btn',
74 [
75 'label' => esc_html__('Show Category Dropdown', 'shopengine'),
76 'type' => Controls_Manager::SELECT,
77 'default' => 'block',
78 'tablet_default' => 'block',
79 'mobile_default' => 'none',
80 'options' => [
81 'block' => 'Show',
82 'none' => 'Hide',
83 ],
84 'selectors' => [
85 '{{WRAPPER}} .shopengine-advanced-search .shopengine-category-select-wraper' => 'display: {{VALUE}};',
86 ],
87 'separator' => 'before',
88 ]
89 );
90
91 $this->add_control(
92 'shopengine_advanced_search_title_all',
93 [
94 'label' => esc_html__('Text for All Categories', 'shopengine'),
95 'description' => esc_html__('Add text for all categories options.', 'shopengine'),
96 'type' => Controls_Manager::TEXT,
97 'default' => 'All Categories',
98 'condition' => [
99 'shopengine_advanced_search_disable_category_btn' => 'block',
100 ],
101 'separator' => 'after',
102 ]
103 );
104 $this->add_control(
105 'shopengine_advanced_search_icon',
106 [
107 'label' => esc_html__('Search icon', 'shopengine'),
108 'type' => Controls_Manager::ICONS,
109 'default' => [
110 'value' => 'fas fa-search',
111 'library' => 'fa-solid',
112 ],
113 ]
114 );
115
116 $this->add_control(
117 'shopengine_advanced_add_search_text',
118 [
119 'label' => esc_html__('Add Search Text?', 'shopengine'),
120 'type' => Controls_Manager::SWITCHER,
121 'label_on' => esc_html__('Show', 'shopengine'),
122 'label_off' => esc_html__('Hide', 'shopengine'),
123 'return_value' => 'yes',
124 'default' => 'no',
125
126 ]
127 );
128
129 $this->add_control(
130 'shopengine_is_image',
131 [
132 'label' => esc_html__('Hide Image from Search?', 'shopengine'),
133 'type' => Controls_Manager::SWITCHER,
134 'label_on' => esc_html__('Show', 'shopengine'),
135 'label_off' => esc_html__('Hide', 'shopengine'),
136 'return_value' => 'no',
137 'default' => 'no',
138 'selectors' => [
139 '{{WRAPPER}} .shopengine-advanced-search :is(.shopengine-search-product__item--image)' => 'display: none;',
140 ],
141 ]
142 );
143
144 $this->add_control(
145 'shopengine_advanced_search_text',
146 [
147 'label' => esc_html__('Search Text', 'shopengine'),
148 'type' => Controls_Manager::TEXT,
149 'default' => '',
150 'condition' => [
151 'shopengine_advanced_add_search_text' => 'yes',
152 ],
153 'separator' => 'after',
154 'description' => esc_html__('You can control the width from search icon style tab', 'shopengine'),
155 ]
156 );
157
158 $this->add_control(
159 'shopengine_advanced_search_order',
160 [
161 'label' => esc_html__('Order Search Components?', 'shopengine'),
162 'description' => esc_html__('This is an advanced option to change the postion of the search components,', 'shopengine'),
163 'type' => Controls_Manager::SWITCHER,
164 'label_on' => esc_html__('Show', 'shopengine'),
165 'label_off' => esc_html__('Hide', 'shopengine'),
166 'return_value' => 'yes',
167 'default' => 'no',
168 ]
169 );
170
171 $default = [
172 [
173 'list_title' => esc_html__( 'Search Box', 'shopengine' ),
174 'list_key' => 'search-box',
175 ],
176 [
177 'list_title' => esc_html__( 'Search Input', 'shopengine' ),
178 'list_key' => 'search-input',
179 ],
180 [
181 'list_title' => esc_html__( 'Category Selector', 'shopengine' ),
182 'list_key' => 'category-selector',
183 ],
184 ];
185
186 $repeater = new Repeater();
187 $this->add_control(
188 'shopengine_custom_ordering_list',
189 [
190 'label' => esc_html__( 'Ordering List', 'shopengine' ),
191 'type' => Controls_Manager::REPEATER,
192 'fields' => $repeater->get_controls(),
193 'default' => $default,
194 'title_field' => '{{{ list_title }}}',
195 'item_actions' => [
196 'add' => false,
197 'duplicate' => false,
198 'remove' => false,
199 'sort' => true,
200 ],
201 'condition' => [
202 'shopengine_advanced_search_order' => 'yes',
203 ]
204 ]
205 );
206 $this->end_controls_section(); // end ./ general settings
207
208
209 /*
210 ------------------------------
211 search bar style
212 ------------------------------
213 */
214
215 $this->start_controls_section(
216 'shopengine_advanced_search_search_bar',
217 [
218 'label' => esc_html__('Search form', 'shopengine'),
219 'tab' => Controls_Manager::TAB_STYLE,
220 ]
221 );
222
223
224 $this->add_responsive_control( // responsive control added for bajaar theme
225 'shopengine_advanced_search_search_bar_height',
226 [
227 'label' => esc_html__('Form Height (px)', 'shopengine'),
228 'type' => Controls_Manager::SLIDER,
229 'size_units' => ['px'],
230 'range' => [
231 'px' => [
232 'min' => 0,
233 'max' => 300,
234 'step' => 1,
235 ],
236 ],
237 'default' => [
238 'unit' => 'px',
239 'size' => 50,
240 ],
241 'selectors' => [
242 '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( button, input, select )' => 'height: {{SIZE}}{{UNIT}};',
243 ],
244 ]
245 );
246
247 $this->add_control(
248 'shopengine_advanced_search_search_form_radius',
249 [
250 'label' => esc_html__('Form Radius', 'shopengine'),
251 'type' => Controls_Manager::DIMENSIONS,
252 'size_units' => ['px'],
253 'selectors' => [
254 '{{WRAPPER}} .shopengine-advanced-search .search-input-group' => 'overflow:hidden; border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
255 '.rtl {{WRAPPER}} .shopengine-advanced-search .search-input-group' => 'overflow:hidden; border-radius: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};',
256 ],
257 ]
258 );
259 $this->add_group_control(
260 Group_Control_Border::get_type(),
261 [
262 'name' => 'shopengine_advanced_search_searchbar_border',
263 'label' => esc_html__('Border', 'shopengine'),
264 'selector' => '{{WRAPPER}} .shopengine-advanced-search :is( .search-input-group )',
265 'exclude' => ['color'],
266 'fields_options' => [
267 'border_type' => [
268 'default' => 'yes',
269 ],
270 'border' => [
271 'default' => 'solid',
272 'responsive' => true,
273 ],
274
275 'width' => [
276 'label' => esc_html__('Border Width', 'shopengine'),
277 'default' => [
278 'top' => '2',
279 'right' => '2',
280 'bottom' => '2',
281 'left' => '2',
282 'unit' => 'px',
283 ],
284 'responsive' => true,
285 'selectors' => [
286 '{{WRAPPER}} .shopengine-advanced-search :is( .search-input-group )' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
287 '.rtl {{WRAPPER}} .shopengine-advanced-search :is( .search-input-group )' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};',
288 ],
289 ],
290
291 'color' => [
292 'label' => esc_html__('Border Color', 'shopengine'),
293 'alpha' => false,
294 'default' => '#E6E6E6',
295 'responsive' => false,
296 ],
297
298 ],
299 ]
300 );
301
302 $this->add_control(
303 'shopengine_advanced_search_input_clr',
304 [
305 'label' => esc_html__('Input Box Text Color', 'shopengine'),
306 'type' => Controls_Manager::COLOR,
307 'default' => '#3E3E3E',
308 'separator' => 'before',
309 'alpha' => false,
310 'selectors' => [
311 '{{WRAPPER}} .shopengine-advanced-search .search-input-group input,
312 {{WRAPPER}} .shopengine-advanced-search .search-input-group input::placeholder' => 'color: {{VALUE}}',
313 ],
314 ]
315 );
316 $this->add_control(
317 'shopengine_advanced_search_input_bg_clr',
318 [
319 'label' => esc_html__('Input Box Background Color', 'shopengine'),
320 'type' => Controls_Manager::COLOR,
321 'default' => '#ffffff',
322 'alpha' => false,
323 'selectors' => [
324 '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( input )' => 'background: {{VALUE}}',
325 ],
326 ]
327 );
328
329
330 $this->add_group_control(
331 Group_Control_Typography::get_type(),
332 [
333 'name' => 'shopengine_advanced_search_input_typography',
334 'label' => esc_html__('Search Box Typography', 'shopengine'),
335 'selector' => '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( input, input::placeholder )',
336 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style', 'line_height'],
337 'fields_options' => [
338 'typography' => [
339 'default' => 'custom',
340 ],
341 'font_weight' => [
342 'default' => '400',
343 ],
344 'font_size' => [
345 'label' => esc_html__('Font Size (px)', 'shopengine'),
346 'default' => [
347 'size' => '16',
348 'unit' => 'px',
349 ],
350 'size_units' => ['px'],
351 ],
352 ],
353 ]
354 );
355
356
357 $this->end_controls_section(); // end ./ search bar style
358
359
360 /*
361 ------------------------------
362 Search Icon style
363 ------------------------------
364 */
365
366 $this->start_controls_section(
367 'shopengine_advanced_search_search_icon_style',
368 [
369 'label' => esc_html__('Search Icon / Text style', 'shopengine'),
370 'tab' => Controls_Manager::TAB_STYLE,
371 'description' => esc_html__('You can control the width from search icon / text style option', 'shopengine'),
372 ]
373 );
374 $this->start_controls_tabs( 'tabs_button_style' );
375 $this->start_controls_tab(
376 'se_adv_search_btn_n',
377 [
378 'label' => esc_html__( 'Normal', 'shopengine' ),
379 ]
380 );
381 $this->add_control(
382 'shopengine_advanced_search_btn_icon_clr',
383 [
384 'label' => esc_html__('Search Button Text Color', 'shopengine'),
385 'type' => Controls_Manager::COLOR,
386 'default' => '#3E3E3E',
387 'alpha' => false,
388 'selectors' => [
389 '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( button ) i, {{WRAPPER}} .shopengine-search-text' => 'color: {{VALUE}}',
390 ],
391 ]
392 );
393
394 $this->add_control(
395 'shopengine_advanced_search_btn_bg_clr',
396 [
397 'label' => esc_html__('Search Button Background Color', 'shopengine'),
398 'type' => Controls_Manager::COLOR,
399 'default' => '#E6E6E6',
400 'alpha' => false,
401 'selectors' => [
402 '{{WRAPPER}} .shopengine-advanced-search :is( .search-input-group button, .search-input-group )' => 'background: {{VALUE}}; border-color:{{VALUE}}',
403 ],
404 ]
405 );
406 $this->end_controls_tab();
407
408 $this->start_controls_tab(
409 'se_adv_search_btn_h',
410 [
411 'label' => esc_html__( 'Hover', 'shopengine' ),
412 ]
413 );
414 $this->add_control(
415 'se_adv_search_btn_icon_color',
416 [
417 'label' => esc_html__('Search Button Text Color', 'shopengine'),
418 'type' => Controls_Manager::COLOR,
419 'alpha' => false,
420 'selectors' => [
421 '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( button ):hover i, {{WRAPPER}} .shopengine-search-text:hover' => 'color: {{VALUE}}',
422 ],
423 ]
424 );
425
426 $this->add_control(
427 'se_adv_search_btn_icon_bgc',
428 [
429 'label' => esc_html__('Search Button Background Color', 'shopengine'),
430 'type' => Controls_Manager::COLOR,
431 'alpha' => false,
432 'selectors' => [
433 '{{WRAPPER}} .shopengine-advanced-search :is( .search-input-group button, .search-input-group ):hover' => 'background: {{VALUE}}; border-color:{{VALUE}}',
434 ],
435 ]
436 );
437 $this->end_controls_tab();
438 $this->end_controls_tabs();
439
440
441 $this->add_control(
442 'shopengine_advanced_search_font_size',
443 [
444 'label' => esc_html__('Search Button Font Size', 'shopengine'),
445 'type' => Controls_Manager::SLIDER,
446 'size_units' => ['px'],
447 'range' => [
448 'px' => [
449 'min' => 10,
450 'max' => 40,
451 'step' => 1,
452 ],
453 ],
454 'selectors' => [
455 '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( button ) i, {{WRAPPER}} .shopengine-search-text' => 'font-size: {{SIZE}}{{UNIT}};',
456 ],
457 'separator' => 'before',
458 ]
459 );
460
461 $this->add_control(
462 'shopengine_advanced_search_search_button_width',
463 [
464 'label' => esc_html__('Search Button Width', 'shopengine'),
465 'type' => Controls_Manager::SLIDER,
466 'size_units' => ['px'],
467 'range' => [
468 'px' => [
469 'min' => 40,
470 'max' => 300,
471 'step' => 1,
472 ],
473 ],
474 'default' => [
475 'unit' => 'px',
476 'size' => 50,
477 ],
478 'selectors' => [
479 '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( button )' => 'flex: 0 0 {{SIZE}}{{UNIT}};',
480 ],
481 ]
482 );
483
484 $this->add_control(
485 'shopengine_advanced_search_text_gap',
486 [
487 'label' => esc_html__('Search Text Gap', 'shopengine'),
488 'type' => Controls_Manager::SLIDER,
489 'size_units' => ['px'],
490 'selectors' => [
491 '{{WRAPPER}} .shopengine-search-text' => 'margin-left: {{SIZE}}{{UNIT}};',
492 ],
493 'condition' => [
494 'shopengine_advanced_add_search_text' => 'yes',
495 ],
496 ]
497 );
498
499 $this->end_controls_section(); // end ./ search icon style
500
501
502 /*
503 ------------------------------
504 category style
505 ------------------------------
506 */
507 $this->start_controls_section(
508 'shopengine_advanced_product_category_section',
509 [
510 'label' => esc_html__('Category Style', 'shopengine'),
511 'tab' => Controls_Manager::TAB_STYLE,
512 ]
513 );
514
515 $this->add_control(
516 'shopengine_advanced_product_category_clr',
517 [
518 'label' => esc_html__('Color', 'shopengine'),
519 'type' => Controls_Manager::COLOR,
520 'default' => '#3E3E3E',
521 'alpha' => false,
522 'selectors' => [
523 '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( select )' => 'color: {{VALUE}}',
524 ],
525 ]
526 );
527
528 $this->add_control(
529 'shopengine_advanced_product_category_bg',
530 [
531 'label' => esc_html__('Background Color', 'shopengine'),
532 'type' => Controls_Manager::COLOR,
533 'default' => '#ffffff',
534 'alpha' => false,
535 'selectors' => [
536 '{{WRAPPER}} .shopengine-category-select-wraper' => 'background-color: {{VALUE}}',
537 '{{WRAPPER}} .shopengine-ele-nav-search-select' => 'background-color: transparent',
538 ],
539 ]
540 );
541
542
543 $this->add_group_control(
544 Group_Control_Typography::get_type(),
545 [
546 'name' => 'shopengine_advanced_product_category_typography',
547 'label' => esc_html__('Typography', 'shopengine'),
548 'selector' => '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( select )',
549 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style'],
550
551 'fields_options' => [
552 'typography' => [
553 'default' => 'custom',
554 ],
555 'font_weight' => [
556 'default' => '500',
557 ],
558 'font_size' => [
559 'label' => esc_html__('Font Size (px)', 'shopengine'),
560 'default' => [
561 'size' => '15',
562 'unit' => 'px',
563 ],
564 'size_units' => ['px'],
565 ],
566 'line_height' => [
567 'label' => esc_html__('Line-height (px)', 'shopengine'),
568 'default' => [
569 'size' => '18',
570 'unit' => 'px',
571 ],
572 'responsive' => false,
573 'size_units' => ['px'],
574 ],
575 ],
576 ]
577 );
578
579 $this->add_responsive_control(
580 'shopengine_advanced_category_width',
581 [
582 'label' => esc_html__('Width', 'shopengine'),
583 'type' => Controls_Manager::SLIDER,
584 'size_units' => ['px', '%'],
585 'range' => [
586 'px' => [
587 'min' => 40,
588 'max' => 300,
589 'step' => 1,
590 ],
591 ],
592 'selectors' => [
593 '{{WRAPPER}} .shopengine-ele-nav-search-select' => 'width: {{SIZE}}{{UNIT}};',
594 ],
595 'condition' => [
596 'shopengine_advanced_search_disable_category_btn' => 'block',
597 ],
598 ]
599 );
600
601 $this->add_control(
602 'se_adv_search_cat_drop_color',
603 [
604 'label' => esc_html__( 'Dropdown Text Color', 'shopengine' ),
605 'type' => Controls_Manager::COLOR,
606 'alpha' => false,
607 'selectors' => [
608 '{{WRAPPER}} .shopengine-ele-nav-search-select > option' => 'color: {{VALUE}};',
609 ]
610 ]
611 );
612 $this->add_control(
613 'se_adv_search_cat_drop_bgc',
614 [
615 'label' => esc_html__( 'Dropdown Background Color', 'shopengine' ),
616 'type' => Controls_Manager::COLOR,
617 'alpha' => false,
618 'selectors' => [
619 '{{WRAPPER}} .shopengine-ele-nav-search-select > option' => 'background-color: {{VALUE}};',
620 ]
621 ]
622 );
623
624 $this->add_responsive_control(
625 'shopengine_advanced_separator_position',
626 [
627 'label' => esc_html__('Separator Position', 'shopengine'),
628 'type' => Controls_Manager::CHOOSE,
629 'default' => '0',
630 'prefix_class' => 'elementor%s-align-',
631 'options' => [
632 'left' => [
633 'title' => esc_html__('Left', 'shopengine'),
634 'icon' => 'fa fa-chevron-left'
635 ],
636 'right' => [
637 'title' => esc_html__('Right', 'shopengine'),
638 'icon' => 'fa fa-chevron-right'
639 ],
640 ],
641 'selectors_dictionary' => [
642 'left' => 'right: auto; left: 0;',
643 'right' => 'left: auto; right: 0;',
644 ],
645 'selectors' => [
646 '{{WRAPPER}} .shopengine-category-select-wraper:before' => '{{VALUE}};',
647 '.rtl {{WRAPPER}}.elementor-align-right .shopengine-category-select-wraper:before' => 'right: auto; left: 0;',
648 '.rtl {{WRAPPER}}.elementor-align-left .shopengine-category-select-wraper:before' => 'left: auto; right: 0;'
649 ],
650 'separator' => 'before',
651 ]
652 );
653
654 $this->add_control(
655 'shopengine_advanced_separator_width',
656 [
657 'label' => esc_html__('Separator Width', 'shopengine'),
658 'type' => Controls_Manager::SLIDER,
659 'size_units' => ['px'],
660 'range' => [
661 'px' => [
662 'min' => 0,
663 'max' => 100,
664 'step' => 1,
665 ],
666 ],
667 'selectors' => [
668 '{{WRAPPER}} .shopengine-category-select-wraper:before' => 'border-width: {{SIZE}}{{UNIT}};',
669 ],
670 ]
671 );
672
673 $this->add_control(
674 'shopengine_advanced_separator_color',
675 [
676 'label' => esc_html__('Separator Color', 'shopengine'),
677 'type' => Controls_Manager::COLOR,
678 'alpha' => false,
679 'selectors' => [
680 '{{WRAPPER}} .shopengine-category-select-wraper:before' => 'border-color: {{VALUE}}',
681 ],
682 'condition' => [
683 'shopengine_advanced_separator_width!' => 0,
684 ],
685 ]
686 );
687
688 $this->add_responsive_control(
689 'shopengine_advanced_separator_height',
690 [
691 'label' => esc_html__('Separator Height', 'shopengine'),
692 'type' => Controls_Manager::SLIDER,
693 'size_units' => ['%'],
694 'range' => [
695 '%' => [
696 'min' => 0,
697 'max' => 100,
698 'step' => 1,
699 ],
700 ],
701 'selectors' => [
702 '{{WRAPPER}} .shopengine-category-select-wraper:before' => 'height: {{SIZE}}%;',
703 ],
704 'condition' => [
705 'shopengine_advanced_separator_width!' => 0,
706 ],
707 ]
708 );
709
710
711 $this->end_controls_section(); // end ./ category style
712
713
714 /*
715 ------------------------------
716 product wrap style
717 ------------------------------
718 */
719 $this->start_controls_section(
720 'shopengine_advanced_product_wrap_section',
721 [
722 'label' => esc_html__('Product Style', 'shopengine'),
723 'tab' => Controls_Manager::TAB_STYLE,
724 ]
725 );
726
727 $this->add_control(
728 'shopengine_advanced_search_left_space',
729 [
730 'label' => esc_html__('Space On the Left', 'shopengine'),
731 'description' => esc_html__('Add space on the left side of the search result container.', 'shopengine'),
732 'type' => Controls_Manager::SLIDER,
733 'size_units' => ['px'],
734 'range' => [
735 'px' => [
736 'min' => 0,
737 'max' => 300,
738 'step' => 1,
739 ],
740 ],
741 'default' => [
742 'unit' => 'px',
743 'size' => 0,
744 ],
745 'selectors' => [
746 '{{WRAPPER}} .shopengine-search-result-container' => 'left: {{SIZE}}{{UNIT}}; width: calc(100% - {{SIZE}}{{UNIT}});',
747 '.rtl {{WRAPPER}} .shopengine-search-result-container' => 'right: {{SIZE}}{{UNIT}}; width: calc(100% - {{SIZE}}{{UNIT}});',
748 ],
749 ]
750 );
751
752 $this->add_control(
753 'shopengine_advanced_search_right_space',
754 [
755 'label' => esc_html__('Space On the Right', 'shopengine'),
756 'description' => esc_html__('Add space on the right side of the search result container.', 'shopengine'),
757 'type' => Controls_Manager::SLIDER,
758 'size_units' => ['px'],
759 'range' => [
760 'px' => [
761 'min' => 0,
762 'max' => 300,
763 'step' => 1,
764 ],
765 ],
766 'default' => [
767 'unit' => 'px',
768 'size' => 0,
769 ],
770 'selectors' => [
771 '{{WRAPPER}} .shopengine-search-result-container' => 'width: calc(100% - {{SIZE}}{{UNIT}});',
772 ],
773 'condition' => [
774 'shopengine_advanced_search_left_space' => '0',
775 ],
776 ]
777 );
778
779
780
781
782 $this->add_control(
783 'shopengine_search_title_heading',
784 [
785 'label' => esc_html__('Title:', 'shopengine'),
786 'type' => Controls_Manager::HEADING,
787 'separator' => 'before',
788 ]
789 );
790
791 $this->add_control(
792 'shopengine_advanced_search_product_title_clr',
793 [
794 'label' => esc_html__('Title Color', 'shopengine'),
795 'type' => Controls_Manager::COLOR,
796 'default' => '#3E3E3E',
797 'alpha' => false,
798 'selectors' => [
799 '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item--title a' => 'color: {{VALUE}}',
800 ],
801 ]
802 );
803
804 $this->add_control(
805 'shopengine_advanced_search_product_title_hover_clr',
806 [
807 'label' => esc_html__('Title Hover Color', 'shopengine'),
808 'type' => Controls_Manager::COLOR,
809 'default' => '#F03D3F',
810 'alpha' => false,
811 'selectors' => [
812 '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item--title a:hover' => 'color: {{VALUE}}',
813 ],
814 ]
815 );
816
817 $this->add_group_control(
818 Group_Control_Typography::get_type(),
819 [
820 'name' => 'shopengine_advanced_search_product_title_typography',
821 'label' => esc_html__('Title Typography', 'shopengine'),
822 'selector' => '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item--title a',
823 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style'],
824
825 'fields_options' => [
826 'typography' => [
827 'default' => 'custom',
828 ],
829 'font_weight' => [
830 'default' => '500',
831 ],
832 'font_size' => [
833 'label' => esc_html__('Font Size (px)', 'shopengine'),
834 'default' => [
835 'size' => '15',
836 'unit' => 'px',
837 ],
838 'size_units' => ['px'],
839 ],
840 'line_height' => [
841 'label' => esc_html__('Line-height (px)', 'shopengine'),
842 'default' => [
843 'size' => '18',
844 'unit' => 'px',
845 ],
846 'responsive' => false,
847 'size_units' => ['px'],
848 ],
849 ],
850 ]
851 );
852
853
854 $this->add_control(
855 'shopengine_search_price_heading',
856 [
857 'label' => esc_html__('Price:', 'shopengine'),
858 'type' => Controls_Manager::HEADING,
859 'separator' => 'before',
860 ]
861 );
862
863 $this->add_control(
864 'shopengine_advanced_search_product_reg_price_clr',
865 [
866 'label' => esc_html__('Regular Price Color', 'shopengine'),
867 'type' => Controls_Manager::COLOR,
868 'default' => '#101010',
869 'alpha' => false,
870 'selectors' => [
871 '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item--price ins .amount' => 'color: {{VALUE}}',
872 ],
873 ]
874 );
875
876 $this->add_control(
877 'shopengine_advanced_search_product_sell_price_clr',
878 [
879 'label' => esc_html__('Sale Price Color', 'shopengine'),
880 'type' => Controls_Manager::COLOR,
881 'default' => '#999999',
882 'alpha' => false,
883 'selectors' => [
884 '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item--price del .amount' => 'color: {{VALUE}}',
885 ],
886 ]
887 );
888
889 $this->add_group_control(
890 Group_Control_Typography::get_type(),
891 [
892 'name' => 'shopengine_advanced_search_product_price_typography',
893 'label' => esc_html__('Price Typography', 'shopengine'),
894 'selector' => '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item--price .amount',
895 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style', 'line_height', 'text_transform'],
896
897 'fields_options' => [
898 'typography' => [
899 'default' => 'custom',
900 ],
901 'font_weight' => [
902 'default' => '500',
903 ],
904 'font_size' => [
905 'label' => esc_html__('Font Size (px)', 'shopengine'),
906 'default' => [
907 'size' => '14',
908 'unit' => 'px',
909 ],
910 'size_units' => ['px'],
911 ],
912 ],
913 ]
914 );
915
916 $this->add_control(
917 'shopengine_search_badge_heading',
918 [
919 'label' => esc_html__('Discount Badge:', 'shopengine'),
920 'type' => Controls_Manager::HEADING,
921 'separator' => 'before',
922 ]
923 );
924
925 $this->add_control(
926 'shopengine_search_add_badge',
927 [
928 'label' => esc_html__('Show Badge?', 'shopengine'),
929 'type' => Controls_Manager::SWITCHER,
930 'label_on' => esc_html__('Hide', 'shopengine'),
931 'label_off' => esc_html__('Show', 'shopengine'),
932 'return_value' => 'block',
933 'default' => 'none',
934 'selectors' => [
935 '{{WRAPPER}} .shopengine-advanced-search .shopengine-discount-badge' => 'display: {{VALUE}};',
936 ],
937 ]
938 );
939
940 $this->add_control(
941 'shopengine_search_badge_color',
942 [
943 'type' => \Elementor\Controls_Manager::COLOR,
944 'label' => esc_html__( 'Badge Color', 'shopengine' ),
945 'default' => '#ffffff',
946 'selectors' => [
947 '{{WRAPPER}} .shopengine-advanced-search .shopengine-discount-badge' => 'color: {{VALUE}};',
948 ],
949 ]
950 );
951 $this->add_control(
952 'shopengine_search_badge_background_color',
953 [
954 'type' => \Elementor\Controls_Manager::COLOR,
955 'label' => esc_html__( 'Badge Background Color', 'shopengine' ),
956 'default' => '#F54F29',
957 'selectors' => [
958 '{{WRAPPER}} .shopengine-advanced-search .shopengine-discount-badge ' => 'background-color: {{VALUE}};',
959 ],
960 ]
961 );
962
963
964 $this->add_group_control(
965 Group_Control_Typography::get_type(),
966 [
967 'name' => 'shopengine_advanced_search_product_badge_typography',
968 'label' => esc_html__('Badge Typography', 'shopengine'),
969 'selector' => '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item--price .shopengine-discount-badge',
970 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style', 'text_transform'],
971
972 'fields_options' => [
973 'typography' => [
974 'default' => 'custom',
975 ],
976 'font_weight' => [
977 'default' => '500',
978 ],
979 'font_size' => [
980 'label' => esc_html__('Font Size (px)', 'shopengine'),
981 'default' => [
982 'size' => '14',
983 'unit' => 'px',
984 ],
985 'size_units' => ['px'],
986 ],
987 ],
988 ]
989 );
990
991 $this->add_responsive_control(
992 'shopengine_search_badge_border_radius',
993 [
994 'type' => \Elementor\Controls_Manager::DIMENSIONS,
995 'label' => esc_html__( 'Badge Border Radius', 'shopengine' ),
996 'size_units' => [ 'px', 'em', '%' ],
997 'selectors' => [
998 '{{WRAPPER}} .shopengine-advanced-search .shopengine-discount-badge' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
999 '.rtl {{WRAPPER}} .shopengine-advanced-search .shopengine-discount-badge' => 'border-radius: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};',
1000 ],
1001 ]
1002 );
1003
1004 $this->add_control(
1005 'shopengine_search_rating_heading',
1006 [
1007 'label' => esc_html__('Rating:', 'shopengine'),
1008 'type' => Controls_Manager::HEADING,
1009 'separator' => 'before',
1010 ]
1011 );
1012
1013 $this->add_control(
1014 'shopengine_search_rating_size',
1015 [
1016 'label' => esc_html__('Rating Font Size', 'shopengine'),
1017 'type' => Controls_Manager::SLIDER,
1018 'size_units' => ['px'],
1019 'range' => [
1020 'px' => [
1021 'min' => 0,
1022 'max' => 100,
1023 'step' => 1,
1024 ],
1025 ],
1026 'default' => [
1027 'unit' => 'px',
1028 'size' => 10,
1029 ],
1030 'selectors' => [
1031 '{{WRAPPER}} .shopengine-advanced-search .shopengine-product-rating .star-rating, {{WRAPPER}} .shopengine-advanced-search .shopengine-product-rating .rating-count' => 'font-size: {{SIZE}}{{UNIT}};',
1032 ],
1033 ]
1034 );
1035
1036 $this->add_control(
1037 'shopengine_search_rating_color',
1038 [
1039 'label' => esc_html__('Star Color', 'shopengine'),
1040 'type' => Controls_Manager::COLOR,
1041 'alpha' => false,
1042 'default' => '#fec42d',
1043 'selectors' => [
1044 '{{WRAPPER}} .shopengine-product-rating .star-rating::before' => 'color: {{VALUE}};',
1045 '{{WRAPPER}} .shopengine-product-rating .star-rating span::before' => 'color: {{VALUE}};'
1046 ],
1047 ]
1048 );
1049
1050
1051
1052 $this->add_control(
1053 'product_rating_count_color',
1054 [
1055 'label' => esc_html__('Counter', 'shopengine'),
1056 'type' => Controls_Manager::COLOR,
1057 'alpha' => false,
1058 'default' => '#858585',
1059 'selectors' => [
1060 '{{WRAPPER}} .shopengine-product-rating .rating-count' => 'color: {{VALUE}}',
1061 ],
1062 ]
1063 );
1064
1065
1066
1067 $this->add_control(
1068 'shopengine_search_more_btn_heading',
1069 [
1070 'label' => esc_html__('Arrow Button:', 'shopengine'),
1071 'type' => Controls_Manager::HEADING,
1072 'separator' => 'before',
1073 ]
1074 );
1075
1076 $this->add_control(
1077 'shopengine_search_more_btn_icon_color',
1078 [
1079 'label' => esc_html__('Icon Color', 'shopengine'),
1080 'type' => Controls_Manager::COLOR,
1081 'default' => '#565969',
1082 'alpha' => false,
1083 'selectors' => [
1084 '{{WRAPPER}} .shopengine-search-more-btn' => 'color: {{VALUE}}',
1085 ],
1086 ]
1087 );
1088
1089 $this->add_control(
1090 'shopengine_search_more_btn_icon_bg_color',
1091 [
1092 'label' => esc_html__('Icon Background Color', 'shopengine'),
1093 'type' => Controls_Manager::COLOR,
1094 'default' => 'rgba(86, 89, 105, 0.1)',
1095 'alpha' => false,
1096 'selectors' => [
1097 '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-more-btn' => 'background-color: {{VALUE}}',
1098 ],
1099 ]
1100 );
1101
1102 $this->add_control(
1103 'shopengine_search_more_btn_icon_bg_color_hover',
1104 [
1105 'label' => esc_html__('Icon Hover Background Color', 'shopengine'),
1106 'type' => Controls_Manager::COLOR,
1107 'default' => '#F03D3F',
1108 'alpha' => false,
1109 'selectors' => [
1110 '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item:hover .shopengine-search-more-btn' => 'background-color: {{VALUE}}',
1111 ],
1112 ]
1113 );
1114
1115 $this->add_control(
1116 'shopengine_search_wrapper_heading',
1117 [
1118 'label' => esc_html__('Product Item:', 'shopengine'),
1119 'type' => Controls_Manager::HEADING,
1120 'separator' => 'before',
1121 ]
1122 );
1123
1124 $this->add_control(
1125 'shopengine_advanced_search_product_padding',
1126 [
1127 'label' => esc_html__('Wrapper Padding (px)', 'shopengine'),
1128 'type' => Controls_Manager::DIMENSIONS,
1129 'size_units' => ['px'],
1130 'default' => [
1131 'top' => '10',
1132 'right' => '10',
1133 'bottom' => '10',
1134 'left' => '10',
1135 'unit' => 'px',
1136 'isLinked' => false,
1137 ],
1138 'selectors' => [
1139 '{{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1140 '.rtl {{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item' => 'padding: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};',
1141 ],
1142 ]
1143 );
1144
1145 $this->add_group_control(
1146 Group_Control_Border::get_type(),
1147 [
1148 'name' => 'shopengine_advanced_search_product_border',
1149 'label' => esc_html__('Border', 'shopengine'),
1150 'selector' => '{{WRAPPER}} .shopengine-advanced-search :is( .shopengine-product-search-result, .shopengine-search-product__item)',
1151 'fields_options' => [
1152 'border_type' => [
1153 'default' => 'yes',
1154 ],
1155 'border' => [
1156 'default' => 'solid',
1157 'responsive' => false,
1158 ],
1159
1160 'width' => [
1161 'label' => esc_html__('Border Width', 'shopengine'),
1162 'default' => [
1163 'top' => '1',
1164 'right' => '1',
1165 'bottom' => '1',
1166 'left' => '1',
1167 'unit' => 'px',
1168 ],
1169 'responsive' => false,
1170 'selectors' => [
1171 '{{WRAPPER}} .shopengine-advanced-search :is( .shopengine-product-search-result, .shopengine-search-product__item)' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1172 '.rtl {{WRAPPER}} .shopengine-advanced-search :is( .shopengine-product-search-result, .shopengine-search-product__item)' => 'border-width: {{TOP}}{{UNIT}} {{LEFT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{RIGHT}}{{UNIT}};',
1173 ],
1174 ],
1175
1176 'color' => [
1177 'label' => esc_html__('Border Color', 'shopengine'),
1178 'alpha' => false,
1179 'default' => '#E6E6E6',
1180 'responsive' => false,
1181 ],
1182
1183 ],
1184 ]
1185 );
1186
1187 $this->end_controls_section(); // end ./ product wrap style
1188
1189 // More Product button
1190 $this->start_controls_section(
1191 'shopengine_advanced_search_more_btn',
1192 [
1193 'label' => esc_html__('More Products Button', 'shopengine'),
1194 'tab' => Controls_Manager::TAB_STYLE,
1195 ]
1196 );
1197
1198 $this->add_control(
1199 'shopengine_advanced_search_more_size',
1200 [
1201 'label' => esc_html__('Font Size', 'shopengine'),
1202 'type' => Controls_Manager::SLIDER,
1203 'size_units' => ['px'],
1204 'range' => [
1205 'px' => [
1206 'min' => 0,
1207 'max' => 1000,
1208 'step' => 5,
1209 ],
1210 ],
1211 'selectors' => [
1212 '{{WRAPPER}} .shopengine-search-more-products' => 'font-size: {{SIZE}}{{UNIT}};',
1213 ],
1214 ]
1215 );
1216
1217 $this->add_control(
1218 'shopengine_advanced_search_more_color',
1219 [
1220 'label' => esc_html__('Color', 'shopengine'),
1221 'type' => Controls_Manager::COLOR,
1222 'default' => '#F03D3F',
1223 'alpha' => false,
1224 'selectors' => [
1225 '{{WRAPPER}} .shopengine-search-more-products' => 'color: {{VALUE}}',
1226 ],
1227 ]
1228 );
1229
1230 $this->add_control(
1231 'shopengine_advanced_search_more_color_hover',
1232 [
1233 'label' => esc_html__('Hover Color', 'shopengine'),
1234 'type' => Controls_Manager::COLOR,
1235 'default' => '#bd1517',
1236 'alpha' => false,
1237 'selectors' => [
1238 '{{WRAPPER}} .shopengine-search-more-products:hover' => 'color: {{VALUE}}',
1239 ],
1240 ]
1241 );
1242
1243 $this->end_controls_section();
1244
1245 //global font family
1246 $this->start_controls_section(
1247 'shopengine_advanced_search_typography',
1248 array(
1249 'label' => esc_html__('Global Font', 'shopengine'),
1250 'tab' => Controls_Manager::TAB_STYLE,
1251 )
1252 );
1253
1254 $this->add_control(
1255 'shopengine_advanced_search_font_family',
1256 [
1257 'label' => esc_html__('Font Family', 'shopengine'),
1258 'description' => esc_html__('This font family is set for this specific widget.', 'shopengine'),
1259 'type' => Controls_Manager::FONT,
1260 'default' => '',
1261 'selectors' => [
1262 '{{WRAPPER}} .shopengine-advanced-search .search-input-group :is( input, input::placeholder ),
1263 {{WRAPPER}} .shopengine-advanced-search .shopengine-search-text,
1264 {{WRAPPER}} .shopengine-advanced-search .shopengine-product-rating .rating-count,
1265 {{WRAPPER}} .shopengine-advanced-search .search-input-group :is( select ),
1266 {{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item--title,
1267 {{WRAPPER}} .shopengine-advanced-search .shopengine-search-product__item--price' => 'font-family: {{VALUE}}',
1268 ],
1269 ]
1270 );
1271
1272 $this->end_controls_section();
1273 }
1274
1275 private function generate_order_item_css($order_items) {
1276 $styles = '';
1277 $parent_class = '.elementor-element-' . $this->get_id();
1278
1279 foreach($order_items as $key => $item) {
1280 $order_number = $key + 1;
1281 if($item['list_key'] == 'search-box') {
1282 $styles .= $parent_class . ' .shopengine-advanced-search .search-input-group :is( button ) {order: '. $order_number .';}';
1283 }
1284 if($item['list_key'] == 'search-input') {
1285 $styles .= $parent_class . ' .shopengine-advanced-search-input {order: '. $order_number .';}';
1286 }
1287 if($item['list_key'] == 'category-selector') {
1288 $styles .= $parent_class . ' .shopengine-category-select-wraper {order: '. $order_number .';}';
1289 }
1290 }
1291 echo '<style>';
1292 shopengine_content_render($styles);
1293 echo '</style>';
1294 }
1295
1296 protected function screen() {
1297
1298 $settings = $this->get_settings_for_display();
1299 $post_type = get_post_type();
1300
1301 if(!empty($settings['shopengine_custom_ordering_list'])) {
1302 $this->generate_order_item_css($settings['shopengine_custom_ordering_list']);
1303 }
1304
1305 $product = Products::instance()->get_product($post_type);
1306
1307 $tpl = Products::instance()->get_widget_template($this->get_name());
1308
1309 include $tpl;
1310 }
1311 }
1312