PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.14
Shortcodes and extra features for Phlox theme v2.17.14
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elementor / widgets / theme-elements / shopping-cart.php
auxin-elements / includes / elementor / widgets / theme-elements Last commit date
breadcrumbs.php 6 months ago copyright.php 6 months ago current-time.php 6 months ago logo.php 6 months ago menu.php 6 months ago modern-search.php 6 months ago search.php 6 months ago select.php 6 months ago shopping-cart.php 6 months ago site-title.php 6 months ago
shopping-cart.php
647 lines
1 <?php
2 namespace Auxin\Plugin\CoreElements\Elementor\Elements\Theme_Elements;
3
4 use Elementor\Plugin;
5 use Elementor\Widget_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Image_Size;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
10 use Elementor\Group_Control_Border;
11 use Elementor\Group_Control_Background;
12 use Elementor\Group_Control_Box_Shadow;
13
14
15 if ( ! defined( 'ABSPATH' ) ) {
16 exit; // Exit if accessed directly.
17 }
18
19 /**
20 * Elementor 'Shopping_Cart' widget.
21 *
22 * Elementor widget that displays an 'Shopping_Cart' with lightbox.
23 *
24 * @since 1.0.0
25 */
26 class Shopping_Cart extends Widget_Base {
27
28 /**
29 * Get widget name.
30 *
31 * Retrieve 'Shopping_Cart' widget name.
32 *
33 * @since 1.0.0
34 * @access public
35 *
36 * @return string Widget name.
37 */
38 public function get_name() {
39 return 'aux_shopping_cart';
40 }
41
42 /**
43 * Get widget title.
44 *
45 * Retrieve 'Shopping_Cart' widget title.
46 *
47 * @since 1.0.0
48 * @access public
49 *
50 * @return string Widget title.
51 */
52 public function get_title() {
53 return __('Shopping Cart', 'auxin-elements' );
54 }
55
56 public function has_widget_inner_wrapper(): bool {
57 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
58 }
59
60
61 /**
62 * Get widget icon.
63 *
64 * Retrieve 'Shopping_Cart' widget icon.
65 *
66 * @since 1.0.0
67 * @access public
68 *
69 * @return string Widget icon.
70 */
71 public function get_icon() {
72 return 'eicon-cart-light auxin-badge';
73 }
74
75 /**
76 * Get widget categories.
77 *
78 * Retrieve 'Shopping_Cart' widget icon.
79 *
80 * @since 1.0.0
81 * @access public
82 *
83 * @return string Widget icon.
84 */
85 public function get_categories() {
86 return array( 'auxin-core', 'auxin-theme-elements' );
87 }
88
89 /**
90 * Register 'Shopping_Cart' widget controls.
91 *
92 * Adds different input fields to allow the user to change and customize the widget settings.
93 *
94 * @since 1.0.0
95 * @access protected
96 */
97 protected function register_controls() {
98
99 /*-----------------------------------------------------------------------------------*/
100 /* button_section
101 /*-----------------------------------------------------------------------------------*/
102
103 $this->start_controls_section(
104 'button_section',
105 array(
106 'label' => __('Settings', 'auxin-elements' ),
107 )
108 );
109
110 $this->add_control(
111 'aux_shopping_cart_icon',
112 array(
113 'label' => __( 'Icon', 'auxin-elements' ),
114 'type' => Controls_Manager::ICONS
115 )
116 );
117
118 $this->add_control(
119 'cart_style',
120 array(
121 'label' => __( 'Cart Type', 'auxin-elements' ),
122 'type' => Controls_Manager::SELECT,
123 'options' => array(
124 'dropdown' => __( 'DropDown', 'auxin-elements' ),
125 'offcanvas' => __( 'Off Canvas', 'auxin-elements' )
126 ),
127 'default' => 'dropdown'
128 )
129 );
130
131 $this->add_control(
132 'cart_content_skin',
133 array(
134 'label' => __('Cart Skin', 'auxin-elements'),
135 'type' => Controls_Manager::SELECT,
136 'default' => 'light',
137 'options' => array(
138 'light' => __('Light', 'auxin-elements' ),
139 'dark' => __('Dark' , 'auxin-elements' )
140 )
141 )
142 );
143
144 $this->add_control(
145 'action',
146 array(
147 'label' => __('Display Basket', 'auxin-elements'),
148 'type' => Controls_Manager::SELECT,
149 'default' => 'hover',
150 'options' => array(
151 'hover' => __('On Hover', 'auxin-elements' ),
152 'click' => __('On Click' , 'auxin-elements' )
153 )
154 )
155 );
156
157 $this->add_control(
158 'basket_animation',
159 array(
160 'label' => __( 'Basket Animation', 'auxin-elements' ),
161 'type' => Controls_Manager::SWITCHER,
162 'label_on' => __( 'Yes', 'auxin-elements' ),
163 'label_off' => __( 'No', 'auxin-elements' ),
164 'return_value' => 'yes',
165 'default' => 'yes'
166 )
167 );
168
169 $this->add_control(
170 'simple_cart_mode',
171 array(
172 'label' => __( 'Simple Cart', 'auxin-elements' ),
173 'type' => Controls_Manager::SWITCHER,
174 'label_on' => __( 'Yes', 'auxin-elements' ),
175 'label_off' => __( 'No', 'auxin-elements' ),
176 'return_value' => 'yes',
177 'default' => 'yes'
178 )
179 );
180
181 $this->add_control(
182 'cart_header_text',
183 [
184 'label' => __( 'Text for cart', 'auxin-elements' ),
185 'type' => \Elementor\Controls_Manager::TEXT,
186 'default' => __( 'Shopping Basket', 'auxin-elements' ),
187 'condition' => array(
188 'simple_cart_mode' => ''
189 )
190 ]
191 );
192
193 $this->add_responsive_control(
194 'align',
195 array(
196 'label' => __( 'Alignment', 'auxin-elements' ),
197 'type' => Controls_Manager::CHOOSE,
198 'options' => array(
199 'start' => array(
200 'title' => __( 'Left', 'auxin-elements' ),
201 'icon' => 'eicon-text-align-left',
202 ),
203 'center' => array(
204 'title' => __( 'Center', 'auxin-elements' ),
205 'icon' => 'eicon-text-align-center',
206 ),
207 'end' => array(
208 'title' => __( 'Right', 'auxin-elements' ),
209 'icon' => 'eicon-text-align-right',
210 ),
211 ),
212 'default' => '',
213 'selectors' => [
214 '{{WRAPPER}} .aux-cart-element-container' => 'display: flex; justify-content: {{VALUE}};',
215 ]
216 )
217 );
218
219 $this->add_control(
220 'total_price_text_in_dropdown',
221 [
222 'label' => __( 'Total Price Text', 'auxin-elements' ),
223 'type' => \Elementor\Controls_Manager::TEXT,
224 'default' => __( 'Sub Total', 'auxin-elements' )
225 ]
226 );
227
228 $this->add_control(
229 'checkout_text',
230 [
231 'label' => __( 'Checkout Text', 'auxin-elements' ),
232 'type' => \Elementor\Controls_Manager::TEXT,
233 'placeholder' => __( 'Checkout', 'auxin-elements' )
234 ]
235 );
236
237
238 $this->end_controls_section();
239
240 /* title_style_section
241 /*-------------------------------------*/
242
243 $this->start_controls_section(
244 'bubble_section',
245 array(
246 'label' => __( 'Counter Bubble', 'auxin-elements' ),
247 'tab' => Controls_Manager::TAB_STYLE
248 )
249 );
250
251 $this->add_control(
252 'bubble_bg_color',
253 array(
254 'label' => __( 'Background', 'auxin-elements' ),
255 'type' => Controls_Manager::COLOR,
256 'selectors' => array(
257 '{{WRAPPER}} .aux-cart-contents > span' => 'background-color: {{VALUE}};',
258 )
259 )
260 );
261
262 $this->add_group_control(
263 Group_Control_Typography::get_type(),
264 array(
265 'name' => 'bubble_typography',
266 'global' => [
267 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
268 ],
269 'selector' => '{{WRAPPER}} .aux-cart-contents > span'
270 )
271 );
272
273 $this->add_control(
274 'bubble_text_color',
275 array(
276 'label' => __( 'Text Color', 'auxin-elements' ),
277 'type' => Controls_Manager::COLOR,
278 'selectors' => array(
279 '{{WRAPPER}} .aux-cart-contents > span' => 'color: {{VALUE}};',
280 )
281 )
282 );
283
284 $this->add_group_control(
285 Group_Control_Box_Shadow::get_type(),
286 array(
287 'label' => __( 'Box Shadow', 'auxin-elements' ),
288 'name' => 'bubble_box_shadow',
289 'selector' => '{{WRAPPER}} .aux-cart-contents > span'
290 )
291 );
292
293 $this->add_responsive_control(
294 'bubble_position_bottom',
295 array(
296 'label' => __('Position from Bottom','auxin-elements' ),
297 'type' => Controls_Manager::SLIDER,
298 'size_units' => array('px', 'em', '%'),
299 'range' => array(
300 'px' => array(
301 'min' => -100,
302 'max' => 100,
303 'step' => 1
304 ),
305 'em' => array(
306 'min' => -15,
307 'max' => 15,
308 'step' => 1
309 )
310 ),
311 'selectors' => array(
312 '{{WRAPPER}} .aux-cart-contents > span' => 'bottom:{{SIZE}}{{UNIT}};'
313 )
314 )
315 );
316 $this->add_responsive_control(
317 'bubble_position_right',
318 array(
319 'label' => __('Position from right','auxin-elements' ),
320 'type' => Controls_Manager::SLIDER,
321 'size_units' => array('px', 'em', '%'),
322 'range' => array(
323 'px' => array(
324 'min' => -100,
325 'max' => 100,
326 'step' => 1
327 ),
328 'em' => array(
329 'min' => -15,
330 'max' => 15,
331 'step' => 1
332 )
333 ),
334 'selectors' => array(
335 '{{WRAPPER}} .aux-cart-contents > span' => 'right:{{SIZE}}{{UNIT}};'
336 )
337 )
338 );
339
340 $this->add_responsive_control(
341 'bubble_padding',
342 array(
343 'label' => __( 'Padding', 'auxin-elements' ),
344 'type' => Controls_Manager::DIMENSIONS,
345 'size_units' => array( 'px', 'em' ),
346 'selectors' => array(
347 '{{WRAPPER}} .aux-cart-contents > span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
348 )
349 )
350 );
351
352 $this->end_controls_section();
353
354 /*-----------------------------------------------------------------------------------*/
355 /* text_section
356 /*-----------------------------------------------------------------------------------*/
357
358 $this->start_controls_section(
359 'dropdown_section',
360 array(
361 'label' => __('Dropdown', 'auxin-elements' ),
362 'tab' => Controls_Manager::TAB_STYLE,
363 )
364 );
365
366 $this->add_responsive_control(
367 'icon_size',
368 array(
369 'label' => __( 'Size', 'auxin-elements' ),
370 'type' => Controls_Manager::SLIDER,
371 'size_units' => array( 'px', 'em' ),
372 'range' => array(
373 'px' => array(
374 'max' => 100
375 ),
376 'em' => array(
377 'max' => 10
378 )
379 ),
380 'default' => [
381 'unit' => 'px',
382 'size' => 16,
383 ],
384 'selectors' => array(
385 '{{WRAPPER}} svg' => 'font-size: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};width: auto;',
386 )
387 )
388 );
389
390 $this->add_responsive_control(
391 'dropdown_position_bottom',
392 array(
393 'label' => __('Position from Bottom','auxin-elements' ),
394 'type' => Controls_Manager::SLIDER,
395 'size_units' => array('px', 'em', '%'),
396 'range' => array(
397 'px' => array(
398 'min' => -2000,
399 'max' => 2000,
400 'step' => 1
401 ),
402 '%' => array(
403 'min' => -100,
404 'max' => 100,
405 'step' => 1
406 ),
407 'em' => array(
408 'min' => -150,
409 'max' => 150,
410 'step' => 1
411 )
412 ),
413 'selectors' => array(
414 '{{WRAPPER}} .aux-card-dropdown' => 'bottom:{{SIZE}}{{UNIT}};'
415 )
416 )
417 );
418 $this->add_responsive_control(
419 'dropdown_position_left',
420 array(
421 'label' => __('Position from Left','auxin-elements' ),
422 'type' => Controls_Manager::SLIDER,
423 'size_units' => array('px', 'em', '%'),
424 'range' => array(
425 'px' => array(
426 'min' => -2000,
427 'max' => 2000,
428 'step' => 1
429 ),
430 '%' => array(
431 'min' => -100,
432 'max' => 100,
433 'step' => 1
434 ),
435 'em' => array(
436 'min' => -150,
437 'max' => 150,
438 'step' => 1
439 )
440 ),
441 'selectors' => array(
442 '{{WRAPPER}} .aux-card-dropdown' => 'left:{{SIZE}}{{UNIT}};'
443 )
444 )
445 );
446
447 $this->add_responsive_control(
448 'dropdown_width',
449 array(
450 'label' => __('Max Width','auxin-elements' ),
451 'type' => Controls_Manager::SLIDER,
452 'size_units' => array('px'),
453 'range' => array(
454 'px' => array(
455 'min' => 120,
456 'max' => 1600,
457 'step' => 1
458 )
459 ),
460 'selectors' => array(
461 '{{WRAPPER}} .aux-card-dropdown' => 'width:{{SIZE}}{{UNIT}};'
462 )
463 )
464 );
465
466 $this->add_responsive_control(
467 'dropdown_padding',
468 array(
469 'label' => __( 'Padding', 'auxin-elements' ),
470 'type' => Controls_Manager::DIMENSIONS,
471 'size_units' => array( 'px', 'em', '%'),
472 'allowed_dimensions' => 'all',
473 'selectors' => array(
474 '{{WRAPPER}} .aux-card-dropdown' => 'padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
475 )
476 )
477 );
478
479 $this->add_group_control(
480 Group_Control_Background::get_type(),
481 array(
482 'name' => 'dropdown_background',
483 'label' => __( 'Background', 'auxin-elements' ),
484 'types' => array( 'classic', 'gradient' ),
485 'selector' => '{{WRAPPER}} .aux-card-dropdown'
486 )
487 );
488
489 $this->add_group_control(
490 Group_Control_Border::get_type(),
491 array(
492 'name' => 'dropdown_border',
493 'selector' => '{{WRAPPER}} .aux-card-dropdown',
494 'separator' => 'none'
495 )
496 );
497
498 $this->add_group_control(
499 Group_Control_Box_Shadow::get_type(),
500 array(
501 'label' => __( 'Box Shadow', 'auxin-elements' ),
502 'name' => 'dropdown_box_shadow',
503 'selector' => '{{WRAPPER}} .aux-card-dropdown'
504 )
505 );
506
507 $this->end_controls_section();
508
509 /*-----------------------------------------------------------------------------------*/
510 /* text_section
511 /*-----------------------------------------------------------------------------------*/
512
513 $this->start_controls_section(
514 'item_style',
515 array(
516 'label' => __('Item', 'auxin-elements' ),
517 'tab' => Controls_Manager::TAB_STYLE,
518 )
519 );
520
521
522 $this->add_group_control(
523 Group_Control_Image_Size::get_type(),
524 array(
525 'name' => 'image', // Usage: `{name}_size` and `{name}_custom_dimension`, in this case `thumbnail_size` and `thumbnail_custom_dimension`.
526 'separator' => 'none',
527 'default' => 'thumbnail'
528 )
529 );
530
531 $this->add_responsive_control(
532 'item_padding',
533 array(
534 'label' => __( 'Padding', 'auxin-elements' ),
535 'type' => Controls_Manager::DIMENSIONS,
536 'size_units' => array( 'px', 'em' ),
537 'selectors' => array(
538 '{{WRAPPER}} .aux-cart-wrapper .aux-card-box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
539 ),
540 'separator' => 'after'
541 )
542 );
543
544 $this->add_control(
545 'title_color',
546 array(
547 'label' => __('Title color', 'auxin-elements'),
548 'type' => Controls_Manager::COLOR,
549 'default' => '#303030',
550 'selectors' => array(
551 '{{WRAPPER}} .aux-cart-wrapper .aux-card-item h3' => 'color: {{VALUE}}',
552 )
553 )
554 );
555
556
557 $this->add_group_control(
558 Group_Control_Typography::get_type(),
559 array(
560 'label' => __('Title Typography', 'auxin-elements' ),
561 'name' => 'title_typography',
562 'global' => [
563 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
564 ],
565 'selector' => '{{WRAPPER}} .aux-cart-wrapper .aux-card-item h3'
566 )
567 );
568
569 $this->add_control(
570 'price_color',
571 array(
572 'label' => __('Price color', 'auxin-elements'),
573 'type' => Controls_Manager::COLOR,
574 'default' => '#303030',
575 'selectors' => array(
576 '{{WRAPPER}} .aux-cart-wrapper .aux-card-item span' => 'color: {{VALUE}}',
577 )
578 )
579 );
580
581 $this->add_group_control(
582 Group_Control_Typography::get_type(),
583 array(
584 'label' => __('Price Typography', 'auxin-elements' ),
585 'name' => 'price_typography',
586 'global' => [
587 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
588 ],
589 'selector' => '{{WRAPPER}} .aux-cart-wrapper .aux-card-item span'
590 )
591 );
592
593
594 $this->end_controls_section();
595 }
596
597 /**
598 * Render image box widget output on the frontend.
599 *
600 * Written in PHP and used to generate the final HTML.
601 *
602 * @since 1.0.0
603 * @access protected
604 */
605 protected function render() {
606
607 $settings = $this->get_settings_for_display();
608 $align = ! empty( $settings['align'] ) ? ' aux-dropdown-' . $settings['align'] : '';
609 $dropdown_class = "";
610
611 if ( $settings['cart_style'] === 'offcanvas' ) {
612 $dropdown_class .= ' aux-desktop-off aux-tablet-off';
613 }
614
615 if ( $settings['simple_cart_mode'] = auxin_is_true( $settings['simple_cart_mode'] ) ) {
616 $dropdown_class .= ' aux-modern-dropdown';
617 }
618
619 $icon_value = ! empty( $settings['aux_shopping_cart_icon']['value'] ) ? $settings['aux_shopping_cart_icon'] : ( ! empty( $settings['icon'] ) ? $settings['icon'] : 'auxicon-shopping-bag-4' ) ;
620
621 $settings['image_custom_dimension']['width'] = empty( $settings['image_custom_dimension']['width'] ) ? '' : $settings['image_custom_dimension']['width'];
622 $settings['image_custom_dimension']['height'] = empty( $settings['image_custom_dimension']['height'] ) ? '' : $settings['image_custom_dimension']['height'];
623
624 echo '<div class="aux-cart-element-container">';
625 echo auxin_wc_add_to_cart(
626 array(
627 'css_class' => 'aux-cart-element'. $align .' aux-cart-type-'. $settings['cart_style'],
628 'dropdown_class' => $dropdown_class,
629 'dropdown_skin' => $settings['cart_content_skin'],
630 'action_on' => $settings['action'],
631 'icon' => $icon_value,
632 'size' => $settings['image_size'],
633 'width' => $settings['image_custom_dimension']['width'],
634 'height' => $settings['image_custom_dimension']['height'],
635 'simple_mode' => $settings['simple_cart_mode'],
636 'basket_animation' => auxin_is_true( $settings['basket_animation'] ),
637 'cart_header_text' => $settings['cart_header_text'],
638 'total_price_text_in_dropdown' => $settings['total_price_text_in_dropdown'],
639 'checkout_text' => $settings['checkout_text']
640 )
641 );
642 echo '</div>';
643
644 }
645
646 }
647