PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution / 1.0.0
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution v1.0.0
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 / related / related.php
shopengine / widgets / related Last commit date
screens 5 years ago related-config.php 5 years ago related.php 5 years ago
related.php
1779 lines
1 <?php
2
3 namespace Elementor;
4
5 defined('ABSPATH') || exit;
6
7
8 use ShopEngine\Widgets\Products;
9
10 class ShopEngine_Related extends \ShopEngine\Base\Widget
11 {
12
13 public function config() {
14 return new ShopEngine_Related_Config();
15 }
16
17 protected function register_controls() {
18
19 /*
20 * Content Tab
21 */
22 $this->start_controls_section(
23 'shopengine_related_product_content_section',
24 [
25 'label' => esc_html__('Content', 'shopengine'),
26 'tab' => Controls_Manager::TAB_CONTENT,
27 ]
28 );
29
30 $this->add_control(
31 'shopengine_related_product_enable_slider',
32 [
33 'label' => esc_html__('Enable Slider', 'shopengine'),
34 'type' => Controls_Manager::SWITCHER,
35 'label_on' => esc_html__('Yes', 'shopengine'),
36 'label_off' => esc_html__('No', 'shopengine'),
37 'return_value' => 'yes',
38 'default' => 'yes',
39 'separator' => 'before',
40 ]
41 );
42
43 $this->add_control(
44 'shopengine_related_product_show_heading',
45 [
46 'label' => esc_html__('Heading', 'shopengine'),
47 'type' => Controls_Manager::SWITCHER,
48 'label_on' => esc_html__('Show', 'shopengine'),
49 'label_off' => esc_html__('Hide', 'shopengine'),
50 'return_value' => 'yes',
51 'default' => 'yes',
52 'selectors' => [
53 '{{WRAPPER}} .shopengine-related .related > h2' => 'display: block;',
54 ],
55 ]
56 );
57
58 $this->add_control(
59 'shopengine_related_product_show_flash_sale',
60 [
61 'label' => esc_html__('Flash Sale', 'shopengine'),
62 'type' => Controls_Manager::SWITCHER,
63 'label_on' => esc_html__('Show', 'shopengine'),
64 'label_off' => esc_html__('Hide', 'shopengine'),
65 'return_value' => 'yes',
66 'default' => 'yes',
67 'selectors' => [
68 '{{WRAPPER}} .shopengine-related .related .onsale' => 'display: block;',
69 ],
70 ]
71 );
72
73 $this->add_control(
74 'shopengine_related_product_show_sale_price',
75 [
76 'label' => esc_html__('Sale Price', 'shopengine'),
77 'type' => Controls_Manager::SWITCHER,
78 'label_on' => esc_html__('Show', 'shopengine'),
79 'label_off' => esc_html__('Hide', 'shopengine'),
80 'return_value' => 'yes',
81 'default' => 'yes',
82 'selectors' => [
83 '{{WRAPPER}} .shopengine-related .related .price del' => 'display: inline-block;',
84 ],
85 ]
86 );
87
88 $this->add_control(
89 'shopengine_related_product_show_cart_btn',
90 [
91 'label' => esc_html__('Cart Button', 'shopengine'),
92 'type' => Controls_Manager::SWITCHER,
93 'label_on' => esc_html__('Show', 'shopengine'),
94 'label_off' => esc_html__('Hide', 'shopengine'),
95 'return_value' => 'yes',
96 'default' => 'yes',
97 'selectors' => [
98 '{{WRAPPER}} .shopengine-related .related .button' => 'display: block;',
99 ],
100 ]
101 );
102
103 $this->add_control(
104 'shopengine_related_product_to_show',
105 [
106 'label' => esc_html__('Products to Show', 'shopengine'),
107 'description' => esc_html__('How many products want show in total.', 'shopengine'),
108 'type' => Controls_Manager::NUMBER,
109 'default' => 4,
110 'min' => 1,
111 'max' => 50,
112 'separator' => 'before',
113 ]
114 );
115
116 $this->add_responsive_control(
117 'shopengine_related_product_columns',
118 [
119 'label' => esc_html__('Columns', 'shopengine'),
120 'description' => esc_html__('How many products want show per row.', 'shopengine'),
121 'type' => Controls_Manager::NUMBER,
122 'default' => 4,
123 'tablet_default' => 2,
124 'mobile_default' => 1,
125 'min' => 1,
126 'max' => 12,
127 'selectors' => [
128 '{{WRAPPER}} .shopengine-related ul.products' => 'display: grid; grid-template-columns: repeat({{SIZE}}, 1fr) !important;',
129 ],
130 'condition' => [
131 'shopengine_related_product_enable_slider!' => 'yes',
132 ],
133 ]
134 );
135
136 $this->end_controls_section();
137
138 /*
139 * Content Tab - Slider Controls
140 */
141 $this->start_controls_section(
142 'shopengine_related_product_slider_controls_section',
143 [
144 'label' => esc_html__('Slider Controls', 'shopengine'),
145 'tab' => Controls_Manager::TAB_CONTENT,
146 'condition' => [
147 'shopengine_related_product_enable_slider' => 'yes',
148 ],
149 ]
150 );
151
152 $this->add_control(
153 'shopengine_related_product_slider_perview',
154 [
155 'label' => esc_html__('Slides Per View', 'shopengine'),
156 'type' => Controls_Manager::NUMBER,
157 'default' => 4,
158 'min' => 1,
159 'max' => 12,
160 'description' => esc_html__('This value will be the number of slides to show in viewport.', 'shopengine'),
161 ]
162 );
163
164 $this->add_control(
165 'shopengine_related_product_slider_loop',
166 [
167 'label' => esc_html__('Loop', 'shopengine'),
168 'type' => Controls_Manager::SWITCHER,
169 'label_on' => esc_html__('Yes', 'shopengine'),
170 'label_off' => esc_html__('No', 'shopengine'),
171 'default' => 'yes',
172 'return_value' => 'yes',
173 ]
174 );
175
176 $this->add_control(
177 'shopengine_related_product_slider_autoplay',
178 [
179 'label' => esc_html__('Autoplay', 'shopengine'),
180 'type' => Controls_Manager::SWITCHER,
181 'label_on' => esc_html__('Yes', 'shopengine'),
182 'label_off' => esc_html__('No', 'shopengine'),
183 'default' => 'yes',
184 'return_value' => 'yes',
185 ]
186 );
187
188 $this->add_control(
189 'shopengine_related_product_slider_autoplay_delay',
190 [
191 'label' => esc_html__('Slide Speed', 'shopengine'),
192 'type' => Controls_Manager::NUMBER,
193 'default' => 3000,
194 'min' => 0,
195 'max' => 10000,
196 'condition' => [
197 'shopengine_related_product_slider_autoplay' => 'yes',
198 ],
199 ]
200 );
201
202 $this->add_control(
203 'shopengine_related_product_slider_show_arrows',
204 [
205 'label' => esc_html__('Show Arrows', 'shopengine'),
206 'type' => Controls_Manager::SWITCHER,
207 'label_off' => esc_html__('Hide', 'shopengine'),
208 'label_on' => esc_html__('Show', 'shopengine'),
209 'default' => 'yes',
210 'return_value' => 'yes',
211 'condition' => [
212 'shopengine_related_product_slider_loop' => 'yes',
213 ],
214 ]
215 );
216
217 $this->add_control(
218 'shopengine_related_product_slider_show_dots',
219 [
220 'label' => esc_html__('Show Dots', 'shopengine'),
221 'type' => Controls_Manager::SWITCHER,
222 'label_off' => esc_html__('Hide', 'shopengine'),
223 'label_on' => esc_html__('Show', 'shopengine'),
224 'default' => 'yes',
225 'return_value' => 'yes',
226 ]
227 );
228
229 $this->add_control(
230 'shopengine_related_product_slider_arrow_size',
231 [
232 'label' => esc_html__('Arrow Size (px)', 'shopengine'),
233 'type' => Controls_Manager::SLIDER,
234 'size_units' => ['px'],
235 'range' => [
236 'px' => [
237 'min' => 0,
238 'max' => 100,
239 'step' => 5,
240 ],
241 ],
242 'default' => [
243 'unit' => 'px',
244 'size' => 40,
245 ],
246 'selectors' => [
247 '{{WRAPPER}} .shopengine-related :is(.swiper-button-next, .swiper-button-prev)' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
248 ],
249 'condition' => [
250 'shopengine_related_product_slider_show_arrows' => 'yes',
251 ],
252 'separator' => 'before',
253 ]
254 );
255
256 $this->add_control(
257 'shopengine_related_product_slider_left_arrow_icon',
258 [
259 'label' => esc_html__('Left Arrow', 'shopengine'),
260 'type' => Controls_Manager::ICONS,
261 'fa4compatibility' => 'icon',
262 'default' => [
263 'value' => 'fas fa-chevron-left',
264 'library' => 'fa-solid',
265 ],
266 'condition' => [
267 'shopengine_related_product_slider_show_arrows' => 'yes',
268 ],
269 ]
270 );
271
272 $this->add_control(
273 'shopengine_related_product_slider_right_arrow_icon',
274 [
275 'label' => esc_html__('Right Arrow', 'shopengine'),
276 'type' => Controls_Manager::ICONS,
277 'fa4compatibility' => 'icon',
278 'default' => [
279 'value' => 'fas fa-chevron-right',
280 'library' => 'fa-solid',
281 ],
282 'condition' => [
283 'shopengine_related_product_slider_show_arrows' => 'yes',
284 ],
285 ]
286 );
287
288 $this->add_control(
289 'shopengine_related_product_slider_dots_size',
290 [
291 'label' => esc_html__('Dots Size (px)', 'shopengine'),
292 'type' => Controls_Manager::SLIDER,
293 'size_units' => ['px'],
294 'range' => [
295 'px' => [
296 'min' => 0,
297 'max' => 50,
298 'step' => 1,
299 ],
300 ],
301 'default' => [
302 'unit' => 'px',
303 'size' => 6,
304 ],
305 'selectors' => [
306 '{{WRAPPER}} .shopengine-related .swiper-pagination-bullet' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
307 ],
308 'condition' => [
309 'shopengine_related_product_slider_show_dots' => 'yes',
310 ],
311 'separator' => 'before',
312 ]
313 );
314
315 $this->add_control(
316 'shopengine_related_product_slider_dots_size_active',
317 [
318 'label' => esc_html__('Active Dots Size (px)', 'shopengine'),
319 'type' => Controls_Manager::SLIDER,
320 'size_units' => ['px'],
321 'range' => [
322 'px' => [
323 'min' => 0,
324 'max' => 50,
325 'step' => 1,
326 ],
327 ],
328 'default' => [
329 'unit' => 'px',
330 'size' => 15,
331 ],
332 'selectors' => [
333 '{{WRAPPER}} .shopengine-related .swiper-pagination-bullet.swiper-pagination-bullet-active' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
334 ],
335 'condition' => [
336 'shopengine_related_product_slider_show_dots' => 'yes',
337 ],
338 ]
339 );
340
341 $this->end_controls_section();
342
343 /*
344 * Content Tab - Advanced Slider Controls
345 */
346 $this->start_controls_section(
347 'shopengine_related_product_advance_controls',
348 [
349 'label' => esc_html__('Advanced', 'shopengine'),
350 'tab' => Controls_Manager::TAB_CONTENT,
351 ]
352 );
353
354 $this->add_control(
355 'shopengine_related_product_orderby',
356 [
357 'label' => esc_html__('Order By', 'shopengine'),
358 'type' => Controls_Manager::SELECT,
359 'default' => 'rand',
360 'options' => [
361 'date' => esc_html__('Date', 'shopengine'),
362 'title' => esc_html__('Title', 'shopengine'),
363 'price' => esc_html__('Price', 'shopengine'),
364 'popularity' => esc_html__('Popularity', 'shopengine'),
365 'rating' => esc_html__('Rating', 'shopengine'),
366 'rand' => esc_html__('Random', 'shopengine'),
367 'menu_order' => esc_html__('Menu Order', 'shopengine'),
368 'modified' => esc_html__('Modified Date', 'shopengine'),
369 ],
370 ]
371 );
372
373 $this->add_control(
374 'shopengine_related_product_order',
375 [
376 'label' => esc_html__('Order', 'shopengine'),
377 'type' => Controls_Manager::SELECT,
378 'default' => 'desc',
379 'options' => [
380 'desc' => esc_html__('DESC', 'shopengine'),
381 'asc' => esc_html__('ASC', 'shopengine'),
382 ],
383 ]
384 );
385
386 $this->end_controls_section();
387
388
389 /*
390 * Style Tab - Heading
391 */
392 $this->start_controls_section(
393 'shopengine_related_product_section_heading',
394 [
395 'label' => esc_html__('Heading', 'shopengine'),
396 'tab' => Controls_Manager::TAB_STYLE,
397 'condition' => [
398 'shopengine_related_product_show_heading' => 'yes',
399 ],
400 ]
401 );
402
403 $this->add_control(
404 'shopengine_related_product_header_color',
405 [
406 'label' => esc_html__('Color', 'shopengine'),
407 'type' => Controls_Manager::COLOR,
408 'default' => '#3E3E3E',
409 'alpha' => false,
410 'selectors' => [
411 '{{WRAPPER}} .shopengine-related .related > h2' => 'color: {{VALUE}};',
412 ],
413 ]
414 );
415
416 $this->add_group_control(
417 Group_Control_Typography::get_type(),
418 [
419 'name' => 'shopengine_related_product_header_typography',
420 'label' => esc_html__('Typography', 'shopengine'),
421 'selector' => '{{WRAPPER}} .shopengine-related .related > h2',
422 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style'],
423 'fields_options' => [
424 'typography' => [
425 'default' => 'custom',
426 ],
427 'font_weight' => [
428 'default' => '700',
429 ],
430 'font_size' => [
431 'label' => esc_html__('Font Size (px)', 'shopengine'),
432 'default' => [
433 'size' => '36',
434 'unit' => 'px',
435 ],
436 'size_units' => ['px'],
437 ],
438 'text_transform' => [
439 'default' => '',
440 ],
441 'line_height' => [
442 'label' => esc_html__('Line Height (px)', 'shopengine'),
443 'default' => [
444 'size' => '40',
445 'unit' => 'px',
446 ],
447 'size_units' => ['px'],
448 'tablet_default' => [
449 'unit' => 'px',
450 ],
451 'mobile_default' => [
452 'unit' => 'px',
453 ],
454 ],
455 ],
456 ]
457 );
458
459 $this->add_responsive_control(
460 'shopengine_related_product_header_text_align',
461 [
462 'label' => esc_html__('Text Align', 'shopengine'),
463 'type' => Controls_Manager::CHOOSE,
464 'options' => [
465 'left' => [
466 'title' => esc_html__('Left', 'shopengine'),
467 'icon' => 'fa fa-align-left',
468 ],
469 'center' => [
470 'title' => esc_html__('Center', 'shopengine'),
471 'icon' => 'fa fa-align-center',
472 ],
473 'right' => [
474 'title' => esc_html__('Right', 'shopengine'),
475 'icon' => 'fa fa-align-right',
476 ],
477 ],
478 'default' => 'center',
479 'selectors' => [
480 '{{WRAPPER}} .shopengine-related .related > h2' => 'text-align: {{VALUE}}',
481 ],
482 ]
483 );
484
485 $this->add_responsive_control(
486 'shopengine_related_product_header_margin',
487 [
488 'label' => esc_html__('Margin (px)', 'shopengine'),
489 'type' => Controls_Manager::DIMENSIONS,
490 'size_units' => ['px'],
491 'default' => [
492 'top' => '0',
493 'right' => '0',
494 'bottom' => '35',
495 'left' => '0',
496 'isLinked' => false,
497 ],
498 'selectors' => [
499 '{{WRAPPER}} .shopengine-related .related > h2' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
500 ],
501 'separator' => 'before',
502 ]
503 );
504
505 $this->end_controls_section();
506
507 /*
508 * Style Tab - Products Wrap
509 */
510 $this->start_controls_section(
511 'shopengine_related_product_items_section',
512 [
513 'label' => esc_html__('Items', 'shopengine'),
514 'tab' => Controls_Manager::TAB_STYLE,
515 ]
516 );
517
518 $this->add_responsive_control(
519 'shopengine_related_product_text_align',
520 [
521 'label' => esc_html__('Text Align', 'shopengine'),
522 'type' => Controls_Manager::CHOOSE,
523 'options' => [
524 'left' => [
525 'title' => esc_html__('Left', 'shopengine'),
526 'icon' => 'fa fa-align-left',
527 ],
528 'center' => [
529 'title' => esc_html__('Center', 'shopengine'),
530 'icon' => 'fa fa-align-center',
531 ],
532 'right' => [
533 'title' => esc_html__('Right', 'shopengine'),
534 'icon' => 'fa fa-align-right',
535 ],
536 ],
537 'default' => 'left',
538 'selectors_dictionary' => [
539 'left' => 'text-align: left; justify-content: flex-start;',
540 'center' => 'text-align: center; justify-content: center;',
541 'right' => 'text-align: right; justify-content: flex-end;',
542 ],
543 'selectors' => [
544 '{{WRAPPER}} .shopengine-related .related :is(.product, .price)' => '{{VALUE}}',
545 ],
546 ]
547 );
548
549 $this->add_responsive_control(
550 'shopengine_related_product_column_gap',
551 [
552 'label' => esc_html__('Column Gap (px)', 'shopengine'),
553 'type' => Controls_Manager::SLIDER,
554 'size_units' => ['px'],
555 'range' => [
556 'px' => [
557 'min' => 0,
558 'max' => 100,
559 'step' => 1,
560 ],
561 ],
562 'default' => [
563 'unit' => 'px',
564 'size' => 30,
565 ],
566 'selectors' => [
567 '{{WRAPPER}} .shopengine-related.slider-disabled ul.products' => 'grid-gap: {{SIZE}}{{UNIT}};',
568 ],
569 ]
570 );
571
572 $this->add_control(
573 'shopengine_related_product_buttons',
574 [
575 'label' => esc_html__( 'Buttons', 'shopengine' ),
576 'type' => Controls_Manager::HEADING,
577 'separator' => 'before',
578 ]
579 );
580
581 $this->add_control(
582 'shopengine_related_product_btns_space_between',
583 [
584 'label' => esc_html__('Space Between (px)', 'shopengine'),
585 'type' => Controls_Manager::SLIDER,
586 'size_units' => ['px'],
587 'range' => [
588 'px' => [
589 'min' => 0,
590 'max' => 50,
591 'step' => 1,
592 ],
593 ],
594 'default' => [
595 'unit' => 'px',
596 'size' => 10,
597 ],
598 'selectors' => [
599 '{{WRAPPER}} .shopengine-related .related .products li a:not(.woocommerce-LoopProduct-link, :last-child)' => 'margin-right: {{SIZE}}{{UNIT}};',
600 ],
601 ]
602 );
603
604 $this->end_controls_section();
605
606 /*
607 * Style Tab - Flash Sale
608 */
609 $this->start_controls_section(
610 'shopengine_related_product_flash_sale',
611 [
612 'label' => esc_html__('Flash Sale', 'shopengine'),
613 'tab' => Controls_Manager::TAB_STYLE,
614 'condition' => [
615 'shopengine_related_product_show_flash_sale' => 'yes',
616 ],
617 ]
618 );
619
620 $this->add_control(
621 'shopengine_related_product_flash_sale_color',
622 [
623 'label' => esc_html__('Color', 'shopengine'),
624 'type' => Controls_Manager::COLOR,
625 'default' => '#FFFFFF',
626 'alpha' => false,
627 'selectors' => [
628 '{{WRAPPER}} .shopengine-related .onsale' => 'color: {{VALUE}};',
629 ],
630 ]
631 );
632
633 $this->add_control(
634 'shopengine_related_product_flash_sale_bg_color',
635 [
636 'label' => esc_html__('Background Color', 'shopengine'),
637 'type' => Controls_Manager::COLOR,
638 'default' => '#4285f4',
639 'alpha' => false,
640 'selectors' => [
641 '{{WRAPPER}} .shopengine-related .onsale' => 'background-color: {{VALUE}};',
642 ],
643 ]
644 );
645
646 $this->add_group_control(
647 Group_Control_Typography::get_type(),
648 [
649 'name' => 'shopengine_related_product_flash_sale_badge_typography',
650 'label' => esc_html__('Typography', 'shopengine'),
651 'selector' => '{{WRAPPER}} .shopengine-related .onsale',
652 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style'],
653 'fields_options' => [
654 'typography' => [
655 'default' => 'custom',
656 ],
657 'font_weight' => [
658 'default' => '400',
659 ],
660 'font_size' => [
661 'label' => esc_html__('Font Size (px)', 'shopengine'),
662 'default' => [
663 'size' => '12',
664 'unit' => 'px',
665 ],
666 'size_units' => ['px'],
667 ],
668 'text_transform' => [
669 'default' => '',
670 ],
671 'line_height' => [
672 'label' => esc_html__('Line Height (px)', 'shopengine'),
673 'default' => [
674 'size' => '44',
675 'unit' => 'px',
676 ],
677 'size_units' => ['px'],
678 'tablet_default' => [
679 'unit' => 'px',
680 ],
681 'mobile_default' => [
682 'unit' => 'px',
683 ],
684 ],
685 ],
686 ]
687 );
688
689 $this->add_responsive_control(
690 'shopengine_related_product_flash_sale_badge_size',
691 [
692 'label' => esc_html__('Badge Size (px)', 'shopengine'),
693 'type' => Controls_Manager::SLIDER,
694 'size_units' => ['px'],
695 'range' => [
696 'px' => [
697 'min' => 0,
698 'max' => 100,
699 'step' => 1,
700 ],
701 ],
702 'default' => [
703 'unit' => 'px',
704 'size' => 44,
705 ],
706 'selectors' => [
707 '{{WRAPPER}} .shopengine-related .onsale' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};',
708 ],
709 'separator' => 'before',
710 ]
711 );
712
713 $this->add_responsive_control(
714 'shopengine_related_product_flash_sale_badge_border_radius',
715 [
716 'label' => esc_html__('Badge Border Radius (px)', 'shopengine'),
717 'type' => Controls_Manager::SLIDER,
718 'size_units' => ['px'],
719 'range' => [
720 'px' => [
721 'min' => 0,
722 'max' => 100,
723 'step' => 1,
724 ],
725 ],
726 'default' => [
727 'unit' => 'px',
728 'size' => 100,
729 ],
730 'selectors' => [
731 '{{WRAPPER}} .shopengine-related .onsale' => 'border-radius: {{SIZE}}{{UNIT}};',
732 ],
733 ]
734 );
735
736 $this->add_responsive_control(
737 'shopengine_related_product_flash_sale_padding',
738 [
739 'label' => esc_html__('Padding (px)', 'shopengine'),
740 'type' => Controls_Manager::DIMENSIONS,
741 'size_units' => ['px'],
742 'default' => [
743 'top' => '0',
744 'right' => '0',
745 'bottom' => '0',
746 'left' => '0',
747 'unit' => 'px',
748 'isLinked' => true,
749 ],
750 'selectors' => [
751 '{{WRAPPER}} .shopengine-related .onsale' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
752 ],
753 'separator' => 'before',
754 ]
755 );
756
757 $this->add_responsive_control(
758 'shopengine_related_product_flash_sale_position',
759 [
760 'label' => esc_html__('Position', 'shopengine'),
761 'type' => Controls_Manager::CHOOSE,
762 'options' => [
763 'left' => [
764 'title' => esc_html__('Left', 'shopengine'),
765 'icon' => 'eicon-h-align-left',
766 ],
767 'right' => [
768 'title' => esc_html__('Right', 'shopengine'),
769 'icon' => 'eicon-h-align-right',
770 ],
771 ],
772 'default' => 'left',
773 'separator' => 'before'
774 ]
775 );
776
777 $this->add_responsive_control(
778 'shopengine_related_product_flash_sale_position_horizontal',
779 [
780 'label' => esc_html__('Horizontal', 'shopengine'),
781 'type' => Controls_Manager::SLIDER,
782 'size_units' => ['px', '%'],
783 'range' => [
784 'px' => [
785 'min' => -100,
786 'max' => 100,
787 'step' => 5,
788 ],
789 '%' => [
790 'min' => 0,
791 'max' => 100,
792 ],
793 ],
794 'default' => [
795 'unit' => 'px',
796 'size' => 20,
797 ],
798 'selectors' => [
799 '{{WRAPPER}} .shopengine-related .related .onsale' => '{{shopengine_related_product_flash_sale_position.VALUE}}: {{SIZE}}{{UNIT}};',
800 ],
801 ]
802 );
803
804 $this->add_responsive_control(
805 'shopengine_related_product_flash_sale_position_vertical',
806 [
807 'label' => esc_html__('Vertical', 'shopengine'),
808 'type' => Controls_Manager::SLIDER,
809 'size_units' => ['px', '%'],
810 'range' => [
811 'px' => [
812 'min' => -100,
813 'max' => 100,
814 'step' => 5,
815 ],
816 '%' => [
817 'min' => 0,
818 'max' => 100,
819 ],
820 ],
821 'default' => [
822 'unit' => 'px',
823 'size' => 20,
824 ],
825 'selectors' => [
826 '{{WRAPPER}} .shopengine-related .related .onsale' => 'top: {{SIZE}}{{UNIT}};',
827 ],
828 ]
829 );
830
831 $this->end_controls_section();
832
833 /*
834 * Style Tab - Products Image
835 */
836 $this->start_controls_section(
837 'shopengine_related_product_image_section',
838 [
839 'label' => esc_html__('Image', 'shopengine'),
840 'tab' => Controls_Manager::TAB_STYLE,
841 ]
842 );
843
844 $this->add_control(
845 'shopengine_related_product_image_bg_color',
846 [
847 'label' => esc_html__('Background Color', 'shopengine'),
848 'type' => Controls_Manager::COLOR,
849 'alpha' => false,
850 'selectors' => [
851 '{{WRAPPER}} .shopengine-related .related .product img' => 'background-color: {{VALUE}};',
852 ],
853 ]
854 );
855
856 $this->add_responsive_control(
857 'shopengine_related_product_image_height',
858 [
859 'label' => esc_html__('Height (px)', 'shopengine'),
860 'description' => esc_html__('Leave empty for auto height', 'shopengine'),
861 'type' => Controls_Manager::SLIDER,
862 'size_units' => ['px'],
863 'range' => [
864 'px' => [
865 'min' => 0,
866 'max' => 500,
867 'step' => 5,
868 ],
869 ],
870 'default' => [
871 'size' => '',
872 ],
873 'selectors' => [
874 '{{WRAPPER}} .shopengine-related .related .product img' => 'height: {{SIZE}}{{UNIT}} !important;',
875 ],
876 ]
877 );
878
879 $this->add_responsive_control(
880 'shopengine_related_product_image_padding',
881 [
882 'label' => esc_html__('Padding (px)', 'shopengine'),
883 'type' => Controls_Manager::DIMENSIONS,
884 'size_units' => ['px'],
885 'default' => [
886 'top' => '0',
887 'right' => '0',
888 'bottom' => '8',
889 'left' => '0',
890 'isLinked' => false,
891 ],
892 'selectors' => [
893 '{{WRAPPER}} .shopengine-related .related .product img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
894 ],
895 'separator' => 'before',
896 ]
897 );
898
899 $this->end_controls_section();
900
901 /*
902 * Style Tab - Products Title
903 */
904 $this->start_controls_section(
905 'shopengine_related_product_title_section',
906 [
907 'label' => esc_html__('Title', 'shopengine'),
908 'tab' => Controls_Manager::TAB_STYLE,
909 ]
910 );
911
912 $this->add_control(
913 'shopengine_related_product_title_color',
914 [
915 'label' => esc_html__('Color', 'shopengine'),
916 'type' => Controls_Manager::COLOR,
917 'default' => '#101010',
918 'alpha' => false,
919 'selectors' => [
920 '{{WRAPPER}} .shopengine-related .woocommerce-loop-product__title' => 'color: {{VALUE}};',
921 ],
922 ]
923 );
924
925 $this->add_group_control(
926 Group_Control_Typography::get_type(),
927 [
928 'name' => 'shopengine_related_product_title_typography',
929 'label' => esc_html__('Typography', 'shopengine'),
930 'selector' => '{{WRAPPER}} .shopengine-related .woocommerce-loop-product__title',
931 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style'],
932 'fields_options' => [
933 'typography' => [
934 'default' => 'custom',
935 ],
936 'font_weight' => [
937 'default' => '500',
938 ],
939 'font_size' => [
940 'label' => esc_html__('Font Size (px)', 'shopengine'),
941 'default' => [
942 'size' => '15',
943 'unit' => 'px',
944 ],
945 'size_units' => ['px'],
946 ],
947 'text_transform' => [
948 'default' => 'none',
949 ],
950 'line_height' => [
951 'label' => esc_html__('Line Height (px)', 'shopengine'),
952 'default' => [
953 'size' => '20',
954 'unit' => 'px',
955 ],
956 'size_units' => ['px'],
957 'tablet_default' => [
958 'unit' => 'px',
959 ],
960 'mobile_default' => [
961 'unit' => 'px',
962 ],
963 ],
964 ],
965 ]
966 );
967
968 $this->add_responsive_control(
969 'shopengine_related_product_title_padding',
970 [
971 'label' => esc_html__('Padding (px)', 'shopengine'),
972 'type' => Controls_Manager::DIMENSIONS,
973 'size_units' => ['px'],
974 'default' => [
975 'top' => '0',
976 'right' => '0',
977 'bottom' => '8',
978 'left' => '0',
979 'isLinked' => false,
980 ],
981 'selectors' => [
982 '{{WRAPPER}} .shopengine-related .woocommerce-loop-product__title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
983 ],
984 'separator' => 'before',
985 ]
986 );
987
988 $this->end_controls_section();
989
990 /*
991 * Style Tab - Products Rating
992 */
993 $this->start_controls_section(
994 'shopengine_related_product_rating_section',
995 [
996 'label' => esc_html__('Rating', 'shopengine'),
997 'tab' => Controls_Manager::TAB_STYLE,
998 ]
999 );
1000
1001 $this->add_control(
1002 'shopengine_related_product_rating_start_color',
1003 [
1004 'label' => esc_html__('Color', 'shopengine'),
1005 'type' => Controls_Manager::COLOR,
1006 'default' => '#fec42d',
1007 'alpha' => false,
1008 'selectors' => [
1009 '{{WRAPPER}} .shopengine-related .products .star-rating' => 'color: {{VALUE}};',
1010 '{{WRAPPER}} .shopengine-related .products .star-rating::before' => 'color: {{VALUE}};',
1011 ],
1012 ]
1013 );
1014
1015 $this->add_responsive_control(
1016 'shopengine_related_product_rating_start_size',
1017 [
1018 'label' => esc_html__('Star Size (px)', 'shopengine'),
1019 'type' => Controls_Manager::SLIDER,
1020 'size_units' => ['px'],
1021 'range' => [
1022 'px' => [
1023 'min' => 0,
1024 'max' => 50,
1025 'step' => 1,
1026 ],
1027 ],
1028 'default' => [
1029 'unit' => 'px',
1030 'size' => 12,
1031 ],
1032 'selectors' => [
1033 '{{WRAPPER}} .shopengine-related .products .star-rating' => 'font-size: {{SIZE}}{{UNIT}};',
1034 ],
1035 ]
1036 );
1037
1038 $this->add_responsive_control(
1039 'shopengine_related_product_rating_start_margin',
1040 [
1041 'label' => esc_html__('Margin (px)', 'shopengine'),
1042 'type' => Controls_Manager::DIMENSIONS,
1043 'size_units' => ['px'],
1044 'default' => [
1045 'top' => '0',
1046 'right' => '0',
1047 'bottom' => '8',
1048 'left' => '0',
1049 'isLinked' => false,
1050 ],
1051 'selectors' => [
1052 '{{WRAPPER}} .shopengine-related .products .star-rating' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1053 ],
1054 'separator' => 'before',
1055 ]
1056 );
1057
1058 $this->end_controls_section();
1059
1060 /*
1061 * Style Tab - Products Price
1062 */
1063 $this->start_controls_section(
1064 'shopengine_related_product_price_section',
1065 [
1066 'label' => esc_html__('Price', 'shopengine'),
1067 'tab' => Controls_Manager::TAB_STYLE,
1068 ]
1069 );
1070
1071 $this->add_control(
1072 'shopengine_related_product_price_color',
1073 [
1074 'label' => esc_html__('Color', 'shopengine'),
1075 'type' => Controls_Manager::COLOR,
1076 'default' => '#101010',
1077 'alpha' => false,
1078 'selectors' => [
1079 '{{WRAPPER}} .shopengine-related :is(.price, .price span, .price .amount)' => 'color: {{VALUE}};',
1080 ],
1081 ]
1082 );
1083
1084 $this->add_control(
1085 'shopengine_related_product_sale_price_color',
1086 [
1087 'label' => esc_html__('Sale Price Color', 'shopengine'),
1088 'type' => Controls_Manager::COLOR,
1089 'default' => '#101010',
1090 'alpha' => false,
1091 'selectors' => [
1092 '{{WRAPPER}} .shopengine-related .price :is(del span, del .amount)' => 'color: {{VALUE}};',
1093 ],
1094 'condition' => [
1095 'shopengine_related_product_show_sale_price' => 'yes',
1096 ],
1097 ]
1098 );
1099
1100 $this->add_group_control(
1101 Group_Control_Typography::get_type(),
1102 [
1103 'name' => 'shopengine_related_product_price_typography',
1104 'selector' => '{{WRAPPER}} .shopengine-related :is(.price, .price .amount, .price ins, .price del)',
1105 'exclude' => ['text_transform', 'text_decoration', 'font_style', 'letter_spacing'],
1106 'fields_options' => [
1107 'typography' => [
1108 'default' => 'custom',
1109 ],
1110 'font_weight' => [
1111 'default' => '700',
1112 ],
1113 'font_size' => [
1114 'label' => esc_html__('Font Size (px)', 'shopengine'),
1115 'size_units' => ['px'],
1116 'default' => [
1117 'size' => '18',
1118 'unit' => 'px'
1119 ]
1120 ],
1121 'line_height' => [
1122 'label' => esc_html__('Line Height (px)', 'shopengine'),
1123 'default' => [
1124 'size' => '24',
1125 'unit' => 'px',
1126 ],
1127 'size_units' => ['px'],
1128 'tablet_default' => [
1129 'unit' => 'px',
1130 ],
1131 'mobile_default' => [
1132 'unit' => 'px',
1133 ],
1134 ],
1135 ],
1136 ]
1137 );
1138
1139 $this->add_responsive_control(
1140 'shopengine_related_product_price_padding',
1141 [
1142 'label' => esc_html__('Padding (px)', 'shopengine'),
1143 'type' => Controls_Manager::DIMENSIONS,
1144 'size_units' => ['px'],
1145 'default' => [
1146 'top' => '0',
1147 'right' => '0',
1148 'bottom' => '8',
1149 'left' => '0',
1150 'isLinked' => false,
1151 ],
1152 'selectors' => [
1153 '{{WRAPPER}} .shopengine-related .price' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1154 ],
1155 'separator' => 'before',
1156 ]
1157 );
1158
1159 $this->end_controls_section();
1160
1161 /*
1162 * Style Tab - Products Rating
1163 */
1164 $this->start_controls_section(
1165 'shopengine_related_product_add_cart_btn_section',
1166 [
1167 'label' => esc_html__('Add To Cart', 'shopengine'),
1168 'tab' => Controls_Manager::TAB_STYLE,
1169 'condition' => [
1170 'shopengine_related_product_show_cart_btn' => 'yes',
1171 ],
1172 ]
1173 );
1174
1175 $this->add_group_control(
1176 Group_Control_Typography::get_type(),
1177 [
1178 'name' => 'shopengine_related_product_add_cart_typography',
1179 'label' => esc_html__('Typography', 'shopengine'),
1180 'selector' => '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart)',
1181 'exclude' => ['font_family', 'letter_spacing', 'text_decoration', 'font_style'],
1182 'fields_options' => [
1183 'typography' => [
1184 'default' => 'custom',
1185 ],
1186 'font_weight' => [
1187 'default' => '500',
1188 ],
1189 'font_size' => [
1190 'default' => [
1191 'size' => '13',
1192 'unit' => 'px',
1193 ],
1194 'size_units' => ['px'],
1195 ],
1196 'text_transform' => [
1197 'default' => 'uppercase',
1198 ],
1199 'line_height' => [
1200 'label' => esc_html__('Line Height (px)', 'shopengine'),
1201 'default' => [
1202 'size' => '18',
1203 'unit' => 'px',
1204 ],
1205 'size_units' => ['px'],
1206 'tablet_default' => [
1207 'unit' => 'px',
1208 ],
1209 'mobile_default' => [
1210 'unit' => 'px',
1211 ],
1212 ],
1213 ],
1214 'separator' => 'before',
1215 ]
1216 );
1217
1218 $this->start_controls_tabs(
1219 'shopengine_related_product_add_cart_btn_style_tabs',
1220 [
1221 'separator' => 'before',
1222 ]
1223 );
1224
1225 $this->start_controls_tab(
1226 'shopengine_related_product_add_cart_btn_tab_normal',
1227 [
1228 'label' => esc_html__('Normal', 'shopengine'),
1229 ]
1230 );
1231
1232 $this->add_control(
1233 'shopengine_related_product_add_cart_btn_color',
1234 [
1235 'label' => esc_html__('Text Color', 'shopengine'),
1236 'type' => Controls_Manager::COLOR,
1237 'default' => '#FFFFFF',
1238 'alpha' => false,
1239 'selectors' => [
1240 '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart)' => 'color: {{VALUE}};',
1241 ],
1242 ]
1243 );
1244
1245 $this->add_control(
1246 'shopengine_related_product_add_cart_btn_bg_color',
1247 [
1248 'label' => esc_html__('Background Color', 'shopengine'),
1249 'type' => Controls_Manager::COLOR,
1250 'default' => '#3E3E3E',
1251 'alpha' => false,
1252 'selectors' => [
1253 '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart)' => 'background-color: {{VALUE}};',
1254 ],
1255 ]
1256 );
1257
1258 $this->end_controls_tab();
1259
1260 $this->start_controls_tab(
1261 'shopengine_related_product_add_cart_btn_tab_hover',
1262 [
1263 'label' => esc_html__('Hover', 'shopengine'),
1264 ]
1265 );
1266
1267 $this->add_control(
1268 'shopengine_related_product_add_cart_btn_hover_color',
1269 [
1270 'label' => esc_html__('Text Color', 'shopengine'),
1271 'type' => Controls_Manager::COLOR,
1272 'default' => '#FFFFFF',
1273 'alpha' => false,
1274 'selectors' => [
1275 '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart):hover' => 'color: {{VALUE}};',
1276 ],
1277 ]
1278 );
1279
1280 $this->add_control(
1281 'shopengine_related_product_add_cart_btn_hover_bg_color',
1282 [
1283 'label' => esc_html__('Background Color', 'shopengine'),
1284 'type' => Controls_Manager::COLOR,
1285 'default' => '#332d2d',
1286 'alpha' => false,
1287 'selectors' => [
1288 '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart):hover' => 'background-color: {{VALUE}};',
1289 ],
1290 ]
1291 );
1292
1293 $this->add_control(
1294 'shopengine_related_product_add_cart_btn_hover_border_color',
1295 [
1296 'label' => esc_html__('Border Color', 'shopengine'),
1297 'type' => Controls_Manager::COLOR,
1298 'selectors' => [
1299 '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart):hover' => 'border-color: {{VALUE}};',
1300 ],
1301 ]
1302 );
1303
1304 $this->end_controls_tab();
1305 $this->end_controls_tabs();
1306
1307 $this->add_responsive_control(
1308 'shopengine_related_product_add_cart_btn_padding',
1309 [
1310 'label' => esc_html__('Padding (px)', 'shopengine'),
1311 'type' => Controls_Manager::DIMENSIONS,
1312 'size_units' => ['px'],
1313 'default' => [
1314 'top' => '8',
1315 'right' => '15',
1316 'bottom' => '8',
1317 'left' => '15',
1318 'unit' => 'px',
1319 'isLinked' => false,
1320 ],
1321 'selectors' => [
1322 '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart)' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1323 ],
1324 'separator' => 'before',
1325 ]
1326 );
1327
1328 $this->add_group_control(
1329 Group_Control_Border::get_type(),
1330 [
1331 'name' => 'shopengine_related_product_add_cart_border',
1332 'label' => esc_html__('Border', 'shopengine'),
1333 'selector' => '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart)',
1334 'separator' => 'before',
1335 ]
1336 );
1337
1338 $this->add_control(
1339 'shopengine_related_product_add_cart_border_radius',
1340 [
1341 'label' => esc_html__('Border Radius (px)', 'shopengine'),
1342 'type' => Controls_Manager::DIMENSIONS,
1343 'size_units' => ['px'],
1344 'default' => [
1345 'top' => '0',
1346 'right' => '0',
1347 'bottom' => '0',
1348 'left' => '0',
1349 'unit' => 'px',
1350 'isLinked' => true,
1351 ],
1352 'selectors' => [
1353 '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1354 ],
1355 ]
1356 );
1357
1358 $this->add_responsive_control(
1359 'shopengine_related_product_add_cart_btn_margin',
1360 [
1361 'label' => esc_html__('Margin (px)', 'shopengine'),
1362 'type' => Controls_Manager::DIMENSIONS,
1363 'size_units' => ['px'],
1364 'default' => [
1365 'top' => '0',
1366 'right' => '0',
1367 'bottom' => '0',
1368 'left' => '0',
1369 'isLinked' => false,
1370 ],
1371 'selectors' => [
1372 '{{WRAPPER}} .shopengine-related .related :is(.button, .added_to_cart)' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1373 ],
1374 'separator' => 'before',
1375 ]
1376 );
1377
1378 $this->end_controls_section();
1379
1380 /*
1381 * Style Tab - Slider
1382 */
1383 $this->start_controls_section(
1384 'shopengine_related_product_slider_style_section',
1385 [
1386 'label' => esc_html__('Slider Style', 'shopengine'),
1387 'tab' => Controls_Manager::TAB_STYLE,
1388 'conditions' => [
1389 'relation' => 'and',
1390 'terms' => [
1391 [
1392 'name' => 'shopengine_related_product_enable_slider',
1393 'operator' => '===',
1394 'value' => 'yes'
1395 ],
1396 [
1397 'relation' => 'or',
1398 'terms' => [
1399 [
1400 'name' => 'shopengine_related_product_slider_show_arrows',
1401 'operator' => '===',
1402 'value' => 'yes'
1403 ],
1404 [
1405 'name' => 'shopengine_related_product_slider_show_dots',
1406 'operator' => '===',
1407 'value' => 'yes'
1408 ]
1409 ]
1410 ]
1411 ]
1412 ]
1413 ]
1414 );
1415
1416 $this->add_control(
1417 'shopengine_related_product_slider_arrows_style',
1418 [
1419 'label' => esc_html__( 'Arrows', 'shopengine' ),
1420 'type' => Controls_Manager::HEADING,
1421 'condition' => [
1422 'shopengine_related_product_slider_show_arrows' => 'yes',
1423 ],
1424 ]
1425 );
1426
1427 $this->add_control(
1428 'shopengine_related_product_slider_arrow_icon_size',
1429 [
1430 'label' => esc_html__('Icon Size (px)', 'shopengine'),
1431 'type' => Controls_Manager::SLIDER,
1432 'size_units' => ['px'],
1433 'range' => [
1434 'px' => [
1435 'min' => 0,
1436 'max' => 100,
1437 'step' => 5,
1438 ],
1439 ],
1440 'default' => [
1441 'unit' => 'px',
1442 'size' => 25,
1443 ],
1444 'selectors' => [
1445 '{{WRAPPER}} .shopengine-related :is(.swiper-button-prev, .swiper-button-next)' => 'font-size: {{SIZE}}{{UNIT}};',
1446 ],
1447 'condition' => [
1448 'shopengine_related_product_slider_show_arrows' => 'yes',
1449 ],
1450 ]
1451 );
1452
1453 $this->start_controls_tabs(
1454 'shopengine_related_product_slider_arrows_tabs',
1455 [
1456 'condition' => [
1457 'shopengine_related_product_slider_show_arrows' => 'yes',
1458 ],
1459 ]
1460 );
1461
1462 $this->start_controls_tab(
1463 'shopengine_related_product_slider_arrows_tab_normal',
1464 [
1465 'label' => esc_html__('Normal', 'shopengine'),
1466 ]
1467 );
1468
1469 $this->add_control(
1470 'shopengine_related_product_slider_arrows_color',
1471 [
1472 'label' => esc_html__('Color', 'shopengine'),
1473 'type' => Controls_Manager::COLOR,
1474 'default' => '#FFFFFF',
1475 'alpha' => false,
1476 'selectors' => [
1477 '{{WRAPPER}} .shopengine-related :is(.swiper-button-prev, .swiper-button-next)' => 'color: {{VALUE}};',
1478 ],
1479 ]
1480 );
1481
1482 $this->add_control(
1483 'shopengine_related_product_slider_arrows_bg_color',
1484 [
1485 'label' => esc_html__('Background Color', 'shopengine'),
1486 'type' => Controls_Manager::COLOR,
1487 'default' => '#3E3E3E',
1488 'selectors' => [
1489 '{{WRAPPER}} .shopengine-related :is(.swiper-button-prev, .swiper-button-next)' => 'background-color: {{VALUE}};',
1490 ],
1491 ]
1492 );
1493
1494 $this->end_controls_tab();
1495
1496 $this->start_controls_tab(
1497 'shopengine_related_product_slider_arrows_tab_hover',
1498 [
1499 'label' => esc_html__('Hover', 'shopengine'),
1500 ]
1501 );
1502
1503 $this->add_control(
1504 'shopengine_related_product_slider_arrows_hover_color',
1505 [
1506 'label' => esc_html__('Color', 'shopengine'),
1507 'type' => Controls_Manager::COLOR,
1508 'default' => '#FFFFFF',
1509 'alpha' => false,
1510 'selectors' => [
1511 '{{WRAPPER}} .shopengine-related :is(.swiper-button-prev, .swiper-button-next):hover' => 'color: {{VALUE}};',
1512 ],
1513 ]
1514 );
1515
1516 $this->add_control(
1517 'shopengine_related_product_slider_arrows_hover_bg_color',
1518 [
1519 'label' => esc_html__('Background Color', 'shopengine'),
1520 'type' => Controls_Manager::COLOR,
1521 'default' => '#332d2d',
1522 'selectors' => [
1523 '{{WRAPPER}} .shopengine-related :is(.swiper-button-prev, .swiper-button-next):hover' => 'background-color: {{VALUE}};',
1524 ],
1525 ]
1526 );
1527
1528 $this->add_control(
1529 'shopengine_related_product_slider_arrows_hover_border_color',
1530 [
1531 'label' => esc_html__('Border Color', 'shopengine'),
1532 'type' => Controls_Manager::COLOR,
1533 'selectors' => [
1534 '{{WRAPPER}} .shopengine-related :is(.swiper-button-prev, .swiper-button-next):hover' => 'border-color: {{VALUE}};',
1535 ],
1536 ]
1537 );
1538
1539 $this->end_controls_tab();
1540 $this->end_controls_tabs();
1541
1542 $this->add_group_control(
1543 Group_Control_Border::get_type(),
1544 [
1545 'name' => 'shopengine_related_product_slider_arrows_border',
1546 'label' => esc_html__('Border', 'shopengine'),
1547 'selector' => '{{WRAPPER}} .shopengine-related :is(.swiper-button-prev, .swiper-button-next)',
1548 'condition' => [
1549 'shopengine_related_product_slider_show_arrows' => 'yes',
1550 ],
1551 'separator' => 'before',
1552 ]
1553 );
1554
1555 $this->add_control(
1556 'shopengine_related_product_slider_arrows_border_radius',
1557 [
1558 'label' => esc_html__('Border Radius (px)', 'shopengine'),
1559 'type' => Controls_Manager::DIMENSIONS,
1560 'size_units' => ['px'],
1561 'default' => [
1562 'top' => '0',
1563 'right' => '0',
1564 'bottom' => '0',
1565 'left' => '0',
1566 'unit' => 'px',
1567 'isLinked' => true,
1568 ],
1569 'selectors' => [
1570 '{{WRAPPER}} .shopengine-related :is(.swiper-button-prev, .swiper-button-next)' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1571 ],
1572 'condition' => [
1573 'shopengine_related_product_slider_show_arrows' => 'yes',
1574 ],
1575 ]
1576 );
1577
1578 $this->add_control(
1579 'shopengine_related_product_slider_style_divider',
1580 [
1581 'type' => Controls_Manager::DIVIDER,
1582 'conditions' => [
1583 'relation' => 'and',
1584 'terms' => [
1585 [
1586 'name' => 'shopengine_related_product_slider_show_arrows',
1587 'operator' => '===',
1588 'value' => 'yes'
1589 ],
1590 [
1591 'name' => 'shopengine_related_product_slider_show_dots',
1592 'operator' => '===',
1593 'value' => 'yes'
1594 ]
1595 ]
1596 ]
1597 ]
1598 );
1599
1600 $this->add_control(
1601 'shopengine_related_product_slider_dots_style',
1602 [
1603 'label' => esc_html__( 'Dots', 'shopengine' ),
1604 'type' => Controls_Manager::HEADING,
1605 'condition' => [
1606 'shopengine_related_product_slider_show_dots' => 'yes',
1607 ],
1608 ]
1609 );
1610
1611 $this->add_control(
1612 'shopengine_related_product_slider_dots_color',
1613 [
1614 'label' => esc_html__('Color', 'shopengine'),
1615 'type' => Controls_Manager::COLOR,
1616 'default' => '#c9c9c9',
1617 'alpha' => false,
1618 'selectors' => [
1619 '{{WRAPPER}} .shopengine-related .swiper-pagination-bullet' => 'background: {{VALUE}};',
1620 ],
1621 'condition' => [
1622 'shopengine_related_product_slider_show_dots' => 'yes',
1623 ],
1624 ]
1625 );
1626
1627 $this->add_control(
1628 'shopengine_related_product_slider_active_dots_color',
1629 [
1630 'label' => esc_html__('Active Color', 'shopengine'),
1631 'type' => Controls_Manager::COLOR,
1632 'default' => '#f03d3f',
1633 'alpha' => false,
1634 'selectors' => [
1635 '{{WRAPPER}} .shopengine-related .swiper-pagination-bullet-active' => 'border-color: {{VALUE}};',
1636 ],
1637 'condition' => [
1638 '$shopengine_related_product_slider_show_dots' => 'yes',
1639 ],
1640 ]
1641 );
1642
1643 $this->add_responsive_control(
1644 'shopengine_related_product_slider_dot_wrap_margin',
1645 [
1646 'label' => esc_html__('Wrap Margin (px)', 'shopengine'),
1647 'type' => Controls_Manager::DIMENSIONS,
1648 'size_units' => ['px'],
1649 'default' => [
1650 'top' => '20',
1651 'right' => '0',
1652 'bottom' => '0',
1653 'left' => '0',
1654 'isLinked' => false,
1655 ],
1656 'selectors' => [
1657 '{{WRAPPER}} .shopengine-related .swiper-pagination' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1658 ],
1659 'condition' => [
1660 '$shopengine_related_product_slider_show_dots' => 'yes',
1661 ],
1662 'separator' => 'before',
1663 ]
1664 );
1665
1666 $this->end_controls_section();
1667
1668 /*
1669 * Style Tab - Global Font
1670 */
1671 $this->start_controls_section(
1672 'shopengine_related_product_global_font_section',
1673 [
1674 'label' => esc_html__('Global Font', 'shopengine'),
1675 'tab' => Controls_Manager::TAB_STYLE,
1676 ]
1677 );
1678
1679 $this->add_control(
1680 'shopengine_related_product_global_font_family',
1681 [
1682 'label' => esc_html__('Font Family', 'shopengine'),
1683 'description' => esc_html__('This font family is set for this specific widget.', 'shopengine'),
1684 'type' => Controls_Manager::FONT,
1685 'selectors' => [
1686 '{{WRAPPER}} .shopengine-related .related :is(.onsale, .woocommerce-loop-product__title, .price, del, ins, .button)' => 'font-family: {{VALUE}};',
1687 ],
1688 ]
1689 );
1690
1691 $this->end_controls_section();
1692 }
1693
1694 public function get_icon_html($icon) {
1695
1696 if($icon) {
1697 ob_start();
1698 \Elementor\Icons_Manager::render_icon($icon, ['aria-hidden' => 'true']);
1699 $icon = ob_get_clean();
1700 } else {
1701 $icon = '';
1702 }
1703
1704 return $icon;
1705 }
1706
1707 protected function screen() {
1708
1709 $settings = $this->get_settings_for_display();
1710
1711 echo \ShopEngine\Utils\Helper::render($this->render_view($settings));
1712 }
1713
1714 protected function render_view($settings = []) {
1715
1716 extract($settings);
1717
1718 $post_type = get_post_type();
1719
1720 $product = Products::instance()->get_product($post_type);
1721
1722 if(empty($product)) {
1723 return;
1724 }
1725
1726 $is_slider_enable = ($shopengine_related_product_enable_slider == "yes") ? true : false;
1727
1728 $args = [
1729 'posts_per_page' => $shopengine_related_product_to_show,
1730 'columns' => $is_slider_enable ? $shopengine_related_product_slider_perview : $shopengine_related_product_columns,
1731 'orderby' => $shopengine_related_product_orderby,
1732 'order' => $shopengine_related_product_order,
1733 ];
1734
1735
1736 if(\Elementor\Plugin::$instance->editor->is_edit_mode() || is_preview()) {
1737
1738 $argument = array(
1739 'type' => ['simple'],
1740 'limit' => $shopengine_related_product_to_show,
1741 );
1742
1743 $parent_product_array = wc_get_products($argument);
1744
1745 foreach($parent_product_array as $prod) {
1746
1747 $crosssell_products[] = $prod->get_id();
1748 }
1749
1750 add_filter('woocommerce_related_products', function ($prod_ids) use ($crosssell_products) {
1751
1752 return $prod_ids;
1753 });
1754 }
1755
1756 $args['related_products'] = array_filter(array_map('wc_get_product', wc_get_related_products($product->get_id(), $args['posts_per_page'], $product->get_upsell_ids())), 'wc_products_array_filter_visible');
1757
1758 // Handle orderby.
1759 $args['related_products'] = wc_products_array_orderby($args['related_products'], $args['orderby'], $args['order']);
1760
1761 // slider controls for the template file
1762 $slider_options = [
1763 'slider_enabled' => true,
1764 'slides_to_show' => $shopengine_related_product_slider_perview,
1765 'slider_loop' => ($shopengine_related_product_slider_loop === "yes") ? true : false,
1766 'slider_autoplay' => ($shopengine_related_product_slider_autoplay === "yes") ? true : false,
1767 'slider_autoplay_delay' => $shopengine_related_product_slider_autoplay_delay,
1768 'slider_space_between' => $shopengine_related_product_column_gap['size'],
1769 ];
1770
1771 //passing slider controls to the template file
1772 $encode_slider_options = \json_encode($slider_options);
1773
1774 $tpl = Products::instance()->get_widget_template($this->get_name());
1775
1776 include $tpl;
1777 }
1778 }
1779