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 / product-image / product-image.php
shopengine / widgets / product-image Last commit date
screens 3 years ago product-image-config.php 3 years ago product-image.php 3 years ago
product-image.php
909 lines
1 <?php
2
3 namespace Elementor;
4
5 use ShopEngine\Widgets\Products;
6
7 defined('ABSPATH') || exit;
8
9 class ShopEngine_Product_Image extends \ShopEngine\Base\Widget {
10
11 public function config() {
12 return new ShopEngine_Product_Image_Config();
13 }
14
15 public function get_script_depends() {
16 return ['wc-single-product'];
17 }
18
19 protected function register_controls() {
20
21 /*
22 --------------------------
23 settings content tab
24 --------------------------
25 */
26
27 $this->start_controls_section(
28 'shopengine_widget_settings',
29 [
30 'label' => esc_html__('Settings', 'shopengine'),
31 'tab' => Controls_Manager::TAB_CONTENT,
32 ]
33 );
34
35 $this->add_control(
36 'shopengine_image_gallery_heading',
37 [
38 'label' => esc_html__('Product Gallery', 'shopengine'),
39 'type' => Controls_Manager::HEADING,
40 'separator' => 'before',
41 ]
42 );
43
44
45 if(\ShopEngine::package_type() == 'free'){
46 $this->add_control(
47 'shopengine_image_gallery_info',
48 [
49 'type' => Controls_Manager::RAW_HTML,
50 'raw' => esc_html__('In the ShopEngine pro version, the thumbnail gallery will be slider automatically and you can move it to the left and right side of the feature image too.', 'shopengine'),
51 'content_classes' => 'elementor-panel-alert elementor-panel-alert-danger',
52 ]
53 );
54 }
55
56 $position_opts = [
57 'bottom' => __( 'Bottom', 'shopengine' )
58 ];
59
60 if(\ShopEngine::package_type() == 'pro'){
61 $position_opts['left'] = __( 'Left', 'shopengine' );
62 $position_opts['right'] = __( 'Right', 'shopengine' );
63 }
64
65 $this->add_control(
66 'shopengine_image_gallery_position',
67 [
68 'label' => __( 'Position', 'shopengine' ),
69 'type' => Controls_Manager::SELECT,
70 'default' => 'bottom',
71 'options' => $position_opts,
72 'prefix_class' => 'shopengine_image_gallery_position_',
73 ]
74 );
75
76 $this->add_control(
77 'shopengine_image_lightbox_icon_heading',
78 [
79 'label' => esc_html__('Product Lightbox', 'shopengine'),
80 'type' => Controls_Manager::HEADING,
81 'separator' => 'before',
82 ]
83 );
84
85 $this->add_control(
86 'shopengine_image_lightbox_icon',
87 [
88 'label' => esc_html__('Icon', 'shopengine'),
89 'type' => Controls_Manager::ICONS,
90 'fa4compatibility' => 'icon',
91 'default' => [
92 'value' => 'fas fa-expand-alt',
93 'library' => 'fa-solid',
94 ],
95 ]
96 );
97
98 $this->add_control(
99 'shopengine_sale_flash_status_heading',
100 [
101 'label' => esc_html__('Flash Sale Badge', 'shopengine'),
102 'type' => Controls_Manager::HEADING,
103 'separator' => 'before',
104 ]
105 );
106
107 $this->add_control(
108 'shopengine_sale_flash_status',
109 [
110 'label' => esc_html__('Show Badge?', 'shopengine'),
111 'type' => Controls_Manager::SWITCHER,
112 'label_on' => esc_html__('Show', 'shopengine'),
113 'label_off' => esc_html__('Hide', 'shopengine'),
114 'render_type' => 'template',
115 'return_value' => 'yes',
116 'default' => 'yes',
117 ]
118 );
119
120 $this->end_controls_section(); // end ./settings content tab
121
122 /*
123 --------------------------
124 product image style
125 --------------------------
126 */
127
128 $this->start_controls_section(
129 'shopengine_image_style',
130 [
131 'label' => esc_html__('Image', 'shopengine'),
132 'tab' => Controls_Manager::TAB_STYLE,
133 ]
134 );
135
136 $this->add_control(
137 'shopengine_image_bgc',
138 [
139 'label' => esc_html__( 'Background Color', 'shopengine' ),
140 'type' => Controls_Manager::COLOR,
141 'selectors' => [
142 '{{WRAPPER}} img, .pswp__img' => 'background-color: {{VALUE}};',
143 ],
144 ]
145 );
146
147 $this->add_control(
148 'shopengine_image_border_radius',
149 [
150 'label' => esc_html__('Border Radius', 'shopengine'),
151 'type' => Controls_Manager::SLIDER,
152 'size_units' => ['px', '%'],
153 'range' => [
154 'px' => [
155 'min' => 0,
156 'max' => 100,
157 'step' => 1,
158 ],
159 '%' => [
160 'min' => 0,
161 'max' => 100,
162 'step' => 1,
163 ],
164 ],
165 'selectors' => [
166 '{{WRAPPER}} .shopengine-product-image .woocommerce-product-gallery__image img' => 'border-radius: {{SIZE}}{{UNIT}};',
167 ],
168 ]
169 );
170
171 $this->add_control(
172 'shopengine_heading_gallery_thumbs_style',
173 [
174 'label' => esc_html__('Gallery Thumbnails', 'shopengine'),
175 'type' => Controls_Manager::HEADING,
176 'separator' => 'before',
177 ]
178 );
179
180 $this->add_responsive_control(
181 'shopengine_gallery_thumbs_width',
182 [
183 'label' => esc_html__('Width', 'shopengine'),
184 'type' => Controls_Manager::SLIDER,
185 'size_units' => ['px', '%'],
186 'range' => [
187 'px' => [
188 'min' => 0,
189 'max' => 1000,
190 'step' => 5,
191 ],
192 '%' => [
193 'min' => 0,
194 'max' => 100,
195 ],
196 ],
197 'devices' => [ 'desktop', 'tablet', 'mobile' ],
198 'desktop_default' => [
199 'size' => 20,
200 'unit' => '%',
201 ],
202 'tablet_default' => [
203 'size' => 25,
204 'unit' => '%',
205 ],
206 'mobile_default' => [
207 'size' => 25,
208 'unit' => '%',
209 ],
210 'default' => [
211 'size' => 20,
212 'unit' => '%',
213 ],
214 'selectors' => [
215 '{{WRAPPER}}:not(.shopengine_image_gallery_position_bottom) .shopengine-gallery-wrapper' => 'width: {{SIZE}}{{UNIT}};',
216 '{{WRAPPER}}.shopengine_image_gallery_position_bottom .flex-control-thumbs li' => 'flex: 0 0 {{SIZE}}{{UNIT}};',
217 '{{WRAPPER}}.shopengine_image_gallery_position_left .flex-viewport, {{WRAPPER}}.shopengine_image_gallery_position_right .flex-viewport' => 'width: calc(100% - {{SIZE}}{{UNIT}});',
218 '{{WRAPPER}}.shopengine_image_gallery_position_left .shopengine-product-image .onsale, {{WRAPPER}}.shopengine_image_gallery_position_left .shopengine-product-image-toggle' => 'margin-left: {{SIZE}}{{UNIT}}',
219 '{{WRAPPER}}.shopengine_image_gallery_position_right .shopengine-product-image .onsale, {{WRAPPER}}.shopengine_image_gallery_position_right .shopengine-product-image-toggle' => 'margin-right: {{SIZE}}{{UNIT}}',
220 ],
221 ]
222 );
223
224 $this->add_group_control(
225 Group_Control_Border::get_type(),
226 [
227 'name' => 'shopengine_thumbs_border',
228 'selector' => '.shopengine-widget .shopengine-product-image .images.woocommerce-product-gallery .flex-control-thumbs li img',
229 'fields_options' => [
230 'color' => [
231 'label' => esc_html__('Border Color', 'shopengine'),
232 'alpha' => false,
233 ],
234
235 ],
236 ]
237 );
238
239 $this->add_control(
240 'shopengine_thumbs_border_radius',
241 [
242 'label' => esc_html__('Border Radius (px)', 'shopengine'),
243 'type' => Controls_Manager::SLIDER,
244 'size_units' => ['px', '%'],
245 'range' => [
246 'px' => [
247 'min' => 0,
248 'max' => 100,
249 'step' => 1,
250 ],
251 '%' => [
252 'min' => 0,
253 'max' => 100,
254 'step' => 1,
255 ],
256 ],
257 'selectors' => [
258 '{{WRAPPER}} .shopengine-widget .shopengine-product-image .images.woocommerce-product-gallery .flex-control-thumbs li img' => 'border-radius: {{SIZE}}{{UNIT}}',
259 ],
260 ]
261 );
262
263 $this->add_control(
264 'shopengine_gallery_thumbs_row_gap',
265 [
266 'label' => esc_html__('Row Gap (px)', 'shopengine'),
267 'type' => Controls_Manager::SLIDER,
268 'size_units' => ['px'],
269 'range' => [
270 'px' => [
271 'min' => 0,
272 'max' => 100,
273 'step' => 1,
274 ],
275 ],
276 'default' => [
277 'unit' => 'px',
278 'size' => 5,
279 ],
280 'selectors' => [
281 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs li' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
282 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs' => 'margin-left:-{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
283 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider:not( .owl-loaded )' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
284 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider .owl-stage' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
285 ],
286 ]
287 );
288
289 $column_condition = [];
290
291 if(\ShopEngine::package_type() == 'pro'){
292 $column_condition = [
293 'shopengine_image_gallery_position!' => 'bottom'
294 ];
295 }
296
297 $this->add_control(
298 'shopengine_gallery_thumbs_column_gap',
299 [
300 'label' => esc_html__('Column Gap (px)', 'shopengine'),
301 'type' => Controls_Manager::SLIDER,
302 'size_units' => ['px'],
303 'range' => [
304 'px' => [
305 'min' => 0,
306 'max' => 100,
307 'step' => 1,
308 ],
309 ],
310 'default' => [
311 'unit' => 'px',
312 'size' => 5,
313 ],
314 'selectors' => [
315 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs li' => 'padding-top: {{SIZE}}{{UNIT}};padding-bottom: {{SIZE}}{{UNIT}};',
316 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs' => 'margin-top:-{{SIZE}}{{UNIT}};margin-bottom: -{{SIZE}}{{UNIT}};',
317 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider:not( .owl-loaded )' => 'padding-top: {{SIZE}}{{UNIT}};padding-bottom: {{SIZE}}{{UNIT}};;',
318 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider .owl-stage' => 'padding-top: {{SIZE}}{{UNIT}};padding-bottom: {{SIZE}}{{UNIT}};;',
319 ],
320 'condition' => $column_condition
321 ]
322 );
323
324 $this->add_responsive_control(
325 'shopengine_thumbs_margin',
326 [
327 'label' => esc_html__('Margin Top (px)', 'shopengine'),
328 'type' => Controls_Manager::SLIDER,
329 'default' => [
330 'size' => '5',
331 ],
332 'size_units' => ['px'],
333 'selectors' => [
334 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs' => 'margin-top: {{SIZE}}px;',
335 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider' => 'margin-top: {{SIZE}}px;',
336 ],
337 'separator' => 'before',
338 'condition' => [
339 'shopengine_image_gallery_position' => 'bottom',
340 ]
341 ]
342 );
343
344 $this->end_controls_section(); // end ./ product image style
345
346 /*
347 --------------------------
348 lightbox zoom icon
349 --------------------------
350 */
351
352 $this->start_controls_section(
353 'shopengine_lightbox_icon_style',
354 [
355 'label' => esc_html__('Lightbox Zoom Icon', 'shopengine'),
356 'tab' => Controls_Manager::TAB_STYLE,
357 ]
358 );
359
360 $this->add_control(
361 'shopengine_lightbox_icon_color',
362 [
363 'label' => esc_html__('Icon Color', 'shopengine'),
364 'type' => Controls_Manager::COLOR,
365 'default' => '#101010',
366 'alpha' => false,
367 'selectors' => [
368 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'color: {{VALUE}}',
369 ],
370 ]
371 );
372
373 $this->add_control(
374 'shopengine_lightbox_icon_border_color',
375 [
376 'label' => esc_html__('Icon Border Color', 'shopengine'),
377 'type' => Controls_Manager::COLOR,
378 'default' => '#101010',
379 'alpha' => false,
380 'selectors' => [
381 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'border:1px solid {{VALUE}}; box-shadow:none;-webkit-box-shadow:none;',
382 ],
383 ]
384 );
385
386 $this->add_control(
387 'shopengine_lightbox_icon_background',
388 [
389 'label' => esc_html__('Icon Background Color', 'shopengine'),
390 'type' => Controls_Manager::COLOR,
391 'alpha' => false,
392 'default' => '#ffffff',
393 'selectors' => [
394 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'background-color: {{VALUE}}',
395 ],
396 ]
397 );
398
399 $this->add_control(
400 'shopengine_lightbox_icon_size',
401 [
402 'label' => esc_html__('Size (px)', 'shopengine'),
403 'type' => Controls_Manager::SLIDER,
404 'size_units' => ['px'],
405 'range' => [
406 'px' => [
407 'min' => 0,
408 'max' => 100,
409 'step' => 1,
410 ],
411 ],
412 'default' => [
413 'unit' => 'px',
414 'size' => 16,
415 ],
416 'selectors' => [
417 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'font-size: {{SIZE}}{{UNIT}};',
418 ],
419 ]
420 );
421
422 $this->add_control(
423 'shopengine_lightbox_icon_wrapper_size',
424 [
425 'label' => esc_html__('Wrapper Size (px)', 'shopengine'),
426 'type' => Controls_Manager::SLIDER,
427 'size_units' => ['px'],
428 'range' => [
429 'px' => [
430 'min' => 0,
431 'max' => 100,
432 'step' => 1,
433 ],
434 ],
435 'default' => [
436 'unit' => 'px',
437 'size' => 46,
438 ],
439 'selectors' => [
440 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}',
441 ],
442 ]
443 );
444
445 $this->add_control(
446 'shopengine_lightbox_icon_radius',
447 [
448 'label' => esc_html__('Border Radius (px)', 'shopengine'),
449 'type' => Controls_Manager::SLIDER,
450 'size_units' => ['px'],
451 'range' => [
452 'px' => [
453 'min' => 0,
454 'max' => 100,
455 'step' => 5,
456 ],
457 ],
458 'default' => [
459 'unit' => 'px',
460 'size' => 100,
461 ],
462 'selectors' => [
463 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'border-radius: {{SIZE}}{{UNIT}}',
464 ],
465 ]
466 );
467
468 $this->add_control(
469 'shopengine_lightbox_icon_position',
470 [
471 'label' => esc_html__('Position', 'shopengine'),
472 'type' => Controls_Manager::CHOOSE,
473 'options' => [
474 'top-left' => [
475 'title' => esc_html__('Top Left', 'shopengine'),
476 'icon' => 'eicon-h-align-left',
477 ],
478 'top-right' => [
479 'title' => esc_html__('Top Right', 'shopengine'),
480 'icon' => 'eicon-h-align-right',
481 ],
482 'custom' => [
483 'title' => esc_html__('Custom', 'shopengine'),
484 'icon' => 'eicon-settings',
485 ],
486 ],
487 'default' => 'top-right',
488 'toggle' => false,
489 'separator' => 'before',
490 ]
491 );
492
493 $this->add_control(
494 'shopengine_lightbox_icon_position_x_axis',
495 [
496 'label' => esc_html__('Badge Position (X axis)', 'shopengine'),
497 'type' => Controls_Manager::SLIDER,
498 'size_units' => ['px', '%'],
499 'range' => [
500 'px' => [
501 'min' => 0,
502 'max' => 1000,
503 'step' => 1,
504 ],
505 '%' => [
506 'min' => 0,
507 'max' => 100,
508 ],
509 ],
510 'default' => [
511 'unit' => 'px',
512 'size' => 20,
513 ],
514 'selectors' => [
515 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'left: {{SIZE}}{{UNIT}};',
516 ],
517 'condition' => [
518 'shopengine_lightbox_icon_position' => 'custom',
519 ],
520 ]
521 );
522
523 $this->add_control(
524 'shopengine_lightbox_icon_position_y_axis',
525 [
526 'label' => esc_html__('Badge Position (Y axis)', 'shopengine'),
527 'type' => Controls_Manager::SLIDER,
528 'size_units' => ['px', '%'],
529 'range' => [
530 'px' => [
531 'min' => 0,
532 'max' => 1000,
533 'step' => 1,
534 ],
535 '%' => [
536 'min' => 0,
537 'max' => 100,
538 ],
539 ],
540 'default' => [
541 'unit' => 'px',
542 'size' => 20,
543 ],
544 'selectors' => [
545 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'top: {{SIZE}}{{UNIT}};',
546 ],
547 'condition' => [
548 'shopengine_lightbox_icon_position' => 'custom',
549 ],
550 ]
551 );
552
553 $this->end_controls_section(); // end ./ lightbox zoom icon
554
555 /*
556 --------------------------
557 Flash sale badge style
558 --------------------------
559 */
560 $this->start_controls_section(
561 'shopengine_flash_sale_badge_style',
562 [
563 'label' => esc_html__('Flash Sale Badge', 'shopengine'),
564 'tab' => Controls_Manager::TAB_STYLE,
565 'condition' => [
566 'shopengine_sale_flash_status' => 'yes',
567 ],
568 ]
569 );
570
571 $this->add_control(
572 'shopengine_flash_sale_color',
573 [
574 'label' => esc_html__('Color', 'shopengine'),
575 'type' => Controls_Manager::COLOR,
576 'default' => '#ffffff',
577 'alpha' => false,
578 'selectors' => [
579 '{{WRAPPER}} .shopengine-product-image .onsale' => 'color: {{VALUE}}',
580 ],
581 ]
582 );
583
584 $this->add_control(
585 'shopengine_flash_sale_background',
586 [
587 'label' => esc_html__('Background Color', 'shopengine'),
588 'type' => Controls_Manager::COLOR,
589 'default' => '#8fa775',
590 'alpha' => false,
591 'selectors' => [
592 '{{WRAPPER}} .shopengine-product-image .onsale' => 'background-color: {{VALUE}}',
593 ],
594 ]
595 );
596
597 $this->add_group_control(
598 Group_Control_Typography::get_type(),
599 [
600 'name' => 'shopengine_onsale_primary',
601 'label' => esc_html__('Typography', 'shopengine'),
602 'selector' => '{{WRAPPER}} .shopengine-product-image .onsale',
603 'exclude' => ['letter_spacing', 'text_decoration', 'font_weight', 'font_style'],
604
605 'fields_options' => [
606 'typography' => [
607 'default' => 'custom',
608 ],
609 'font_size' => [
610 'label' => esc_html__('Font Size (px)', 'shopengine'),
611 'default' => [
612 'size' => '16',
613 'unit' => 'px',
614 ],
615 'size_units' => ['px'],
616 ],
617 'line_height' => [
618 'label' => esc_html__('Line-height (px)', 'shopengine'),
619 'default' => [
620 'size' => '20',
621 'unit' => 'px',
622 ],
623 'size_units' => ['px'],
624 ],
625 ],
626 ]
627 );
628
629 $this->add_control(
630 'shopengine_flash_sale_height_width_status',
631 [
632 'label' => esc_html__('Fixed Height Width', 'shopengine'),
633 'type' => Controls_Manager::SWITCHER,
634 'label_on' => esc_html__('Show', 'shopengine'),
635 'label_off' => esc_html__('Hide', 'shopengine'),
636 'render_type' => 'template',
637 'return_value' => 'yes',
638 'default' => 'yes',
639 ]
640 );
641
642 $this->add_control(
643 'shopengine_flash_sale_height',
644 [
645 'label' => esc_html__('Height (px)', 'shopengine'),
646 'type' => Controls_Manager::SLIDER,
647 'size_units' => ['px'],
648 'range' => [
649 'px' => [
650 'min' => 0,
651 'max' => 200,
652 'step' => 1,
653 ],
654 ],
655 'default' => [
656 'unit' => 'px',
657 'size' => 70,
658 ],
659 'selectors' => [
660 '{{WRAPPER}} .shopengine-product-image .onsale' => 'height: {{SIZE}}{{UNIT}};',
661 ],
662 'condition' => [
663 'shopengine_flash_sale_height_width_status' => 'yes',
664 ],
665 ]
666 );
667
668 $this->add_control(
669 'shopengine_flash_sale_width',
670 [
671 'label' => esc_html__('Width (px)', 'shopengine'),
672 'type' => Controls_Manager::SLIDER,
673 'size_units' => ['px'],
674 'range' => [
675 'px' => [
676 'min' => 0,
677 'max' => 200,
678 'step' => 1,
679 ],
680 ],
681 'default' => [
682 'unit' => 'px',
683 'size' => 70,
684 ],
685 'selectors' => [
686 '{{WRAPPER}} .shopengine-product-image .onsale' => 'width: {{SIZE}}{{UNIT}}',
687 ],
688 'condition' => [
689 'shopengine_flash_sale_height_width_status' => 'yes',
690 ],
691 ]
692 );
693
694 $this->add_control(
695 'shopengine_flash_sale_radius',
696 [
697 'label' => esc_html__('Border Radius (px)', 'shopengine'),
698 'type' => Controls_Manager::SLIDER,
699 'size_units' => ['px'],
700 'range' => [
701 'px' => [
702 'min' => 0,
703 'max' => 100,
704 'step' => 1,
705 ],
706 ],
707 'default' => [
708 'unit' => 'px',
709 'size' => 70,
710 ],
711 'selectors' => [
712 '{{WRAPPER}} .shopengine-product-image .onsale' => 'border-radius: {{SIZE}}{{UNIT}}',
713 ],
714 ]
715 );
716
717 $this->add_control(
718 'shopengine_flash_sale_position',
719 [
720 'label' => esc_html__('Position', 'shopengine'),
721 'type' => Controls_Manager::CHOOSE,
722 'options' => [
723 'top-left' => [
724 'title' => esc_html__('Top Left', 'shopengine'),
725 'icon' => 'eicon-h-align-left',
726 ],
727 'top-right' => [
728 'title' => esc_html__('Top Right', 'shopengine'),
729 'icon' => 'eicon-h-align-right',
730 ],
731 'custom' => [
732 'title' => esc_html__('Custom', 'shopengine'),
733 'icon' => 'eicon-settings',
734 ],
735 ],
736 'default' => 'top-left',
737 'toggle' => false,
738 'separator' => 'before',
739 ]
740 );
741
742 $this->add_control(
743 'shopengine_flash_sale_position_x_axis',
744 [
745 'label' => esc_html__('Badge Position (X axis)', 'shopengine'),
746 'type' => Controls_Manager::SLIDER,
747 'size_units' => ['px', '%'],
748 'range' => [
749 'px' => [
750 'min' => 0,
751 'max' => 1000,
752 'step' => 1,
753 ],
754 '%' => [
755 'min' => 0,
756 'max' => 100,
757 ],
758 ],
759 'default' => [
760 'unit' => 'px',
761 'size' => 20,
762 ],
763 'selectors' => [
764 '{{WRAPPER}} .shopengine-product-image .onsale' => 'left: {{SIZE}}{{UNIT}};',
765 ],
766 'condition' => [
767 'shopengine_flash_sale_position' => 'custom',
768 ],
769 ]
770 );
771
772 $this->add_control(
773 'shopengine_flash_sale_position_y_axis',
774 [
775 'label' => esc_html__('Badge Position (Y axis)', 'shopengine'),
776 'type' => Controls_Manager::SLIDER,
777 'size_units' => ['px', '%'],
778 'range' => [
779 'px' => [
780 'min' => 0,
781 'max' => 1000,
782 'step' => 1,
783 ],
784 '%' => [
785 'min' => 0,
786 'max' => 100,
787 ],
788 ],
789 'default' => [
790 'unit' => 'px',
791 'size' => 20,
792 ],
793 'selectors' => [
794 '{{WRAPPER}} .shopengine-product-image .onsale' => 'top: {{SIZE}}{{UNIT}};',
795 ],
796 'condition' => [
797 'shopengine_flash_sale_position' => 'custom',
798 ],
799 ]
800 );
801
802 $this->end_controls_section();
803
804 /*
805 --------------------------
806 Slider Nav style
807 --------------------------
808 */
809 $this->start_controls_section(
810 'shopengine_gallery_nav_style',
811 [
812 'label' => esc_html__('Slider Nav', 'shopengine'),
813 'tab' => Controls_Manager::TAB_STYLE,
814 ]
815 );
816
817 $this->add_control(
818 'shopengine_slider_icon_size',
819 [
820 'label' => esc_html__('Size (px)', 'shopengine'),
821 'type' => Controls_Manager::SLIDER,
822 'size_units' => ['px'],
823 'range' => [
824 'px' => [
825 'min' => 0,
826 'max' => 100,
827 'step' => 1,
828 ],
829 ],
830 'default' => [
831 'unit' => 'px',
832 'size' => 16,
833 ],
834 'selectors' => [
835 '{{WRAPPER}} .shopengine-product-image .flex-direction-nav .flex-prev:before, .shopengine-widget .shopengine-product-image .flex-direction-nav .flex-next:before' => 'font-size: {{SIZE}}{{UNIT}};',
836 ],
837 ]
838 );
839
840 $this->add_control(
841 'shopengine_slider_nav_icon_color',
842 [
843 'label' => esc_html__('Icon Color', 'shopengine'),
844 'type' => Controls_Manager::COLOR,
845 'default' => '#101010',
846 'alpha' => false,
847 'selectors' => [
848 '{{WRAPPER}} .shopengine-product-image .flex-direction-nav .flex-prev:before, .shopengine-widget .shopengine-product-image .flex-direction-nav .flex-next:before' => 'color: {{VALUE}}',
849 ],
850 ]
851 );
852
853 $this->add_control(
854 'shopengine_slider_nav_background',
855 [
856 'label' => esc_html__('Background Color', 'shopengine'),
857 'type' => Controls_Manager::COLOR,
858 'default' => '#fff',
859 'alpha' => false,
860 'selectors' => [
861 '{{WRAPPER}} .shopengine-product-image .flex-direction-nav .flex-prev:before, .shopengine-widget .shopengine-product-image .flex-direction-nav .flex-next:before' => 'background-color: {{VALUE}}',
862 ],
863 ]
864 );
865
866 $this->end_controls_section();
867 }
868
869 /**
870 * Render widget output on the frontend.
871 *
872 * Written in PHP and used to generate the final HTML.
873 *
874 * @since 1.0.0
875 * @access protected
876 */
877 protected function screen() {
878 $settings = $this->get_settings_for_display();
879 ?>
880
881 <div class="shopengine-product-image <?php echo \ShopEngine::package_type() == 'pro' ? 'shopengine-gallery-slider' : 'shopengine-gallery-slider-no' ?>">
882 <button title="<?php esc_html_e('Product Thumbnail','shopengine')?>"
883 class="shopengine-product-image-toggle position-<?php echo esc_attr($settings['shopengine_lightbox_icon_position']); ?>">
884 <?php Icons_Manager::render_icon($settings['shopengine_image_lightbox_icon'], ['aria-hidden' => 'true']); ?>
885 </button>
886 <?php shopengine_content_render(\ShopEngine\Utils\Helper::render($this->view_render($settings)));?>
887 </div>
888
889 <?php
890 }
891
892
893 protected function view_render($settings = []) {
894
895 /*
896 TODO: As we are redirecting the users from shopengine\core\builders\hooks.php file if there is no product found with the given ID. So we need to remove the sample products attachment below. Because it is unused.
897 */
898
899 $product = wc_get_product();
900 if(empty($product)) {
901 $product = Products::instance()->get_product('');
902 }
903
904 $tpl = Products::instance()->get_widget_template('shopengine-product-image');
905
906 include $tpl;
907 }
908 }
909