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