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