PluginProbe ʕ •ᴥ•ʔ
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets / 1.3.4
ShopEngine Elementor WooCommerce Builder Addon – All in One WooCommerce Solution with eCommerce Templates & Woo Widgets v1.3.4
4.9.5 4.9.4 4.9.3 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 4 years ago product-image-config.php 4 years ago product-image.php 4 years ago
product-image.php
830 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_border_radius',
138 [
139 'label' => esc_html__('Border Radius', 'shopengine'),
140 'type' => Controls_Manager::SLIDER,
141 'size_units' => ['px', '%'],
142 'range' => [
143 'px' => [
144 'min' => 0,
145 'max' => 100,
146 'step' => 1,
147 ],
148 '%' => [
149 'min' => 0,
150 'max' => 100,
151 'step' => 1,
152 ],
153 ],
154 'selectors' => [
155 '.woocommerce {{WRAPPER}} .shopengine-product-image .woocommerce-product-gallery__trigger + .woocommerce-product-gallery__wrapper,
156 .woocommerce {{WRAPPER}} .shopengine-product-image .img-thumbnail,
157 .woocommerce {{WRAPPER}} .shopengine-product-image .flex-viewport' => 'border-radius: {{SIZE}}{{UNIT}};',
158 ],
159 ]
160 );
161
162 $this->add_control(
163 'shopengine_heading_gallery_thumbs_style',
164 [
165 'label' => esc_html__('Gallery Thumbnails', 'shopengine'),
166 'type' => Controls_Manager::HEADING,
167 'separator' => 'before',
168 ]
169 );
170
171 $this->add_responsive_control(
172 'shopengine_gallery_thumbs_width',
173 [
174 'label' => esc_html__('Width', 'shopengine'),
175 'type' => Controls_Manager::SLIDER,
176 'size_units' => ['px', '%'],
177 'range' => [
178 'px' => [
179 'min' => 0,
180 'max' => 1000,
181 'step' => 5,
182 ],
183 '%' => [
184 'min' => 0,
185 'max' => 100,
186 ],
187 ],
188 'default' => [
189 'unit' => 'px',
190 'size' => 188,
191 ],
192 'selectors' => [
193 '{{WRAPPER}} .flex-control-thumbs, {{WRAPPER}} .flex-control-thumbs' => 'width: {{SIZE}}{{UNIT}} !important;',
194 '{{WRAPPER}} .flex-direction-nav a:before' => 'width: {{SIZE}}{{UNIT}};',
195 '{{WRAPPER}} .flex-control-thumbs li, {{WRAPPER}} .flex-control-thumbs li' => 'flex: 0 0 {{SIZE}}{{UNIT}};',
196 '{{WRAPPER}}.shopengine_image_gallery_position_left .flex-viewport, {{WRAPPER}}.shopengine_image_gallery_position_right .flex-viewport' => 'width: calc(100% - {{SIZE}}{{UNIT}});',
197 '{{WRAPPER}}.shopengine_image_gallery_position_left .shopengine-product-image .onsale, {{WRAPPER}}.shopengine_image_gallery_position_left .shopengine-product-image-toggle' => 'margin-left: {{SIZE}}{{UNIT}}',
198 '{{WRAPPER}}.shopengine_image_gallery_position_right .shopengine-product-image .onsale, {{WRAPPER}}.shopengine_image_gallery_position_right .shopengine-product-image-toggle' => 'margin-right: {{SIZE}}{{UNIT}}',
199 ],
200 ]
201 );
202
203 $this->add_group_control(
204 Group_Control_Border::get_type(),
205 [
206 'name' => 'shopengine_thumbs_border',
207 'selector' => '.woocommerce {{WRAPPER}} .shopengine-product-image .flex-control-thumbs img,
208 .woocommerce {{WRAPPER}} .shopengine-product-image .product-thumbs-slider .img-thumbnail,
209 .woocommerce {{WRAPPER}} .woocommerce-product-gallery #product-thumbnails-carousel .slick-slide:hover img,
210 .woocommerce {{WRAPPER}} .woocommerce-product-gallery #product-thumbnails-carousel .slick-current img',
211 'fields_options' => [
212 'color' => [
213 'label' => esc_html__('Border Color', 'shopengine'),
214 'alpha' => false,
215 ],
216
217 ],
218 ]
219 );
220
221 $this->add_control(
222 'shopengine_thumbs_border_radius',
223 [
224 'label' => esc_html__('Border Radius (px)', 'shopengine'),
225 'type' => Controls_Manager::SLIDER,
226 'size_units' => ['px', '%'],
227 'range' => [
228 'px' => [
229 'min' => 0,
230 'max' => 100,
231 'step' => 1,
232 ],
233 '%' => [
234 'min' => 0,
235 'max' => 100,
236 'step' => 1,
237 ],
238 ],
239 'selectors' => [
240 '.woocommerce {{WRAPPER}} .shopengine-product-image .flex-control-thumbs img,
241 .woocommerce {{WRAPPER}} .shopengine-product-image .product-thumbs-slider .img-thumbnail,
242 .woocommerce-product-gallery #product-thumbnails-carousel .slick-slide:hover img,
243 .woocommerce-product-gallery #product-thumbnails-carousel .slick-current img'
244 => 'border-radius: {{SIZE}}{{UNIT}}',
245 ],
246 ]
247 );
248
249 $this->add_control(
250 'shopengine_gallery_thumbs_row_gap',
251 [
252 'label' => esc_html__('Row Gap (px)', 'shopengine'),
253 'type' => Controls_Manager::SLIDER,
254 'size_units' => ['px'],
255 'range' => [
256 'px' => [
257 'min' => 0,
258 'max' => 100,
259 'step' => 1,
260 ],
261 ],
262 'default' => [
263 'unit' => 'px',
264 'size' => 15,
265 ],
266 'selectors' => [
267 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs li' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
268 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs' => 'margin-left:-{{SIZE}}{{UNIT}};margin-right: -{{SIZE}}{{UNIT}};',
269 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider:not( .owl-loaded )' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
270 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider .owl-stage' => 'padding-left: {{SIZE}}{{UNIT}};padding-right: {{SIZE}}{{UNIT}};',
271 ],
272 ]
273 );
274
275 $column_condition = [];
276
277 if(\ShopEngine::package_type() == 'pro'){
278 $column_condition = [
279 'shopengine_image_gallery_position!' => 'bottom'
280 ];
281 }
282
283 $this->add_control(
284 'shopengine_gallery_thumbs_column_gap',
285 [
286 'label' => esc_html__('Column Gap (px)', 'shopengine'),
287 'type' => Controls_Manager::SLIDER,
288 'size_units' => ['px'],
289 'range' => [
290 'px' => [
291 'min' => 0,
292 'max' => 100,
293 'step' => 1,
294 ],
295 ],
296 'default' => [
297 'unit' => 'px',
298 'size' => 20,
299 ],
300 'selectors' => [
301 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs li' => 'padding-top: {{SIZE}}{{UNIT}};padding-bottom: {{SIZE}}{{UNIT}};',
302 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs' => 'margin-top:-{{SIZE}}{{UNIT}};margin-bottom: -{{SIZE}}{{UNIT}};',
303 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider:not( .owl-loaded )' => 'padding-top: {{SIZE}}{{UNIT}};padding-bottom: {{SIZE}}{{UNIT}};;',
304 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider .owl-stage' => 'padding-top: {{SIZE}}{{UNIT}};padding-bottom: {{SIZE}}{{UNIT}};;',
305 ],
306 'condition' => $column_condition
307 ]
308 );
309
310 $this->add_responsive_control(
311 'shopengine_thumbs_margin',
312 [
313 'label' => esc_html__('Margin Top (px)', 'shopengine'),
314 'type' => Controls_Manager::SLIDER,
315 'default' => [
316 'size' => '20',
317 ],
318 'size_units' => ['px'],
319 'selectors' => [
320 '{{WRAPPER}} .shopengine-product-image .flex-control-thumbs' => 'margin-top: {{SIZE}}px;',
321 '{{WRAPPER}} .shopengine-product-image .product-thumbs-slider' => 'margin-top: {{SIZE}}px;',
322 ],
323 'separator' => 'before',
324 'condition' => [
325 'shopengine_image_gallery_position' => 'bottom',
326 ]
327 ]
328 );
329
330 $this->end_controls_section(); // end ./ product image style
331
332 /*
333 --------------------------
334 lightbox zoom icon
335 --------------------------
336 */
337
338 $this->start_controls_section(
339 'shopengine_lightbox_icon_style',
340 [
341 'label' => esc_html__('Lightbox Zoom Icon', 'shopengine'),
342 'tab' => Controls_Manager::TAB_STYLE,
343 ]
344 );
345
346 $this->add_control(
347 'shopengine_lightbox_icon_color',
348 [
349 'label' => esc_html__('Icon Color', 'shopengine'),
350 'type' => Controls_Manager::COLOR,
351 'default' => '#101010',
352 'alpha' => false,
353 'selectors' => [
354 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'color: {{VALUE}}',
355 ],
356 ]
357 );
358
359 $this->add_control(
360 'shopengine_lightbox_icon_border_color',
361 [
362 'label' => esc_html__('Icon Border Color', 'shopengine'),
363 'type' => Controls_Manager::COLOR,
364 'default' => '#101010',
365 'alpha' => false,
366 'selectors' => [
367 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'border:1px solid {{VALUE}}; box-shadow:none;-webkit-box-shadow:none;',
368 ],
369 ]
370 );
371
372 $this->add_control(
373 'shopengine_lightbox_icon_background',
374 [
375 'label' => esc_html__('Icon Background Color', 'shopengine'),
376 'type' => Controls_Manager::COLOR,
377 'alpha' => false,
378 'default' => '#ffffff',
379 'selectors' => [
380 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'background-color: {{VALUE}}',
381 ],
382 ]
383 );
384
385 $this->add_control(
386 'shopengine_lightbox_icon_size',
387 [
388 'label' => esc_html__('Size (px)', 'shopengine'),
389 'type' => Controls_Manager::SLIDER,
390 'size_units' => ['px'],
391 'range' => [
392 'px' => [
393 'min' => 0,
394 'max' => 100,
395 'step' => 1,
396 ],
397 ],
398 'default' => [
399 'unit' => 'px',
400 'size' => 16,
401 ],
402 'selectors' => [
403 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'font-size: {{SIZE}}{{UNIT}};',
404 ],
405 ]
406 );
407
408 $this->add_control(
409 'shopengine_lightbox_icon_wrapper_size',
410 [
411 'label' => esc_html__('Wrapper Size (px)', 'shopengine'),
412 'type' => Controls_Manager::SLIDER,
413 'size_units' => ['px'],
414 'range' => [
415 'px' => [
416 'min' => 0,
417 'max' => 100,
418 'step' => 1,
419 ],
420 ],
421 'default' => [
422 'unit' => 'px',
423 'size' => 46,
424 ],
425 'selectors' => [
426 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}',
427 ],
428 ]
429 );
430
431 $this->add_control(
432 'shopengine_lightbox_icon_radius',
433 [
434 'label' => esc_html__('Border Radius (px)', 'shopengine'),
435 'type' => Controls_Manager::SLIDER,
436 'size_units' => ['px'],
437 'range' => [
438 'px' => [
439 'min' => 0,
440 'max' => 100,
441 'step' => 5,
442 ],
443 ],
444 'default' => [
445 'unit' => 'px',
446 'size' => 100,
447 ],
448 'selectors' => [
449 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'border-radius: {{SIZE}}{{UNIT}}',
450 ],
451 ]
452 );
453
454 $this->add_control(
455 'shopengine_lightbox_icon_position',
456 [
457 'label' => esc_html__('Position', 'shopengine'),
458 'type' => Controls_Manager::CHOOSE,
459 'options' => [
460 'top-left' => [
461 'title' => esc_html__('Top Left', 'shopengine'),
462 'icon' => 'eicon-h-align-left',
463 ],
464 'top-right' => [
465 'title' => esc_html__('Top Right', 'shopengine'),
466 'icon' => 'eicon-h-align-right',
467 ],
468 'custom' => [
469 'title' => esc_html__('Custom', 'shopengine'),
470 'icon' => 'eicon-settings',
471 ],
472 ],
473 'default' => 'top-right',
474 'toggle' => false,
475 'separator' => 'before',
476 ]
477 );
478
479 $this->add_control(
480 'shopengine_lightbox_icon_position_x_axis',
481 [
482 'label' => esc_html__('Badge Position (X axis)', 'shopengine'),
483 'type' => Controls_Manager::SLIDER,
484 'size_units' => ['px', '%'],
485 'range' => [
486 'px' => [
487 'min' => 0,
488 'max' => 1000,
489 'step' => 1,
490 ],
491 '%' => [
492 'min' => 0,
493 'max' => 100,
494 ],
495 ],
496 'default' => [
497 'unit' => 'px',
498 'size' => 20,
499 ],
500 'selectors' => [
501 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'left: {{SIZE}}{{UNIT}};',
502 ],
503 'condition' => [
504 'shopengine_lightbox_icon_position' => 'custom',
505 ],
506 ]
507 );
508
509 $this->add_control(
510 'shopengine_lightbox_icon_position_y_axis',
511 [
512 'label' => esc_html__('Badge Position (Y axis)', 'shopengine'),
513 'type' => Controls_Manager::SLIDER,
514 'size_units' => ['px', '%'],
515 'range' => [
516 'px' => [
517 'min' => 0,
518 'max' => 1000,
519 'step' => 1,
520 ],
521 '%' => [
522 'min' => 0,
523 'max' => 100,
524 ],
525 ],
526 'default' => [
527 'unit' => 'px',
528 'size' => 20,
529 ],
530 'selectors' => [
531 '{{WRAPPER}} .shopengine-product-image .shopengine-product-image-toggle' => 'top: {{SIZE}}{{UNIT}};',
532 ],
533 'condition' => [
534 'shopengine_lightbox_icon_position' => 'custom',
535 ],
536 ]
537 );
538
539 $this->end_controls_section(); // end ./ lightbox zoom icon
540
541 /*
542 --------------------------
543 Flash sale badge style
544 --------------------------
545 */
546 $this->start_controls_section(
547 'shopengine_flash_sale_badge_style',
548 [
549 'label' => esc_html__('Flash Sale Badge', 'shopengine'),
550 'tab' => Controls_Manager::TAB_STYLE,
551 'condition' => [
552 'shopengine_sale_flash_status' => 'yes',
553 ],
554 ]
555 );
556
557 $this->add_control(
558 'shopengine_flash_sale_color',
559 [
560 'label' => esc_html__('Color', 'shopengine'),
561 'type' => Controls_Manager::COLOR,
562 'default' => '#ffffff',
563 'alpha' => false,
564 'selectors' => [
565 '{{WRAPPER}} .shopengine-product-image .onsale' => 'color: {{VALUE}}',
566 ],
567 ]
568 );
569
570 $this->add_control(
571 'shopengine_flash_sale_background',
572 [
573 'label' => esc_html__('Background Color', 'shopengine'),
574 'type' => Controls_Manager::COLOR,
575 'default' => '#8fa775',
576 'alpha' => false,
577 'selectors' => [
578 '{{WRAPPER}} .shopengine-product-image .onsale' => 'background-color: {{VALUE}}',
579 ],
580 ]
581 );
582
583 $this->add_group_control(
584 Group_Control_Typography::get_type(),
585 [
586 'name' => 'shopengine_onsale_primary',
587 'label' => esc_html__('Typography', 'shopengine'),
588 'selector' => '{{WRAPPER}} .shopengine-product-image .onsale',
589 'exclude' => ['letter_spacing', 'text_decoration', 'font_weight', 'font_style'],
590
591 'fields_options' => [
592 'typography' => [
593 'default' => 'custom',
594 ],
595 'font_size' => [
596 'label' => esc_html__('Font Size (px)', 'shopengine'),
597 'default' => [
598 'size' => '16',
599 'unit' => 'px',
600 ],
601 'size_units' => ['px'],
602 ],
603 'line_height' => [
604 'label' => esc_html__('Line-height (px)', 'shopengine'),
605 'default' => [
606 'size' => '20',
607 'unit' => 'px',
608 ],
609 'size_units' => ['px'],
610 ],
611 ],
612 ]
613 );
614
615 $this->add_control(
616 'shopengine_flash_sale_height_width_status',
617 [
618 'label' => esc_html__('Fixed Height Width', 'shopengine'),
619 'type' => Controls_Manager::SWITCHER,
620 'label_on' => esc_html__('Show', 'shopengine'),
621 'label_off' => esc_html__('Hide', 'shopengine'),
622 'render_type' => 'template',
623 'return_value' => 'yes',
624 'default' => 'yes',
625 ]
626 );
627
628 $this->add_control(
629 'shopengine_flash_sale_height',
630 [
631 'label' => esc_html__('Height (px)', 'shopengine'),
632 'type' => Controls_Manager::SLIDER,
633 'size_units' => ['px'],
634 'range' => [
635 'px' => [
636 'min' => 0,
637 'max' => 200,
638 'step' => 1,
639 ],
640 ],
641 'default' => [
642 'unit' => 'px',
643 'size' => 70,
644 ],
645 'selectors' => [
646 '{{WRAPPER}} .shopengine-product-image .onsale' => 'height: {{SIZE}}{{UNIT}};',
647 ],
648 'condition' => [
649 'shopengine_flash_sale_height_width_status' => 'yes',
650 ],
651 ]
652 );
653
654 $this->add_control(
655 'shopengine_flash_sale_width',
656 [
657 'label' => esc_html__('Width (px)', 'shopengine'),
658 'type' => Controls_Manager::SLIDER,
659 'size_units' => ['px'],
660 'range' => [
661 'px' => [
662 'min' => 0,
663 'max' => 200,
664 'step' => 1,
665 ],
666 ],
667 'default' => [
668 'unit' => 'px',
669 'size' => 70,
670 ],
671 'selectors' => [
672 '{{WRAPPER}} .shopengine-product-image .onsale' => 'width: {{SIZE}}{{UNIT}}',
673 ],
674 'condition' => [
675 'shopengine_flash_sale_height_width_status' => 'yes',
676 ],
677 ]
678 );
679
680 $this->add_control(
681 'shopengine_flash_sale_radius',
682 [
683 'label' => esc_html__('Border Radius (px)', 'shopengine'),
684 'type' => Controls_Manager::SLIDER,
685 'size_units' => ['px'],
686 'range' => [
687 'px' => [
688 'min' => 0,
689 'max' => 100,
690 'step' => 1,
691 ],
692 ],
693 'default' => [
694 'unit' => 'px',
695 'size' => 70,
696 ],
697 'selectors' => [
698 '{{WRAPPER}} .shopengine-product-image .onsale' => 'border-radius: {{SIZE}}{{UNIT}}',
699 ],
700 ]
701 );
702
703 $this->add_control(
704 'shopengine_flash_sale_position',
705 [
706 'label' => esc_html__('Position', 'shopengine'),
707 'type' => Controls_Manager::CHOOSE,
708 'options' => [
709 'top-left' => [
710 'title' => esc_html__('Top Left', 'shopengine'),
711 'icon' => 'eicon-h-align-left',
712 ],
713 'top-right' => [
714 'title' => esc_html__('Top Right', 'shopengine'),
715 'icon' => 'eicon-h-align-right',
716 ],
717 'custom' => [
718 'title' => esc_html__('Custom', 'shopengine'),
719 'icon' => 'eicon-settings',
720 ],
721 ],
722 'default' => 'top-left',
723 'toggle' => false,
724 'separator' => 'before',
725 ]
726 );
727
728 $this->add_control(
729 'shopengine_flash_sale_position_x_axis',
730 [
731 'label' => esc_html__('Badge Position (X axis)', 'shopengine'),
732 'type' => Controls_Manager::SLIDER,
733 'size_units' => ['px', '%'],
734 'range' => [
735 'px' => [
736 'min' => 0,
737 'max' => 1000,
738 'step' => 1,
739 ],
740 '%' => [
741 'min' => 0,
742 'max' => 100,
743 ],
744 ],
745 'default' => [
746 'unit' => 'px',
747 'size' => 20,
748 ],
749 'selectors' => [
750 '{{WRAPPER}} .shopengine-product-image .onsale' => 'left: {{SIZE}}{{UNIT}};',
751 ],
752 'condition' => [
753 'shopengine_flash_sale_position' => 'custom',
754 ],
755 ]
756 );
757
758 $this->add_control(
759 'shopengine_flash_sale_position_y_axis',
760 [
761 'label' => esc_html__('Badge Position (Y axis)', 'shopengine'),
762 'type' => Controls_Manager::SLIDER,
763 'size_units' => ['px', '%'],
764 'range' => [
765 'px' => [
766 'min' => 0,
767 'max' => 1000,
768 'step' => 1,
769 ],
770 '%' => [
771 'min' => 0,
772 'max' => 100,
773 ],
774 ],
775 'default' => [
776 'unit' => 'px',
777 'size' => 20,
778 ],
779 'selectors' => [
780 '{{WRAPPER}} .shopengine-product-image .onsale' => 'top: {{SIZE}}{{UNIT}};',
781 ],
782 'condition' => [
783 'shopengine_flash_sale_position' => 'custom',
784 ],
785 ]
786 );
787
788 $this->end_controls_section();
789
790
791 }
792
793 /**
794 * Render widget output on the frontend.
795 *
796 * Written in PHP and used to generate the final HTML.
797 *
798 * @since 1.0.0
799 * @access protected
800 */
801 protected function screen() {
802 $settings = $this->get_settings_for_display();
803 ?>
804
805 <div class="shopengine-product-image <?php echo \ShopEngine::package_type() == 'pro' ? 'shopengine-gallery-slider' : 'shopengine-gallery-slider-no' ?>">
806 <a href="#"
807 class="shopengine-product-image-toggle position-<?php echo esc_attr($settings['shopengine_lightbox_icon_position']); ?>">
808 <?php Icons_Manager::render_icon($settings['shopengine_image_lightbox_icon'], ['aria-hidden' => 'true']); ?>
809 </a>
810 <?php echo \ShopEngine\Utils\Helper::render($this->view_render($settings)); ?>
811 </div>
812
813 <?php
814 }
815
816
817 protected function view_render($settings = []) {
818
819 $product = wc_get_product();
820
821 if(empty($product)) {
822 $product = Products::instance()->get_product('');
823 }
824
825 $tpl = Products::instance()->get_widget_template('shopengine-product-image');
826
827 include $tpl;
828 }
829 }
830