PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.0.2
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.0.2
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / modules / up-sells / widgets / up-sells.php

up-sells.php in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 3.0.2, at modules/up-sells/widgets/up-sells.php

773 lines 28.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimateStoreKit\Modules\UpSells\Widgets;
4
5 use UltimateStoreKit\Base\Module_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Typography;
8 use Elementor\Group_Control_Box_Shadow;
9 use Elementor\Group_Control_Background;
10 use Elementor\Group_Control_Border;
11
12 if (!defined('ABSPATH')) exit; // Exit if accessed directly
13
14 class Up_Sells extends Module_Base
15 {
16
17 public function get_name()
18 {
19 return 'usk-up-sells';
20 }
21
22 public function get_title()
23 {
24 return BDTUSK . esc_html__('Upsells', 'ultimate-store-kit');
25 }
26
27 public function get_icon()
28 {
29 return 'usk-widget-icon usk-icon-up-sells';
30 }
31
32 public function get_categories()
33 {
34 return ['ultimate-store-kit'];
35 }
36
37 public function get_keywords()
38 {
39 return ['woocommerce', 'shop', 'store', 'upsell', 'product'];
40 }
41
42 public function get_style_depends()
43 {
44 if ($this->usk_is_edit_mode()) {
45 return ['usk-all-styles'];
46 } else {
47 return ['usk-up-sells'];
48 }
49 }
50
51 public function has_widget_inner_wrapper(): bool {
52 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
53 }
54 protected function register_controls() {
55 $this->register_controls_upsell_content();
56 $this->register_style_controls_heading();
57 $this->register_controls_items();
58 $this->register_controls_title();
59 $this->register_controls_price();
60 $this->register_controls_action_btn();
61 }
62 protected function register_controls_upsell_content()
63 {
64
65 $this->start_controls_section(
66 'section_upsell_content',
67 [
68 'label' => __('Upsells', 'ultimate-store-kit'),
69 ]
70 );
71
72 $this->add_responsive_control(
73 'columns',
74 [
75 'label' => __('Columns', 'ultimate-store-kit'),
76 'type' => Controls_Manager::NUMBER,
77 'prefix_class' => 'usk-products-columns%s-',
78 'default' => 4,
79 'min' => 1,
80 'max' => 12,
81 ]
82 );
83
84 $this->add_control(
85 'orderby',
86 [
87 'label' => __('Order By', 'ultimate-store-kit'),
88 'type' => Controls_Manager::SELECT,
89 'default' => 'date',
90 'options' => [
91 'date' => __('Date', 'ultimate-store-kit'),
92 'title' => __('Title', 'ultimate-store-kit'),
93 'price' => __('Price', 'ultimate-store-kit'),
94 'popularity' => __('Popularity', 'ultimate-store-kit'),
95 'rating' => __('Rating', 'ultimate-store-kit'),
96 'rand' => __('Random', 'ultimate-store-kit'),
97 'menu_order' => __('Menu Order', 'ultimate-store-kit'),
98 ],
99 ]
100 );
101
102 $this->add_control(
103 'order',
104 [
105 'label' => __('Order', 'ultimate-store-kit'),
106 'type' => Controls_Manager::SELECT,
107 'default' => 'desc',
108 'options' => [
109 'asc' => __('ASC', 'ultimate-store-kit'),
110 'desc' => __('DESC', 'ultimate-store-kit'),
111 ],
112 ]
113 );
114
115 $this->end_controls_section();
116 }
117
118 protected function register_style_controls_heading()
119 {
120 $this->start_controls_section(
121 'section_heading_style',
122 [
123 'label' => __('Heading', 'ultimate-store-kit'),
124 'tab' => Controls_Manager::TAB_STYLE,
125 ]
126 );
127
128 $this->add_control(
129 'show_heading',
130 [
131 'label' => __('Heading', 'ultimate-store-kit'),
132 'type' => Controls_Manager::SWITCHER,
133 'label_off' => __('Hide', 'ultimate-store-kit'),
134 'label_on' => __('Show', 'ultimate-store-kit'),
135 'default' => 'yes',
136 'return_value' => 'yes',
137 'prefix_class' => 'usk-up-sells-show-heading-',
138 ]
139 );
140
141 $this->add_control(
142 'heading_color',
143 [
144 'label' => __('Color', 'ultimate-store-kit'),
145 'type' => Controls_Manager::COLOR,
146 'selectors' => [
147 '{{WRAPPER}} .usk-up-sells .products > h2' => 'color: {{VALUE}}',
148 ],
149 'condition' => [
150 'show_heading!' => '',
151 ],
152 ]
153 );
154
155 $this->add_group_control(
156 Group_Control_Typography::get_type(),
157 [
158 'name' => 'heading_typography',
159 'selector' => '{{WRAPPER}} .usk-up-sells .products > h2',
160 'condition' => [
161 'show_heading!' => '',
162 ],
163 ]
164 );
165
166 $this->add_responsive_control(
167 'heading_text_align',
168 [
169 'label' => __('Text Align', 'ultimate-store-kit'),
170 'type' => Controls_Manager::CHOOSE,
171 'options' => [
172 'left' => [
173 'title' => __('Left', 'ultimate-store-kit'),
174 'icon' => 'eicon-text-align-left',
175 ],
176 'center' => [
177 'title' => __('Center', 'ultimate-store-kit'),
178 'icon' => 'eicon-text-align-center',
179 ],
180 'right' => [
181 'title' => __('Right', 'ultimate-store-kit'),
182 'icon' => 'eicon-text-align-right',
183 ],
184 ],
185 'selectors' => [
186 '{{WRAPPER}} .usk-up-sells .products > h2' => 'text-align: {{VALUE}}',
187 ],
188 'condition' => [
189 'show_heading!' => '',
190 ],
191 ]
192 );
193
194 $this->add_responsive_control(
195 'heading_spacing',
196 [
197 'label' => __('Spacing', 'ultimate-store-kit'),
198 'type' => Controls_Manager::SLIDER,
199 'size_units' => ['px', 'em'],
200 'selectors' => [
201 '{{WRAPPER}} .usk-up-sells .products > h2' => 'margin-bottom: {{SIZE}}{{UNIT}}',
202 ],
203 'condition' => [
204 'show_heading!' => '',
205 ],
206 ]
207 );
208
209 $this->end_controls_section();
210 }
211 protected function register_controls_grid_image()
212 {
213 $this->start_controls_section(
214 'section_style_image',
215 [
216 'label' => esc_html__('Image', 'ultimate-store-kit'),
217 'tab' => Controls_Manager::TAB_STYLE,
218 ]
219 );
220 $this->start_controls_tabs(
221 'style_tabs_image'
222 );
223 $this->start_controls_tab(
224 'image_normal',
225 [
226 'label' => esc_html__('Normal', 'ultimate-store-kit'),
227 ]
228 );
229 $this->add_group_control(
230 Group_Control_Background::get_type(),
231 [
232 'name' => 'image_background',
233 'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image',
234 ]
235 );
236 $this->add_group_control(
237 Group_Control_Border::get_type(),
238 [
239 'name' => 'image_border',
240 'label' => esc_html__('Image Border', 'ultimate-store-kit'),
241 'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image',
242 'separator' => 'before',
243 ]
244 );
245
246 $this->add_responsive_control(
247 'image_border_radius',
248 [
249 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
250 'type' => Controls_Manager::DIMENSIONS,
251 'size_units' => ['px', '%'],
252 'selectors' => [
253 '{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
254 ],
255 ]
256 );
257
258 $this->add_responsive_control(
259 'image_padding',
260 [
261 'label' => esc_html__('Padding', 'ultimate-store-kit'),
262 'type' => Controls_Manager::DIMENSIONS,
263 'size_units' => ['px', '%'],
264 'selectors' => [
265 '{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
266 ],
267 ]
268 );
269
270 $this->add_group_control(
271 Group_Control_Box_Shadow::get_type(),
272 [
273 'name' => 'image_shadow',
274 'exclude' => [
275 'shadow_position',
276 ],
277 'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item .usk-item-box .usk-image',
278 ]
279 );
280 $this->end_controls_tab();
281 $this->start_controls_tab(
282 'image_hover',
283 [
284 'label' => esc_html__('Hover', 'ultimate-store-kit'),
285 ]
286 );
287 $this->add_group_control(
288 Group_Control_Background::get_type(),
289 [
290 'name' => 'image_hover_background',
291 'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item:hover .usk-item-box .usk-image',
292 ]
293 );
294 $this->add_group_control(
295 Group_Control_Border::get_type(),
296 [
297 'name' => 'image_hover_border',
298 'label' => esc_html__('Image Border', 'ultimate-store-kit'),
299 'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item:hover .usk-item-box .usk-image',
300 'separator' => 'before',
301 ]
302 );
303
304 $this->add_responsive_control(
305 'image_hover_border_radius',
306 [
307 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
308 'type' => Controls_Manager::DIMENSIONS,
309 'size_units' => ['px', '%'],
310 'selectors' => [
311 '{{WRAPPER}} .' . $this->get_name() . ' .usk-item:hover .usk-item-box .usk-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
312 ],
313 ]
314 );
315
316 $this->add_group_control(
317 Group_Control_Box_Shadow::get_type(),
318 [
319 'name' => 'image_hover_shadow',
320 'exclude' => [
321 'shadow_position',
322 ],
323 'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-item:hover .usk-item-box .usk-image',
324 ]
325 );
326 $this->end_controls_tab();
327 $this->end_controls_tabs();
328
329 $this->end_controls_section();
330 }
331 protected function register_controls_content()
332 {
333 $this->start_controls_section(
334 'section_style_content',
335 [
336 'label' => esc_html__('Content', 'ultimate-store-kit'),
337 'tab' => Controls_Manager::TAB_STYLE,
338 ]
339 );
340
341 $this->start_controls_tabs('tabs_content_style');
342
343 $this->start_controls_tab(
344 'tab_content_normal',
345 [
346 'label' => esc_html__('Normal', 'ultimate-store-kit'),
347 ]
348 );
349 $this->add_group_control(
350 Group_Control_Background::get_type(),
351 [
352 'name' => 'content_background',
353 'label' => esc_html__('Background', 'ultimate-store-kit'),
354 'types' => ['classic', 'gradient'],
355 'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-content',
356 ]
357 );
358
359 $this->add_group_control(
360 Group_Control_Border::get_type(),
361 [
362 'name' => 'content_border',
363 'label' => esc_html__('Border Color', 'ultimate-store-kit'),
364 'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-content',
365 'separator' => 'before',
366 ]
367 );
368
369 $this->add_responsive_control(
370 'content_radius',
371 [
372 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
373 'type' => Controls_Manager::DIMENSIONS,
374 'size_units' => ['px', '%'],
375 'selectors' => [
376 '{{WRAPPER}} .' . $this->get_name() . ' .usk-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
377 ],
378 ]
379 );
380
381 $this->add_responsive_control(
382 'content_padding',
383 [
384 'label' => esc_html__('Padding', 'ultimate-store-kit'),
385 'type' => Controls_Manager::DIMENSIONS,
386 'size_units' => ['px', 'em', '%'],
387 'selectors' => [
388 '{{WRAPPER}} .' . $this->get_name() . ' .usk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
389 ],
390 ]
391 );
392 $this->end_controls_tab();
393
394 $this->start_controls_tab(
395 'tab_content_hover',
396 [
397 'label' => esc_html__('Hover', 'ultimate-store-kit'),
398 ]
399 );
400 $this->add_group_control(
401 Group_Control_Background::get_type(),
402 [
403 'name' => 'content_hover_background',
404 'label' => esc_html__('Background', 'ultimate-store-kit'),
405 'types' => ['classic', 'gradient'],
406 'selector' => '{{WRAPPER}} .' . $this->get_name() . ' .usk-content:hover',
407 ]
408 );
409 $this->add_control(
410 'content_hover_border_color',
411 [
412 'label' => esc_html__('Border Color', 'ultimate-store-kit'),
413 'type' => Controls_Manager::COLOR,
414 'condition' => [
415 'item_border_border!' => '',
416 ],
417 'selectors' => [
418 '{{WRAPPER}} .' . $this->get_name() . ' .usk-content:hover' => 'border-color: {{VALUE}};',
419 ],
420 ]
421 );
422 $this->end_controls_tab();
423
424 $this->end_controls_tabs();
425
426 $this->end_controls_section();
427 }
428 protected function register_controls_title()
429 {
430 $this->start_controls_section(
431 'section_style_title',
432 [
433 'label' => esc_html__('Title', 'ultimate-store-kit'),
434 'tab' => Controls_Manager::TAB_STYLE,
435 ]
436 );
437
438 $this->add_control(
439 'title_color',
440 [
441 'label' => esc_html__('Color', 'ultimate-store-kit'),
442 'type' => Controls_Manager::COLOR,
443 'selectors' => [
444 '.woocommerce {{WRAPPER}} ul.products li.product .woocommerce-loop-category__title, .woocommerce {{WRAPPER}} ul.products li.product .woocommerce-loop-product__title, .woocommerce {{WRAPPER}} ul.products li.product h3' => 'color: {{VALUE}}',
445 ],
446 ]
447 );
448
449 $this->add_control(
450 'hover_title_color',
451 [
452 'label' => esc_html__('Hover Color', 'ultimate-store-kit'),
453 'type' => Controls_Manager::COLOR,
454 'selectors' => [
455 '.woocommerce {{WRAPPER}} ul.products li.product .woocommerce-loop-category__title:hover, .woocommerce {{WRAPPER}} ul.products li.product .woocommerce-loop-product__title:hover, .woocommerce {{WRAPPER}} ul.products li.product h3:hover' => 'color: {{VALUE}};',
456 ],
457 ]
458 );
459
460 $this->add_responsive_control(
461 'title_margin',
462 [
463 'label' => esc_html__('Margin', 'ultimate-store-kit'),
464 'type' => Controls_Manager::DIMENSIONS,
465 'size_units' => ['px', '%'],
466 'selectors' => [
467 '.woocommerce {{WRAPPER}} ul.products li.product .woocommerce-loop-category__title, .woocommerce {{WRAPPER}} ul.products li.product .woocommerce-loop-product__title, .woocommerce {{WRAPPER}} ul.products li.product h3' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
468 ],
469 ]
470 );
471
472 $this->add_group_control(
473 Group_Control_Typography::get_type(),
474 [
475 'name' => 'title_typography',
476 'label' => esc_html__('Typography', 'ultimate-store-kit'),
477 'selector' => '.woocommerce {{WRAPPER}} ul.products li.product .woocommerce-loop-category__title, .woocommerce {{WRAPPER}} ul.products li.product .woocommerce-loop-product__title, .woocommerce {{WRAPPER}} ul.products li.product h3',
478 ]
479 );
480
481 $this->end_controls_section();
482 }
483 protected function register_controls_price()
484 {
485 $this->start_controls_section(
486 'section_style_price',
487 [
488 'label' => esc_html__('Price', 'ultimate-store-kit'),
489 'tab' => Controls_Manager::TAB_STYLE,
490 ]
491 );
492
493 $this->add_control(
494 'sale_price_color',
495 [
496 'label' => esc_html__('Sale Color', 'ultimate-store-kit'),
497 'type' => Controls_Manager::COLOR,
498 'selectors' => [
499 '{{WRAPPER}} .usk-up-sells ul.products li.product .price' => 'color: {{VALUE}}',
500 '{{WRAPPER}} .usk-up-sells ul.products li.product .price ins span' => 'color: {{VALUE}}',
501 '{{WRAPPER}} .usk-up-sells ul.products li.product .price ins .woocommerce-Price-amount.amount' => 'color: {{VALUE}}',
502 '{{WRAPPER}} .usk-up-sells ul.products li.product .price > .woocommerce-Price-amount.amount bdi' => 'color: {{VALUE}}',
503 ],
504 ]
505 );
506
507 $this->add_control(
508 'regular_price_color',
509 [
510 'label' => esc_html__('Regular Color', 'ultimate-store-kit'),
511 'type' => Controls_Manager::COLOR,
512 'selectors' => [
513 '.woocommerce {{WRAPPER}} .usk-up-sells ul.products li.product .price.amount' => 'color: {{VALUE}};',
514 '.woocommerce {{WRAPPER}} .usk-up-sells ul.products li.product .price del .woocommerce-Price-amount.amount' => 'color: {{VALUE}};',
515 '.woocommerce {{WRAPPER}} .usk-up-sells ul.products li.product .price del' => 'color: {{VALUE}};',
516 ],
517
518 ]
519 );
520
521 $this->add_responsive_control(
522 'price_margin',
523 [
524 'label' => esc_html__('Margin', 'ultimate-store-kit'),
525 'type' => Controls_Manager::DIMENSIONS,
526 'size_units' => ['px', '%'],
527 'selectors' => [
528 '{{WRAPPER}} .usk-up-sells ul.products li.product .price' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
529 ],
530 ]
531 );
532
533 $this->add_group_control(
534 Group_Control_Typography::get_type(),
535 [
536 'name' => 'sale_price_typography',
537 'label' => esc_html__('Typography', 'ultimate-store-kit'),
538 'selector' => '
539 {{WRAPPER}} .usk-up-sells ul.products li.product .price',
540 ]
541 );
542
543 $this->end_controls_section();
544 }
545 protected function register_controls_action_btn()
546 {
547 $this->start_controls_section(
548 'style_action_btn',
549 [
550 'label' => esc_html__('Action Button', 'ultimate-store-kit'),
551 'tab' => Controls_Manager::TAB_STYLE,
552 ]
553 );
554
555 $this->add_control(
556 'cart_color',
557 [
558 'label' => esc_html__('Color', 'ultimate-store-kit'),
559 'type' => Controls_Manager::COLOR,
560 'selectors' => [
561 '{{WRAPPER}} .usk-up-sells ul.products .button' => 'color: {{VALUE}}',
562 ],
563 ]
564 );
565 $this->add_control(
566 'cart_icon_bg',
567 [
568 'label' => esc_html__('Background', 'ultimate-store-kit'),
569 'type' => Controls_Manager::COLOR,
570 'selectors' => [
571 '{{WRAPPER}} .usk-up-sells ul.products .button' => 'background: {{VALUE}}',
572 ],
573 ]
574 );
575 $this->add_control(
576 'heading_cart_hover',
577 [
578 'label' => esc_html__('Hover', 'ultimate-store-kit'),
579 'type' => Controls_Manager::HEADING,
580 'separator' => 'before',
581 ]
582 );
583 $this->add_control(
584 'cart_color_hover',
585 [
586 'label' => esc_html__('Color', 'ultimate-store-kit'),
587 'type' => Controls_Manager::COLOR,
588 'selectors' => [
589 '{{WRAPPER}} .usk-up-sells ul.products .button:hover' => 'color: {{VALUE}}',
590 ],
591 ]
592 );
593 $this->add_control(
594 'cart_icon_bg_hover',
595 [
596 'label' => esc_html__('Background', 'ultimate-store-kit'),
597 'type' => Controls_Manager::COLOR,
598 'selectors' => [
599 '{{WRAPPER}} .usk-up-sells ul.products .button:hover' => 'background: {{VALUE}}',
600 ],
601 ]
602 );
603 $this->add_group_control(
604 Group_Control_Border::get_type(),
605 [
606 'name' => 'cart_btn_border',
607 'label' => esc_html__('Border', 'ultimate-store-kit'),
608 'selector' => '{{WRAPPER}} .usk-up-sells ul.products .button',
609 'separator' => 'before'
610 ]
611 );
612 $this->add_responsive_control(
613 'cart_btn_radius',
614 [
615 'label' => esc_html__('Radius', 'ultimate-store-kit'),
616 'type' => Controls_Manager::DIMENSIONS,
617 'size_units' => ['px', '%', 'em'],
618 'selectors' => [
619 '{{WRAPPER}} .usk-up-sells ul.products .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
620 ],
621 ]
622 );
623 $this->add_responsive_control(
624 'cart_btn_padding',
625 [
626 'label' => esc_html__('Padding', 'ultimate-store-kit'),
627 'type' => Controls_Manager::DIMENSIONS,
628 'size_units' => ['px', '%', 'em'],
629 'selectors' => [
630 '{{WRAPPER}} .usk-up-sells ul.products .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
631 ],
632 ]
633 );
634 $this->add_responsive_control(
635 'cart_btn_margin',
636 [
637 'label' => esc_html__('Margin', 'ultimate-store-kit'),
638 'type' => Controls_Manager::DIMENSIONS,
639 'size_units' => ['px', '%', 'em'],
640 'selectors' => [
641 '{{WRAPPER}} .usk-up-sells ul.products .button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
642 ],
643 ]
644 );
645 $this->add_group_control(
646 Group_Control_Typography::get_type(),
647 [
648 'name' => 'cart_button_typography',
649 'label' => __('Typography', 'ultimate-store-kit'),
650 'selector' => '{{WRAPPER}} .usk-up-sells ul.products .button',
651 ]
652 );
653
654 $this->end_controls_section();
655 }
656 protected function register_controls_items()
657 {
658 $this->start_controls_section(
659 'section_style_item',
660 [
661 'label' => esc_html__('Item', 'ultimate-store-kit'),
662 'tab' => Controls_Manager::TAB_STYLE,
663 ]
664 );
665
666 $this->start_controls_tabs('tabs_item_style');
667
668 $this->start_controls_tab(
669 'tab_item_normal',
670 [
671 'label' => esc_html__('Normal', 'ultimate-store-kit'),
672 ]
673 );
674
675 $this->add_group_control(
676 Group_Control_Background::get_type(),
677 [
678 'name' => 'item_background',
679 'label' => __('Background', 'ultimate-store-kit'),
680 'types' => ['classic', 'gradient'],
681 'selector' => '{{WRAPPER}} .usk-up-sells ul.products li.product',
682 ]
683 );
684
685 $this->add_group_control(
686 Group_Control_Border::get_type(),
687 [
688 'name' => 'item_border',
689 'label' => esc_html__('Border Color', 'ultimate-store-kit'),
690 'selector' => '{{WRAPPER}} .usk-up-sells ul.products li.product',
691 'separator' => 'before',
692 ]
693 );
694
695 $this->add_responsive_control(
696 'item_radius',
697 [
698 'label' => esc_html__('Border Radius', 'ultimate-store-kit'),
699 'type' => Controls_Manager::DIMENSIONS,
700 'size_units' => ['px', '%'],
701 'selectors' => [
702 '{{WRAPPER}} .usk-up-sells ul.products li.product' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; overflow: hidden;',
703 ],
704 ]
705 );
706
707 $this->add_group_control(
708 Group_Control_Box_Shadow::get_type(),
709 [
710 'name' => 'item_shadow',
711 'selector' => '{{WRAPPER}} .usk-up-sells ul.products li.product',
712 ]
713 );
714
715 $this->add_responsive_control(
716 'item_padding',
717 [
718 'label' => esc_html__('Padding', 'ultimate-store-kit'),
719 'type' => Controls_Manager::DIMENSIONS,
720 'size_units' => ['px', 'em', '%'],
721 'selectors' => [
722 '{{WRAPPER}} .usk-up-sells ul.products li.product' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
723 ],
724 ]
725 );
726
727 $this->add_control(
728 'item_alignment',
729 [
730 'label' => __('Alignment', 'ultimate-store-kit'),
731 'type' => Controls_Manager::CHOOSE,
732 'options' => [
733 'left' => [
734 'title' => __('Left', 'ultimate-store-kit'),
735 'icon' => 'eicon-h-align-left',
736 ],
737 'center' => [
738 'title' => __('Center', 'ultimate-store-kit'),
739 'icon' => 'eicon-h-align-center',
740 ],
741 'right' => [
742 'title' => __('Right', 'ultimate-store-kit'),
743 'icon' => 'eicon-h-align-right',
744 ],
745 ],
746 'default' => 'center',
747 'toggle' => false,
748 'selectors' => [
749 '{{WRAPPER}} .usk-up-sells ul.products li.product' => 'text-align: {{VALUE}};',
750 ],
751 ]
752 );
753
754
755 $this->end_controls_section();
756 }
757 protected function render()
758 {
759
760 $this->usk_set_single_post_preview_data();
761 $settings = $this->get_settings_for_display();
762 $limit = '-1';
763 $columns = isset($settings['columns']) ? $settings['columns'] : 4;
764 $orderby = isset($settings['orderby']) ? $settings['orderby'] : 'date';
765 $order = isset($settings['order']) ? $settings['order'] : 'desc';
766 ?>
767 <div class="usk-up-sells">
768 <?php woocommerce_upsell_display($limit, $columns, $orderby, $order); ?>
769 </div>
770 <?php
771 }
772 }
773