PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
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.1.4, at modules/up-sells/widgets/up-sells.php

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